TechiWarehouse.Com


Top 3 Products & Services

1.
2.
3.


Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/santanaservices/public_html/techiwarehouse.com/cms/engine.php on line 37

Dated: Sep. 09, 2004

Related Categories

PHP Programming

OK guys, this script is a simple file based counter. This is meant for sites that do not run a db and instead, use a file and a cookie. It isn't the best I've seen but it's simple. Consider this as a tutorial.

Just create a file called counter.txt and put this where you want to display the counter.

Remember to set the permissions on counter.txt so that your webserver can write to the file.

<?
$visitor_ip = $HTTP_COOKIE_VARS["user_ip"];
$counter = "counter.txt";
$counter_file_line = file($counter);

if(!$vistor_ip)
{
setcookie("user_ip", $REMOTE_ADDR, time()+360000);
$counter_file_line[0]++;
$cf = fopen($counter, "w+");
fputs($cf, "$counter_file_line[0]");Flat File Counter
fclose($cf);
}
elseif($vistor_ip != $REMOTE_ADDR)
{
$counter_file_line[0]++;
$cf = fopen($counter, "w+");
fputs($cf, "$counter_file_line[0]");
fclose($cf);
}
?>

Now that you've gotten free know-how on this topic, try to grow your skills even faster with online video training. Then finally, put these skills to the test and make a name for yourself by offering these skills to others by becoming a freelancer. There are literally 2000+ new projects that are posted every single freakin' day, no lie!


Previous Article

Next Article


puvi's Comment
a e i o u

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/santanaservices/public_html/techiwarehouse.com/cms/comments.php on line 96
17 Wed Aug 2011
Admin's Reply:

 Vowels :) 






Facebook