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. Link to comment https://forums.phpfreaks.com/topic/32989-visitor-ip/ 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] Link to comment https://forums.phpfreaks.com/topic/32989-visitor-ip/#findComment-153584 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 Link to comment https://forums.phpfreaks.com/topic/32989-visitor-ip/#findComment-153586 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.