Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.