I created a simple phpwcms counter script, it retrieves the vars from phpwcms directly
It just increases each page view, doesnt check to see if user just refreshed the page
Feel free to use the code on your website
To Install you have to use PhpMyAdmin and run this query:
Code: Select all
ALTER TABLE `phpwcms_article` ADD `article_count` INT NOT NULL ;
Then paste this into a file called count.php (doesnt matter really)
Code: Select all
<?php
/* This PHP Source was created by Scott Mcleod - 2004©
Email: iascoot@hotmail.com
Usage: A Simple Counter Script for PHPWCMS (www.phpwcms.de)
Created: Saturday, 28 February 2004
Last Modified: Saturday, 28 February 2004
*/
// Retrieve The Articles ID
global $content, $sql, $db;
$id = $content["article_id"];
// Retrieve the current count number for the article
$sql = "SELECT article_count FROM ".DB_PREPEND."phpwcms_article WHERE article_id=$id";
$result = mysql_query($sql, $db);
$int = mysql_result($result, 0);
// Update the count number
$int = $int + 1;
$sql = "UPDATE ".DB_PREPEND."phpwcms_article SET article_count='$int' WHERE article_id=$id";
$result = mysql_query($sql, $db);
// Output the result
print $int;
?>
Example Usage:
Page has been Viewed {PHP:count.php} times.
(Page has been Viewed 123 times.)