Version: 1.0.0
Type: Full Script
Category: Other
License: GNU General Public License
Description: A simple graphical counter that post visitor information to a MySQL database
<?php /* WebScape WebCounter Copyright(C) 2000. Ryan Thompson http://webscape.datablocks.net [email protected] Feel free to distribute and update as you want. I know it's probably sloppy, but I'm learning. If you fix it up let me know. */ /* This script records visitor information into a MySQL database and uses pictures for a simple counter. Create a table called counter CREATE TABLE counter (id INT , browser VARCHAR (255) , ip VARCHAR (15) , referer VARCHAR (255) , time DATETIME not null ); And make sure it's point to some images called #.gif eg 1.gif, 2.gif etc. Records visit number, browser, IP, referer, and the date/time they visited. */ $db = mysql_connect("host", "username","password"); mysql_select_db("webscape",$db); $result = mysql_query ("SELECT * FROM counter"); //$rows = mysql_numrows($result); for ($count = 1; $row = mysql_fetch_row ($result); ++$count) {} $now = getdate(); $month = $now[mon]; $mday = $now[mday]; $year = $now[year]; $hours = $now[hours]; $min = $now[minutes]; $sec = $now[seconds]; $id = $count++; $browser = "$HTTP_USER_AGENT"; $ip = "$REMOTE_ADDR"; $referer = "$HTTP_REFERER"; $time = "$year-$month-$mday $hours:$min:$sec"; for ($i=0; $i < strlen($id); $i++) { $sign = substr($id, $i, 1); print("<img src="$sign.gif" border="0" alt="$sign">"); } //print "$id"; $counter = "INSERT INTO counter (ID, browser, IP, referer, time) VALUES ('$id','$browser','$ip','$referer','$time')"; $result = mysql_query($counter) ?>