Jamrams Posted September 24, 2008 Share Posted September 24, 2008 Hey everyone, So recently I've been trying to make a form on the staff login bit on my website where it automatically adds the IP and Reason you type in to a database, and also the person who is logged in. Then, (in the header of the file) it checks if the IP matches one of ones in the database, and if it does it sends them to banned.php On banned.php, it checks which IP it is, then it shows whatever reason was entered and who banned them. This is the kinda thing I tried using... if($_SERVER["REMOTE_ADDR"] == "x.x.x.x") { header('location:banned.php'); die(); } but I couldn't figure out how to do much else (it works if you manually enter in an IP address). Any help on the matter would be greatly appreciated, Thanks! Link to comment https://forums.phpfreaks.com/topic/125655-solved-how-to-make-a-ban-form/ Share on other sites More sharing options...
DarkWater Posted September 24, 2008 Share Posted September 24, 2008 <?php $query = sprintf("SELECT * FROM banned WHERE ip = '%s'", $_SERVER['REMOTE_ADDR']); $result = mysql_query($query) or die(mysql_error()); if (mysql_num_rows($result) > 0) { header('Location: banned.php'); exit; } ?> Link to comment https://forums.phpfreaks.com/topic/125655-solved-how-to-make-a-ban-form/#findComment-649695 Share on other sites More sharing options...
Jamrams Posted September 24, 2008 Author Share Posted September 24, 2008 Thanks a lot for your help Got it workin' Link to comment https://forums.phpfreaks.com/topic/125655-solved-how-to-make-a-ban-form/#findComment-649817 Share on other sites More sharing options...
DarkWater Posted September 24, 2008 Share Posted September 24, 2008 No problem. =P Link to comment https://forums.phpfreaks.com/topic/125655-solved-how-to-make-a-ban-form/#findComment-649818 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.