Simple Site Stats Counter
3 posts
Page 1 of 1
This script is simple because it's using this flatfile thingy and it uses files as databases. That means you will take info and write it into another file so back to this tutorial.
First make a file called counter.txt and change it's CHMOD to 777
IP, BROWSER, REFERER and date when he/she/it visited this page, will be written into counter.txt
Have fun!
First make a file called counter.txt and change it's CHMOD to 777
Code: Select all
So now if someone will visit this page where's this script then her/his/its <?php
//User referer
$referer = $_SERVER['HTTP_REFERER'];
// User ip
$ip = $_SERVER['REMOTE_ADDR'];
//Your browser info
$browser = $_SERVER['HTTP_USER_AGENT'];
//Date
$date = date('r');
// Theres no referer then it will be marked with -
if($ref == ""){
$ref = "-";
}
//Text what will be written into counter.txt file
$text = "
IP: $ip
Browser: $browser
referer: $referer
Date: $date
";
// Opens counter.txt file
$open = fopen("counter.txt", "a");
//This writes all this text into counter.txt
fputs($open, $text);
// Closes counter.txt file
fclose($open);
?>
IP, BROWSER, REFERER and date when he/she/it visited this page, will be written into counter.txt
Have fun!
Back Aegean sorry not been on i.v just been moving.
I have seen this code elsewhere.
Last edited by mandai on Sun Apr 29, 2012 9:27 pm, edited 1 time in total.
Mandai have a little appreciation that he posted it here
Wow, and this is my 1000th post WD Me :P
Wow, and this is my 1000th post WD Me :P
3 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023