Tips adobe photo shop tutorial free photo shop tutorial photo shop online tutoria flash mx tutorial  flash macromedia mx free
flash mx template flash mx training web site web design web site design free web design web 3d wallpaper 3d studio max 3d graphic 3d art 3d studio max tutorial
design forum web design forum graphic design forum Photoshop Tips  adobe photo shop tutorial  photo shop 7 tutorial web site design web site promotion web design web site design free web
Go home [=] Read The Tutorials Chat talk speak learn ... verbalize Flash mx and more photoshop 6 or 7 and more web coding design principles and more Download Free Web Graphic Flash widgets About Flashgimp Contact Flashgimp This is a Chrome Bar, Duh!
esign psd psd template psd file dream weaver 3d art 3d studio max tutorial php php
 template 3d wallpaper 3d studio max 3d graphic
flashgimp -- php tutorial # 3
»»» A simple counter using php

This quick example shows you how to display the browser information of a visitor to your website using php. It's very basic. You should 1st create a file to store the hits in, in this example we used a file called 'mycount.dat' & started the count at 100. You can start it at 1 or 1 million, up to you.

Here is the script for this example

<?php
//A simple counter using php
//open the counter file in read only mode
$counterfile = "mycount.dat";
if(!($fp = fopen($counterfile,"r"))) die ("cannot open counter file");
//Check the value stored in the file
$count = (int) fread($fp, 20);
//close the file
fclose($fp);
//increment the count
$count++;
//display the count
echo "Welcome visitor no : $count";
//open the file again in write mode (w) and store
// the new count
$fp = fopen($counterfile, "w");
fwrite($fp , $count);
//close the file
fclose($fp);
?>

And here is the output , refresh your browser to increment the count.
»»» Welcome visitor no : 2232
Warning: fopen(mycount.dat) [function.fopen]: failed to open stream: Permission denied in /home/flashgim/public_html/tutorials/php_tutorials/motionrush_3_php_tutorial/index.php on line 202

Warning: fwrite(): supplied argument is not a valid stream resource in /home/flashgim/public_html/tutorials/php_tutorials/motionrush_3_php_tutorial/index.php on line 203

Warning: fclose(): supplied argument is not a valid stream resource in /home/flashgim/public_html/tutorials/php_tutorials/motionrush_3_php_tutorial/index.php on line 205

You can drop this snippet anywhere you like, but the page you put it into must be able to parse PHP code. So it should end in *.php


flashgimp -- Random Advertising Banner

Want to advertise here? Contact Us
 
[|| Admin Only ||] [|| Send Admin Mail ||] [|| Submit A Story For Review ||]



© 2002 flashgimp.com | design by motionrush media labs | hosting by nomosaki | sitemap
flashgimp - a new media forum for designers of all new media formats. Learn, chat, read/write tutorials,
network and grow in the fast paced web world.