![]() |
|
Button that automatically bans users' IP from site? - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Webmasters (https://hackforums.net/forumdisplay.php?fid=141) +---- Forum: Website Construction (https://hackforums.net/forumdisplay.php?fid=50) +---- Thread: Button that automatically bans users' IP from site? (/showthread.php?tid=5511183) |
Button that automatically bans users' IP from site? - Not Your Average Orange - Jan 1, 2017 Title says it all, I'd like a visible button that once clicked bans the clickers IP automatically. Thanks! * - AshleyUK - Jan 1, 2017 (Jan 1, 2017 06:41 PM)hkessel1 Wrote: Title says it all, I'd like a visible button that once clicked bans the clickers IP automatically. You will have to get the users ip and store this in a variable. You will then need to input this into a database(MySQL). You will then need to check a visitors IP against the list of IPs in the database and restrict access if it is in there. This should be able to be done with PHP. If you research the different parts, you should be able to put them together. I do not know why you would need to do something like this but its 2am currently so i will take a look in the mourning if i remember. * - Rushax - Jan 2, 2017 https://www.sitepoint.com/community/t/getting-htaccess-to-read-from-mysql-database/5180/4 I'd take a look at some of the suggestions here in some way and then trying to incorporate that adding to the .htaccess file to block users IP. You'd most likely have to set up a database with PHP and mySQL and save a variable of their IP address when they connect to the site. Then if the button gets clicked, it sends the variable to the database and then the .htaccess gets modified. That looks like a plausible way of accomplishing what you're after. * - Not Your Average Orange - Jan 2, 2017 (Jan 1, 2017 07:05 PM)UGAshley Wrote: You will have to get the users ip and store this in a variable. You will then need to input this into a database(MySQL). You will then need to check a visitors IP against the list of IPs in the database and restrict access if it is in there. This should be able to be done with PHP. (Jan 2, 2017 02:26 AM)Rushax Wrote: https://www.sitepoint.com/community/t/getting-htaccess-to-read-from-mysql-database/5180/4 Okay, thanks guys. |