Revision [16708]

This is an old revision of GmBowenCounter made by OguOnw on 2007-05-31 10:38:30.

 

Page Counter Action



the _pages table has to have the following field added....

`hits` int(50) NOT NULL default '0'


and the counter.php code (save as a file in the action directory)....

%%(php)
<?
$thispage=$this->GetPageTag();
Get hit count
$result2 = mysql_query( "SELECT hits FROM ".$this->config["table_prefix"]."pages WHERE tag='$thispage' AND latest='Y'" );
$row2 = mysql_fetch_array($result2);
$hit_count1 = $row2[hits];
Count is incremented if not your own page
if ($this->GetUserName() != $this->GetPageOwner($tag))
{
End Get hit Count Start adding hits
$hit_count2 = $hit_count1 1;
End adding hits Start Update Hit
$sql = "UPDATE `".$this->config["table_prefix"]."pages` SET `hits` = '$hit_count2' WHERE tag='$thispage' AND latest='Y'";
$sql .= " WHERE `ref` = $ref";
mysql_query($sql) or die("Unable to process query: " . mysql_error());
}
End Update Hit

parameter show="off" or "no" being checked for
$show = strtolower($show);
if ($show != 'off'
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki