Jump to content

help gethostbyaddr($_SERVER['REMOTE_ADDR'])


koolgirl

Recommended Posts

Hi

got tired trying to solve this problem. I have been using the following script to store visitor's data. It is working fine:

<?php

$dbcnx = @mysql_connect(

'mysql','username','mypass');

mysql_select_db("Main");

$sql = "INSERT INTO Records SET " .

"IP='$REMOTE_ADDR', " .

"BrowserName='$HTTP_USER_AGENT', " .

"Language='$HTTP_ACCEPT_LANGUAGE', " .

"Referer='$HTTP_REFERER', " .

"Date=NOW()";

***********************************************

I want to store the user's host name also. I know this will display the host name on screen:

<?
echo "Your Host Name: " . gethostbyaddr($_SERVER['REMOTE_ADDR'])";

?>

************************************************

but the problem is how to store it in database? it returns error if I write it this way:

<?php

$dbcnx = @mysql_connect(

'mysql','username','mypass');

mysql_select_db("Main");

$sql = "INSERT INTO Records SET " .

"IP=gethostbyaddr($_SERVER['REMOTE_ADDR'])";

******************************************


All help would be very much appriciated. Many Thanks
Link to comment
https://forums.phpfreaks.com/topic/11276-help-gethostbyaddr_serverremote_addr/
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.