Using .htaccess 












Using .htaccess/.htpasswd Password Protection 





Coding Tips 








Uploads and Downloads 



Mail 
see it on this page





Working with Images 


Frequently Requested Website Functionality 
see it on this page
see it on this page
see it on this page
see it on this page










Using PHP 




Website Managment 








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).
<?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);
?>
