|
Author |
Message |
Justin
4WebHelp Addict
Joined: 07 Jan 2002
Posts: 1060
|
Posted:
Mon Jun 07, 2004 5:48 pm (19 years, 9 months ago) |
|
Right, I have a speed test on a windows box which saves the results of the test to a database with IP and Hostnames, the script is PHP and below, the problem I have is that the IP address is not saved and the field inserted in to the database is blank, but the hostname is saved correctly.
The same script works fine on a linux box, could anyone tell me how I could fix this, the code I use to get the IP is located below.
Code: | <?php
if ($mysql == True) {
$link = mysql_connect($database["host"], $database["login"],
$database["password"])
or die("Could not connect");
mysql_select_db($database["database"])
or die("Could not select database");
$ip = $_SERVER['REMOTE_ADDR'];
$name = gethostbyaddr($ip);
$query = "INSERT INTO readings (speed, ip, name) VALUES ($kbps, '$REMOTE_ADDR', '$name')";
$result = mysql_query($query)
or die("Query failed");
}
?> |
|
|
|
|
|
Justin
4WebHelp Addict
Joined: 07 Jan 2002
Posts: 1060
|
Posted:
Mon Jun 07, 2004 7:42 pm (19 years, 9 months ago) |
|
|
|
|
|
|
You cannot post new topics in this forum. You cannot reply to topics in this forum. You cannot edit your posts in this forum. You cannot delete your posts in this forum. You cannot vote in polls in this forum.
|
Page generation time: 0.193247 seconds :: 18 queries executed :: All Times are GMT
Powered by phpBB 2.0
© 2001, 2002 phpBB Group :: Based on an FI Theme
| |