Hey guys.
Heres my 4th PHP tutorial just rate it and tell me what you think.
We'll be going over user information and statistics.
We'll be going through loads.
Users IP.
Too show the users IP adress
Very simple, one line of code just place it in your table or wherever you want the IP adress to show.PHP Code:<?php echo $_SERVER["REMOTE_ADDR"]; ?>
An advanced and better way of getting someones IP adress
Browser InfoPHP Code:<?php
if(getenv(HTTP_CLIENT_IP)) {
$host = getenv(HTTP_CLIENT_IP);
}
elseif(getenv(HTTP_X_FORWARDED_FOR)) {
$host = getenv(HTTP_X_FORWARDED_FOR);
}
else {
$host = $REMOTE_ADDR;
}
?>
This is another easy one line code.
Very basic and easy too use.PHP Code:<?php echo $_SERVER["HTTP_USER_AGENT"]; ?>
Referer
Heres how too see what site they came from.
Hit CounterPHP Code:<?php echo $_SERVER["HTTP_REFERER"]; ?>
Now there a lot of different hit counters out there.
We're going to be using one like i'm using on my site, one thats run off a text file.
Now lets create a blank .txt file called count.txt
Now heres the simple PHP code.
Now you need to CHMOD the text file too 777 if you don't know how to do that then you shouldn't use this tutorial.PHP Code:<?php
$fp = fopen("count.txt","r");
$count = fread ($fp, filesize
("count.txt"));
fclose($fp);
$count++;
$fp = fopen("count.txt","w");
fwrite($fp, $count);
fclose($fp);
echo "Hits : $count";
?>
This is my 4th tutorial and they will all be used on my upcoming site opening 1st January 2006
- Dan





Reply With Quote
but as far as i know the more advanced ip should be = 


