Jump to content

[SOLVED] Security Help...


nezbo

Recommended Posts

Hi all

 

I have some code and i can get it to work  :'(

 

i am trying to get the system to auto generate a if string, bellow is the code, i can get it to display the $IPS but the systems keeps passing through the if statment.

 

 

if ($_SERVER["HTTP_X_FORWARDED_FOR"] != "")
{
$IP = $_SERVER["HTTP_X_FORWARDED_FOR"];
$proxy = $_SERVER["REMOTE_ADDR"];
$host = @gethostbyaddr($_SERVER["HTTP_X_FORWARDED_FOR"]);
}
else
{
$IP = $_SERVER["REMOTE_ADDR"];
$host = @gethostbyaddr($_SERVER["REMOTE_ADDR"]);
}	


if (!$_POST['datestamp'] and !$_REQUEST['d'])
{
$mkDateHell = mktime();
$dateHell = date("d/m/Y", $mkDateHell);
$_REQUEST['d'] = $dateHell;
}

$getIPS = mysql_query("SELECT * FROM ipaddresses WHERE valid = 0");
while ($getIPS2 = mysql_fetch_array($getIPS))
{
$IPS = $IPS . " or (". $getIPS2['ipAddress'] . " == " . $IP  . ")";
}
echo $IPS;
if ((validate(16) == 1) . $IPS)
{	

Link to comment
https://forums.phpfreaks.com/topic/85355-solved-security-help/
Share on other sites

it's ok i have solved it, but it would be intresting to find out why i cant put a string in a if statment.

 

here is the new dit of code ::

 

$getIPS = mysql_query("SELECT ipAddress FROM ipaddresses WHERE valid = 0 and ipAddress = '$IP'");
$ipCount = mysql_num_rows($getIPS);
if ((validate(16) == 1) or ($ipCount > '0'))

Link to comment
https://forums.phpfreaks.com/topic/85355-solved-security-help/#findComment-435514
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.