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 image counter
Categories : PHP, Graphics, Filesystem, Beginner Guides Click here to Update Your Picture
Vijit Patil
Date : Apr 24th 2007
Grade : 2 of 5 (graded 2 times)
Viewed : 2494
File : 4617.zip
Images : Image 1
Search : More code by Vijit Patil
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

In this small example we are going to build a simple web counter.

First of all we read a text file in which we store our counter value. Depending on that value we display the counter value using images. Then we increase the counter value by 1 and write back to the text file.

Really simple script for beginners.... Will work well on low traffic sites where there is little chance for diffrent users to overite each others updates.

<?php

    $fp
= fopen ("counter.txt", "r");
   
$count_number = fread ($fp, filesize ("counter.txt"));
   
fclose($fp);
?>
<html>
        <head>
            <title>Counter number</title>
        </head>
        <body>
        <center>
        <?php
            $counter
= (int)($count_number) + 1;
           
$count_number = (string)($counter);
           
$len = strlen($count_number);
            while(
$len!=$i && $len!=0)
            {
                echo
"<img src=". $count_number[$i].".jpg alt=\"visitor number $count_number\" width=20 Height=22>";
               
$i++;
            }
           
$fp = fopen ("counter.txt", "w");
           
fwrite ($fp, $count_number);
           
fclose($fp);
       
?>
        </center>
        </body>
</html>




Introduction to Language Files
Categories : PHP, Filesystem, Beginner Guides
PHP Email image generator - hide your email from bots - using the GD Library
Categories : PHP, Graphics, GD image library, Beginner Guides
PHP based Contact email form with multiple recipients, text file based, supports departments.
Categories : PHP, Email, Beginner Guides, Filesystem
Convert a File database into MySQL
Categories : PHP, Filesystem, Databases, MySQL, Beginner Guides
This is a simple photo gallery that reads the image files from multiple directories, and generates a web page styled with CSS1. It opens single auto window to view and print a given image.
Categories : Graphics, Filesystem, PHP, Complete Programs
A flat file counter
Categories : PHP, Cookies, Filesystem, Beginner Guides
Random Image Display
Categories : PHP, Filesystem, Graphics, HTML and PHP
How to display any array in several rows and columns of a table. Not just in one column or in alternate rows. This example shows a nice color table generated with PHP, but can be used with any array values(e.g. Database)
Categories : Arrays, PHP, Miscellaneous, Beginner Guides, Graphics
Easy slideshow with php. Just place this one file into a subdirectory where jpg files reside. An instant slideshow is yours. MS explorer only.
Categories : PHP, Filesystem, Graphics
Creating a Language File
Categories : PHP, Beginner Guides, Filesystem
This program implements hot link prevention in php. It is useful for webmasters who do not have access to the server at a level where they can control hot linking can still supply some type of hot link prevention for thier site by using php.
Categories : PHP, Filesystem, Graphics, Content Management
This script will read all images from a folder and read the files into an array. It uses rand() to get a random number. It will display a random image from the image folder given.
Categories : PHP, Arrays, Graphics, Filesystem
Simple class that uses GD to draw pie charts. After the class definition there's some sample code to demonstrate how you use the class.
Categories : Graphics, PHP, PHP Classes, GD image library, Charts and Graphs
PHP4 DirectoryIterator Class
Categories : PHP, PHP Classes, Filesystem, Directories
Keep() - maintenance function for backup folders
Categories : PHP, Filesystem, Maintenance