|
|
|
<?php
//
// PHP/3 WebCounter Module
//
// Copyright (C) 1998 InWise GmbH, Halstenbek, Germany
//
// Please report bugs, enhancements etc to: hostmaster@inwise.de
//
//
// Parameters:
//
// digits=number_of_counter_digits (default: 6)
// font=font_for_counter_digits (default: default)
// key=key_for_counter_digits (default: HTTP_REFERER)
// force=number_for_counter_digits (no default value)
//
// Installation:
//
// - Install the script in an appropriate directory.
// - Install the font files (one GIF encoded image for each digit)
// in subdirectories named after the fonts.
//
// Example:
//
// # mkdir /path/to/digits
// # chown wwwrun.nogroup /path/to/digits
// # mkdir /path/to/digits/default
// # chown wwwrun.nogroup /path/to/digits/default
// # install -c -m 644 -o wwwrun -g group counter.php3 /path/to/digits
// # install -c -m 644 -o wwwrun -g group [0-9].gif /path/to/digits/default
//
// Add to "srm.conf":
//
// Alias /digits/ /path/to/digits/
//
// To enable PHP/3 for .php3 files add to "srm.conf":
//
// AddType application/x-httpd-php3 .php3
//
// Usage:
//
// <IMG SRC="/digits/counter.php3?digits=7" ALT="[counter]">
//
if( !isset($digits) ) {
$digits = 6;
}
if( !isset($font) ) {
$font = "default";
}
if( !isset($key) ) {
if( isset($HTTP_REFERER) ) {
$key = $HTTP_REFERER;
} else {
$key = $PHP_SELF;
}
}
$base = "./";
$dbase = $base."url.gdbm";
if( !file_exists($dbase) ) {
$number = 0;
} else {
$dbm = dbmopen($dbase,"r");
$number = dbmfetch($dbm,$key);
dbmclose($dbm);
}
$dbm = dbmopen($dbase,file_exists($dbase)?"w":"n");
if( isset($force) ) {
dbmreplace($dbm,$key,(string)((int)$force));
} else {
dbmreplace($dbm,$key,(string)(1+(int)$number));
}
dbmclose($dbm);
Header("Content-type: image/gif");
Header("Cache-control: no-cache");
Header("Pragma: no-cache");
Header("Last-modified: ".gmdate("D M d h:i:s Y",time())." GMT");
Header("Expires: ".gmdate("D M d h:i:s Y",time()+1)." GMT");
for( $i=0; $i<10; ++$i ) {
$digit[] = ImageCreateFromGif($base.$font."/".((string)$i).".gif");
}
$dx = ImageSX($digit[0]);
$dy = ImageSY($digit[0]);
$image = ImageCreate($digits*$dx,$dy);
$number = sprintf("%0".((string)$digits)."d",(int)$number);
for( $i=0; $i<$digits; ++$i ) {
ImageCopyResized($image,
$digit[(int)substr($number,$i,1)],
$i*$dx,0,0,0,$dx,$dy,$dx,$dy);
}
for( $i=0; $i<count($digit); ++$i ) {
ImageDestroy($digit[$i]);
}
ImageGif($image);
ImageDestroy($image);
?>
|
|
| Functions for loading images into a MySQL database and displaying them. Categories : Graphics, HTML and PHP, MySQL, PHP, Databases | | | Creating thumbnails from MySQL Blobs online Categories : PHP, MySQL, Graphics, HTML and PHP, Databases | | | html split bar used to split in multiple pages a database result Categories : HTML and PHP, Databases, MySQL, PHP | | | Automatically printing the contents of an sql table in MySQL. Categories : MySQL, PHP, HTML and PHP, Databases | | | A couple of functions that convert an IP address into its color code and not-color-code. Useful when viewing an apache log with a mysql result grouped by IP Categories : PHP, Graphics, Databases | | | Dynamically generated pop-ups (Select items) Categories : PHP, HTML and PHP, MySQL, Databases | | | Message of the Day - Random Message (Needs MySQL!) Categories : Databases, HTML and PHP, PHP, MySQL | | | Alternating background color for HTML table rows Categories : PHP, Databases, MySQL, HTML and PHP | | | A very simple way to build and do a hierarchical html categories browser without javascript , just using html php and mySql
Categories : HTML and PHP, Databases, Algorithms, PHP, MySQL | | | Random Image Display Categories : PHP, Filesystem, Graphics, HTML and PHP | | | XDT Topsite (Gold v1.0) Categories : Databases, CSS, PHP, HTML and PHP, Sessions | | | Pull Down Surfing - Surf on Change Categories : Java Script, MySQL, HTML and PHP, PHP, Databases | | | This function will populate the options in a drop down HTML select list
in a form from a database query.
Categories : MySQL, General SQL, PHP, HTML and PHP, Databases | | | How can i Preload a 'SELECT MULTIPLE'? Categories : HTML and PHP, PHP, MySQL, Databases | | | Record Set Paging with PHP (RSP) Categories : PHP, MySQL, Navigation, Databases, HTML and PHP | |
|
|
|