chriscloyd Posted November 20, 2006 Share Posted November 20, 2006 heres my php script for checking for bans[code]<?php//checkbansinclude("db.php");$ip = $_SERVER['REMOTE_ADDR'];$cip = mysql_query("SELECT * FROM bans WHERE ip = $ip");if ($cip) {$reason = $checkip['reason'];header("Location : banned.php?reason=".$reason."");}?>[/code]and i have this running off my localhost so i put ip 127.0.0.1 in the database but it wont send me to the banned.php page Quote Link to comment Share on other sites More sharing options...
fert Posted November 20, 2006 Share Posted November 20, 2006 is't because your viewing it in a web browser and when you do that it send your IP address and not 127.0.0.1 Quote Link to comment Share on other sites More sharing options...
Psycho Posted November 20, 2006 Share Posted November 20, 2006 echo $ip to the page and add that ip to the database. Quote Link to comment Share on other sites More sharing options...
chriscloyd Posted November 20, 2006 Author Share Posted November 20, 2006 i have done both ip addess my 68.104.210.230 and that oneand when i did echo $ip it shows 127.0.0.1 Quote Link to comment Share on other sites More sharing options...
chriscloyd Posted November 20, 2006 Author Share Posted November 20, 2006 i changed my code to [CODE]<?php//checkbansinclude("db.php");$ip = $_SERVER['REMOTE_ADDR'];$cip = mysql_query("SELECT * FROM bans WHERE ip = $ip") or die(mysql_error());if ($cip) {$reason = $checkip['reason'];header("Location: banned.php?reason=".$reason."");}?>[/CODE]and now i get the error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.0.1' at line 1 Quote Link to comment Share on other sites More sharing options...
chriscloyd Posted November 20, 2006 Author Share Posted November 20, 2006 i got it to worki just didnt do '$ip' on the mysql_query Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.