Hello all.
I am working and googling my keyboard out the window here with a script. I'm not really skilled in PHP or mySQL, but I try.
My problem here is in the script you see below.
If I enter the page from computer with IP:127.0.0.1 (witch is the lockalhost), the script works as I want.
But if I enter the page from computer with ip 192.168.x.x (a computer on the LAN), the script does not work.
I do get the echo ("You are $remote");, but the rest of the script wont work regardless of the 192.168.x.x can be found in $result = mysql_query("SELECT * FROM $table2 WHERE client_ip='$remote'"); or not.
What am I doing wrong?
EDIT: Fixed the = to ==
<?php
include ("login.php");
include ("db_info.php");
$remote = $_SERVER['REMOTE_ADDR'];
echo ("You are $remote");
mysql_select_db($db, $con);
$result = mysql_query("SELECT * FROM $table2
WHERE client_ip='$remote'");
while($row = mysql_fetch_array($result))
{
if ($row['client_ip'] == $remote) {
$ip = $row['client_ip'];
$name = $row['client_name'];
echo $ip . " " . $name;
echo "<br/>";
}
else {
echo "NOT VALID!";
}
}
mysql_close($con);
?>