PHP Gurus,
I'd like to be able to capture the IP address of a visitor to my webpage.
I'm using the following code snippet within my HTML. I do not want the user
to have to push a button or click on something to call the post or get
command to do this. What must I put in the file for this to happen
automatically when someone opens my index.html page? Obviously something
other than form method="post" or get that I have in the file now. How can I
do this?
Thanks in advance!
<form method="post" action="<?php echo $PHP_SELF?>">
<?php
$logged_string = "$REMOTE_AD DR|" . date("j M Y g:i a");
$file = fopen("userIP.l og", "a");
fputs($file, $logged_string, strlen($logged_ string));
fputs($file, "\r\n");
print("\n");
fclose($file);
?>
</form>
I'd like to be able to capture the IP address of a visitor to my webpage.
I'm using the following code snippet within my HTML. I do not want the user
to have to push a button or click on something to call the post or get
command to do this. What must I put in the file for this to happen
automatically when someone opens my index.html page? Obviously something
other than form method="post" or get that I have in the file now. How can I
do this?
Thanks in advance!
<form method="post" action="<?php echo $PHP_SELF?>">
<?php
$logged_string = "$REMOTE_AD DR|" . date("j M Y g:i a");
$file = fopen("userIP.l og", "a");
fputs($file, $logged_string, strlen($logged_ string));
fputs($file, "\r\n");
print("\n");
fclose($file);
?>
</form>
Comment