Jump to content

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

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.