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 PHP cookie counter
Categories : PHP, Cookies, Beginner Guides Click here to Update Your Picture
Shashank Prabhakara
Date : Oct 31st 2008
Grade : 2 of 5 (graded 3 times)
Viewed : 5255
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Shashank Prabhakara
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
Like this code?
Show the author your appreciation.
 

A simple and fast counter for beginners and low bandwidth sites

<?php

$counterFile = "/home/httpd/html/counter/counter.text";

function displayCounter($counterFile) {
global $counted
$fp = fopen($counterFile,rw);
$num = fgets($fp,5);
if (!$counted) {
$num += 1;
unlink("$counterFile");
exec("echo $num > $counterFile");
}
print "$num";
}

if (!file_exists($counterFile)) {
exec("echo 1 > $counterFile");
}

displayCounter($counterFile);
?>


/* Add the following to the very top of the page you want to count */

<?php if (!$counted) { setcookie("counted",1,time()+600); } ?>



Simple Cookie example
Categories : PHP, Beginner Guides, Cookies
A flat file counter
Categories : PHP, Cookies, Filesystem, Beginner Guides
A very simple PHP single password cookie based login without usernames.
Categories : PHP, Cookies, Security, Beginner Guides
Store, retrieve and delete cookies using JavaScript.
Categories : Java Script, Cookies, Beginner Guides, Cookies
Run a function once per session.
Categories : Beginner Guides, Java Script, Cookies
Using PHP im HTML image tags
Categories : PHP, HTML and PHP, Graphics, Beginner Guides
How to make sure a that $foo is from a cookie and not from the URI.
Categories : PHP, Variables, Global Variables, Cookies
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
Secure Login
Categories : PHP, MySQL, Cookies, Security
Db_lib - practical example usage of database abstraction and form validation.
Categories : PHP, Form Processing, PHP Classes, Data Validation, Beginner Guides
Form Validation Using PHP to highlight non valid fields
Categories : PHP, Form Processing, Data Validation, Beginner Guides
Make old style (PHP3) scripts using GET, POST, COOKIE and File uploads (POST) compatible with PHP 4.2.0
Categories : PHP, HTML and PHP, Global Variables, Cookies, Variables
SQLite PHP Database Wrapper
Categories : PHP, PHP Classes, Databases, SQLite, Beginner Guides
a PHP Function to Get only the filename (remove the extension) using regular expressions.
Categories : PHP, Regexps, Beginner Guides
PHP Utilities - correct grammar helpers: the plural, to be and to have
Categories : PHP, Utilities, Beginner Guides
 Jason Hopkins wrote :1818
Sorry for the low grade, but it should be common knowledge
to not break into and out of the PHP tags.  Also, putting 
an entire if construct on one line really irks me.