Hits Per Day

By F*U*R*B*Y* on Dec 05, 2007

yeah just a simple script that counts how many hits per day you get...... just need to add it and the database =)

#########################################
# This is the actual Script!!!!         #
#########################################
<?
require("config.php");
$date = date(d).'-'.date(m);
$result1 = mysql_query("SELECT hit FROM hits WHERE `date` = '".$date."'");
if ($result=mysql_fetch_array($result1)) {
$newhit = $result['hit'] + 1;
echo "Hits for ".$date.": ".$newhit;
mysql_query("UPDATE hits SET `hit` = $newhit WHERE `date` = '".$date."'");
}else {
echo "Creating";
mysql_query("INSERT INTO hits VALUES('$date', '1')") or die(mysql_error());
}
?>

#########################################
# This is the Database Setup!!!         #
#########################################
 CREATE TABLE `hits` (
`date` VARCHAR( 11 ) NOT NULL ,
`hit` VARCHAR( 5 ) NOT NULL
) ENGINE = MYISAM 

Comments

Sign in to comment.
Jonesy44   -  May 27, 2008

I\'d perfer to use FURBY*\'s script, or improve it myself, then use it. i like to know where my data is, and know i can manipulate it into showing in whatever way i need it to ..
late post. lol

 Respond  
Hawkee   -  Dec 10, 2007

This isn\'t very useful because somebody could simply refresh the page over and over to increase the hits. You need to track unique IP addresses in order to prevent that. Anyway, there are plenty of stat programs like awstats, Urchin and Google Analytics that will do this job 100X better.

 Respond  
guest598594   -  Dec 10, 2007

i would but i dont know php :P

 Respond  
F*U*R*B*Y*   -  Dec 08, 2007

no comments??? no scores??? :( cries lol

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.