psychohagis Posted January 5, 2007 Share Posted January 5, 2007 I want to know how you can get a visitors ip adress. I know it can be done because a site I use sometimes block people from the whole site if they dont get the message to follow the rules (not speaking from experience).Does anyone know how to do this. Im guessing its a global or something but i dont know what it is. Quote Link to comment Share on other sites More sharing options...
taith Posted January 5, 2007 Share Posted January 5, 2007 [code]<?function get_ip(){ if(!$ip=@$REMOTE_ADDR) $ip=$_SERVER['REMOTE_ADDR']; return $ip;}$ip=get_ip();$result=mysql_query("SELECT * FROM bannedips WHERE `ip`='$ip' LIMIT 1");if(mysql_num_rows($result)!=0) die("You Were Banned!");?>[/code] Quote Link to comment Share on other sites More sharing options...
psychohagis Posted January 5, 2007 Author Share Posted January 5, 2007 thanks, seems farely obvious, ill try it out 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.