#################################################################
# Text Counter 1.0 #
# Script by: Bull Eaton #
# Web: http://www.phpwebworks.net #
# #
# Copyright 2005-2006 - PHPWebWorks.Net. All rights reserved. #
#################################################################
session_start();
// ---------- this prevents incrementing return counter on subsequent page views ------- //
// --------------------------- if visitor has cookies disabled ------------------------- //
if(!IsSet($pid) and !IsSet($session)){
global $session;
$session = "0";
} else {
global $session;
$session = "1";
}
// ----------------------------------- EDIT HERE ---------------------------------------- //
$counter_file = "counter/counter.txt"; // file containing total number of visitors
$returncount_file = "counter/returnvisits.txt"; // file containing number of returning visitors
$newcount_file = "counter/newvisits.txt"; // file containing number of new visitors
$noip_counter = "counter/noipcounter.txt";
$month = date("Y_m_F");
$date1 = date("D, M jS y, g:i a");
$date2 = date("m-d-y, g:i a");
$ip_file = "counter/$month.txt"; // file containing the ip addresses and timestamps of new visitors
$ip_only = "counter/ip.txt"; // file containing the ip addresses of new visitors
$test_file = "counter/test.txt";
$ip_array = file($ip_only);
$referer = getenv("HTTP_REFERER");
$browser = getenv("HTTP_USER_AGENT");
$ip = getenv("REMOTE_ADDR");
$iptext_new = "\n$ip, ";
$iptext_new .= "$date2, ";
$iptext_new .= "$browser";
$iptext_return = "\n$ip, ";
$iptext_return .= "$date2";
// -------------------------------------------------------------------------------------- //
// ----------------------------- Creation of the counter files -------------------------- //
if(!file_exists("$counter_file")) {
$fp = fopen("$counter_file","w");
fwrite($fp,"0");
fclose($fp);
}
// ------------------------------------------------------------------------------------- //
// ----------------- Visitor already came : the cookie is here ------------------------- //
include("counter/cookie.vars.inc");
if(isset($_COOKIE["$countercookie"]) && $_COOKIE["$countercookie"] == "$countercookie_value")
{
$fp=fopen($counter_file,"r+");
$count=fread($fp,10);
$count=$count;
fclose($fp);
}
// ----------------- A new visitor is coming: creation of a cookie ---------------------- //
else
{
setcookie($countercookie, $countercookie_value, time()+$countercookie_life, "");
$fp=fopen($counter_file,"r+");
$count=fgets($fp,10);
$count++;
fseek($fp,0);
fputs($fp,$count);
fclose($fp);
}
// -------------------------------------------------------------------------------------- //
$_SESSION["session"] = "1";
?>
|
 |
----------------- |
I am not building models or taking orders at this time.
|
|
----------------- |
Have you ordered a tractor for the man who has everything else? |
----------------- |
|
 |
|
|
|