WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
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 Resources
Web Development Content
Internet Security Software
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
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

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 : 8878
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  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>




Convert a File database into MySQL
Categories : PHP, Filesystem, Databases, MySQL, Beginner Guides
Introduction to Language Files
Categories : PHP, Filesystem, Beginner Guides
A flat file counter
Categories : PHP, Cookies, Filesystem, Beginner Guides
Selecting a random line from a text file
Categories : PHP, Filesystem, Arrays, Beginner Guides
Random Image Display
Categories : PHP, Filesystem, Graphics, HTML and PHP
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
Read DPI value from image with PHP
Categories : PHP, Graphics, Filesystem
Creating a Language File
Categories : PHP, Beginner Guides, Filesystem
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
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
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
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
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
PHP Image Validation Class - test if a specific file is of a certain image type without relying on the said file extension.
Categories : PHP, PHP Classes, Data Validation, Graphics, Beginner Guides