Simple text hit counter

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in the Customisations Database.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTICE: This forum is only for the announcement of new releases and/or updates of MODs. Any MOD support should be obtained through the Customisations Database in the support area designated for each MOD.

A direct link to support for each MOD is in the first post of the respective topic.
unknown2
Registered User
Posts: 676
Joined: Sat Mar 07, 2009 1:34 pm

Re: Simple text hit counter

Post by unknown2 »

This MOD its not providing information of each visit.
The counter is counting every single click on the forum (like topic visits, section visits...)
This MOD is now what i was excpecting. Can someone tell me other MOD wich have not this problem??

Best regards
Sir Drink a lot
Registered User
Posts: 2
Joined: Thu May 28, 2009 1:53 pm

Re: Simple text hit counter

Post by Sir Drink a lot »

Changing to visit counter:
I am not a profi in php... So please correct my code if it is wrong. But it works..
Installation is the same as described in original mod!
I changed hits.php only to this:

Code: Select all

<?php
/**
*
* @package phpBB3
* @version $Id: hits.php 1.0.1 2008-08-02 23:37 spyka $ edit by SirD
* @copyright (c) 2008 spyka Web Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
	exit;
}

$id = $user->data['user_id'];
$sql = 'SELECT session_start FROM ' . SESSIONS_TABLE . " WHERE session_user_id = $id";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$session_start = $row['session_start'];
$db->sql_freeresult($result);

if( $session_start >= (time() - 1) ){
	$hits = (isset($config['hits'])) ? ($config['hits'] + 1) : 1;
	set_config('hits', $hits, 1);

}else{
	$hits = $config['hits'];
}
$hits = number_format($hits, 0, '.', ',');

?>

In my old phpbb2 I used this code below and I just wanted the same for my phpbb3 forum.
The old code in my phpbb2 forum was:

Code: Select all

//
// Smartor's Visit Counter MOD
//
$visit_counter = $board_config['visit_counter'];
if( $userdata['session_start'] >= (time() - 1) )
{
	$sql = "UPDATE " . CONFIG_TABLE . "
			SET config_value = '" . ($visit_counter + 1) . "'
			WHERE config_name = 'visit_counter'";
	if( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Could not update counter information', '', __LINE__, __FILE__, $sql);
	}

	$visit_counter++;
}
Last edited by Sir Drink a lot on Mon Jun 01, 2009 5:36 am, edited 1 time in total.
unknown2
Registered User
Posts: 676
Joined: Sat Mar 07, 2009 1:34 pm

Re: Simple text hit counter

Post by unknown2 »

Didn't understand your edit!
Can you please specify your edits at the original file (like replaces and adds before/after)??

best regards
The-Lord
Registered User
Posts: 103
Joined: Thu Jan 31, 2008 12:13 pm

Re: Simple text hit counter

Post by The-Lord »

It has a small compatibility issues with the Knowledge Base Mod. Not sure.. if it is only me.
The article view count of knowledge base Mod is showing the hit counter from this Mod. Dunno if problem with this Mod or the KB Mod. I can live with it though.

Thanks for the cool Mod. :)
User avatar
Elitzur
I've Been Banned!
Posts: 323
Joined: Sat Sep 15, 2007 7:49 am
Location: Europe, UK.
Contact:

Re: Simple text hit counter

Post by Elitzur »

how do i put this mod in my stats below my statistics ?

looks like a good mod
Sir Drink a lot
Registered User
Posts: 2
Joined: Thu May 28, 2009 1:53 pm

Re: Simple text hit counter

Post by Sir Drink a lot »

Sorry for confusion :oops:

My edit before should only explain, why I changed the original hits.php.

With my code, it counts the visits regarding session_start time. (It is another point of view, how to count a visit. There exists a mod which checks for IP for really new visitors. ;) )
With my changings, it does not count anymore the page hits, of course.

Hm.. a good question is, how to make an own mod only with my changings. :oops: I don't know...

Erm.. where to find "knowledge base Mod"?
iftitaj
Registered User
Posts: 638
Joined: Tue Jan 15, 2008 6:21 am
Location: Karachi, Pakistan

Re: Simple text hit counter

Post by iftitaj »

Dan27 wrote:
Dan27 wrote:Umm... Hi again, well what I meant was, how do I get it to look like this:

Total posts X • Total topics X • Total members X • Page Views 10 • Our newest member X

How do I get it to show like this?

Any help please?
You seems very desperate to give it such a look. Still not bother to visit the very first page & read all posts.
ElitZuR wrote:how do i put this mod in my stats below my statistics ?

looks like a good mod
For you both, I'm mentioning a post from within this topic, explaining how to do exactly that.


Have a look at this post: http://www.phpbb.com/community/viewtopi ... 5#p6704425

And if you have any problem with it, you can ask here. Or maybe you want to customize it, just play with its code placing, and you will get what you want.
Crivit
Registered User
Posts: 2
Joined: Mon Jun 01, 2009 7:21 pm

Re: Simple text hit counter

Post by Crivit »

Sir Drink a lot wrote:Changing to visit counter:
I am not a profi in php... So please correct my code if it is wrong. But it works..
Installation is the same as described in original mod!
I changed hits.php only to this:

Code: Select all

<?php
/**
*
* @package phpBB3
* @version $Id: hits.php 1.0.1 2008-08-02 23:37 spyka $ edit by SirD
* @copyright (c) 2008 spyka Web Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
	exit;
}

$id = $user->data['user_id'];
$sql = 'SELECT session_start FROM ' . SESSIONS_TABLE . " WHERE session_user_id = $id";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$session_start = $row['session_start'];
$db->sql_freeresult($result);

if( $session_start >= (time() - 1) ){
	$hits = (isset($config['hits'])) ? ($config['hits'] + 1) : 1;
	set_config('hits', $hits, 1);

}else{
	$hits = $config['hits'];
}
$hits = number_format($hits, 0, '.', ',');

?>

In my old phpbb2 I used this code below and I just wanted the same for my phpbb3 forum.
The old code in my phpbb2 forum was:

Code: Select all

//
// Smartor's Visit Counter MOD
//
$visit_counter = $board_config['visit_counter'];
if( $userdata['session_start'] >= (time() - 1) )
{
	$sql = "UPDATE " . CONFIG_TABLE . "
			SET config_value = '" . ($visit_counter + 1) . "'
			WHERE config_name = 'visit_counter'";
	if( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Could not update counter information', '', __LINE__, __FILE__, $sql);
	}

	$visit_counter++;
}
I replace the original hits.php with your code but it doesn't seem to work...the counter stays on '0'?
Any idea what I'm doing wrong?
cashap
Registered User
Posts: 1
Joined: Wed Jun 24, 2009 8:25 pm

Re: Simple text hit counter

Post by cashap »

Same problem here, showing '0'. :(
unknown2
Registered User
Posts: 676
Joined: Sat Mar 07, 2009 1:34 pm

Re: Simple text hit counter

Post by unknown2 »

Can some1 tell me how do i change this code to Visits insted of Page Views ?? cause this code is counting page views! every refresh on page, or every topic readed its 1 for the counter, and i dont want that!
Best regards
iftitaj
Registered User
Posts: 638
Joined: Tue Jan 15, 2008 6:21 am
Location: Karachi, Pakistan

Re: Simple text hit counter

Post by iftitaj »

Then this is not your required MOD.
Go to MODs request forum & request there.
Richazey
Registered User
Posts: 823
Joined: Mon Oct 27, 2008 9:03 pm

Re: Simple text hit counter

Post by Richazey »

Nice mod cheers, is there anyway to give it a starting point instead of starting a zero?
iftitaj
Registered User
Posts: 638
Joined: Tue Jan 15, 2008 6:21 am
Location: Karachi, Pakistan

Re: Simple text hit counter

Post by iftitaj »

parkstee wrote:Nice mod cheers, is there anyway to give it a starting point instead of starting a zero?
You can manually manipulate number by editing value in the database, like using phpMyAdmin. You can do that by editing pageviews field in the phpbb_config table. After that this MOD will continue adding 1 to that number on each pageview. Cheers! :)
iftitaj
Registered User
Posts: 638
Joined: Tue Jan 15, 2008 6:21 am
Location: Karachi, Pakistan

Re: Simple text hit counter

Post by iftitaj »

alhitary wrote:does this mod work with 3.0.6 ??
Yes its working on my phpBB 3.0.6 though I installed it on previous version (then upgraded).
Locked

Return to “[3.0.x] MOD Database Releases”