WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
PHP Web Logs (BLogs)
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Submit Site
Forex Trading Online forex trading platform

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Simple PHP/3 Access Counter (using GD and DBM functions)
Categories : Databases, PHP, Graphics, HTML and PHP, dBase Update Picture
Torsten Neuer
Date : Dec 09th 1998
Grade : 2 of 5 (graded 5 times)
Viewed : 10183
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Torsten Neuer
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

<?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