Jump to content

little help please...


desjardins2010

Recommended Posts

hey guys/gals

 

I'm using this code there to store a random ip address to users when they sign up

 

function make_ip(){ 
    $inum1 = rand(0,255); 
    $inum2 = rand(0,255); 
    $inum3 = rand(0,255); 
    $inum4 = rand(0,255); 
    $ip = $inum1.'.'.$inum2.'.'.$inum3.'.'.$inum4;
$ip=ip2long($ip); 
    return $ip;     
}
function long_2IP($ip){ 
    $display_ip=long2ip($ip); 
    return $display_ip;     
}  
function makeUniqueIP()
{ 
do  
{
	$ip_address=make_ip();
	$ip_addressExixt='';
	$validateRandQuery="select IPaddress from members where IPaddress='".$ip_address."'";
	$result=mysql_query($validateRandQuery) or die(mysql_error());
	if($row=mysql_fetch_array($result))
	{
		$ip_addressExixt=$row['IPaddress'];
	}		
}
while($jobIdExist);
return $ip_address;
}

 

 

Now that I have the IP sotred in the db I need to reference it when a user fills in a form searching for ip 231.45.115.29 it's stored in db as 3878515485 using log2ip i'm able to exstract if but how to I compare a submission as 231.45.115.29 to the value in the db. right now it just comes back saying that ip was not found

Link to comment
https://forums.phpfreaks.com/topic/222232-little-help-please/
Share on other sites

the ip is already done were building a GAME hacking simulation fo each user upon registration is given a FAKE ip address for in game purpose, the IP is being stored in the data base as mentioned above in a different format then the long2ip bring it out as a normal IP address problem is I need to compare an ip submitted for search as 231.45.115.29 and search the db for an account with an IP that matches that... there not being stored in  the same format though so i'm not comparing apples to apples.. :)

Link to comment
https://forums.phpfreaks.com/topic/222232-little-help-please/#findComment-1149623
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.