Hello friends in my last tutorial i teach you how to get the visitors ip addresses using php script. In today's tutorial i teach you how to block a IP address on your website.
To do so first create confic.inc.php file and save it to www folder where you server is installed as seen in the screenshot.
Step1:in first line we start php.
Step2:in second line we create a variable with name "$ip_address". which can be used for finding ip address.
Step3:in third line we create another variable with name "$ip_blocked". by using array put that ip addresses which we want to blocked.
Step4:closed the php.
Now Create another file index2.php as seen in the screenshot.
Step1:In first step we can start PHP.
Step2:Using require function call confic.inc.php.
Step3:Start loop
Step4:Start If Statement. in this if the ip address of user we want to blocked is matched then die function is performed and a written message as your ip address is blocked with ip address shown in the browser.
To do so first create confic.inc.php file and save it to www folder where you server is installed as seen in the screenshot.
Step1:in first line we start php.
Step2:in second line we create a variable with name "$ip_address". which can be used for finding ip address.
Step3:in third line we create another variable with name "$ip_blocked". by using array put that ip addresses which we want to blocked.
Step4:closed the php.
Now Create another file index2.php as seen in the screenshot.
Step1:In first step we can start PHP.
Step2:Using require function call confic.inc.php.
Step3:Start loop
Step4:Start If Statement. in this if the ip address of user we want to blocked is matched then die function is performed and a written message as your ip address is blocked with ip address shown in the browser.
No comments:
Post a Comment
Any Query, Suggestion Please Comment Here