Using .htaccess 












Using .htaccess/.htpasswd Password Protection 


php5
php5
Coding Tips 






Uploads and Downloads 

php5
php5
php5
Mail 



php5


Working with Images 


Frequently Requested Website Functionality 
php5
php5

php5 see it on this page
php5








Using PHP 
php5
php5
php5


Website Managment 







php5

php5
Other Tips 







Visitor Counter
This simple script creates an image that can be used on any page to display a visitor counter. A session variable is used to ensure that the counter only advances once per browser session (the most accurate way to count website visitors). If you want to see how it works, the counter is shown here:
<?php
$filename = 'counter.dat';
session_start();
if (!isset($_SESSION['visitor_counter']) AND is_writable($filename)) {
$count = @file_get_contents($filename);
if (is_numeric($count)) {
$count++;
@file_put_contents($filename,$count,LOCK_EX);
$_SESSION['visitor_counter'] = $count;
}
} else {
$count = $_SESSION['visitor_counter'];
}
$width = (strlen($count)*8)+8;
$im = @imagecreate($width, 18);
$background_color = imagecolorallocate($im,255,255,255);
$text_color = imagecolorallocate($im,0,0,0);
imagestring($im,4,4,2,$count,$text_color);
imagepng($im);
imagedestroy($im);
?>