Author Topic: [Mod] More Statistics for your visitors  (Read 199598 times)

0 Members and 1 Guest are viewing this topic.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
[Mod] More Statistics for your visitors
« Reply #45 on: June 01, 2003, 02:52:19 AM »
ah, yes...sorry, my bad...

are u sure line 9 is $row = $site_db->query_firstrow($sql); ?
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline www.girls-on-bikes.com

  • Full Member
  • ***
  • Posts: 145
    • View Profile
    • http://www.girls-on-bikes.com/
[Mod] More Statistics for your visitors
« Reply #46 on: June 01, 2003, 03:38:45 AM »
Yes, I am positive the error is occuring from that line.

Offline www.girls-on-bikes.com

  • Full Member
  • ***
  • Posts: 145
    • View Profile
    • http://www.girls-on-bikes.com/
[Mod] More Statistics for your visitors
« Reply #47 on: June 03, 2003, 05:41:43 AM »
Just to follow up, here's what I had to do to get site stats on every page (you can check them out by clicking on my link in my sig):

First I had to drop the stats.php include statement into every php files.

Then in all .html template files, I had to do:
Code: [Select]
<?php 
    $total_users2 
"&#123;total_users&#125;";
    
$total_votes2 "&#123;total_votes&#125;"
    
$total_comments2 "&#123;total_comments&#125;";
    
$total_hits2 "&#123;total_hits&#125;"
    
$total_downloads2 "&#123;total_downloads&#125;";
    include&
#40;"4gmenu.php"&#41;;
?>



Then in my 4gmenu.php, I had:

Code: [Select]
<?php
    
print $total_users2."<br>";
    print 
$total_votes2."<br>";
    print 
$total_hits2."<br>";
    print 
$total_comments2."<br>";
    print 
$total_downloads2."<br>";
?>



I know, it's sort of an ugly hack, but since the template I have includes a php file for the menu system, I had to do this.
Just wanted to let ya'll know in case anybody else ran into a similar problem.[/code]

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
[Mod] More Statistics for your visitors
« Reply #48 on: June 03, 2003, 05:46:18 AM »
Then in all .html template files, I had to do:
if u already do that way, why dont u just use those tags and insert your stats directly into EACH template? why do u need include them into 4gmenu.php ??? it's just waste of time and perfomance.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline www.girls-on-bikes.com

  • Full Member
  • ***
  • Posts: 145
    • View Profile
    • http://www.girls-on-bikes.com/
[Mod] More Statistics for your visitors
« Reply #49 on: June 03, 2003, 05:49:09 AM »
<rant>Because I don't like how we have to edit XX files just to get something to appear in the menu bar.  I am a fan of editing one file and having the changes appear on every page.</rant>

And the only way I could pass those {...} variables into my 4gmenu.php include file was to do the above.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
[Mod] More Statistics for your visitors
« Reply #50 on: June 03, 2003, 05:53:03 AM »
yes, but u already have to edit all files....that's my point ;)
and still if in the feature u want to change something in those stats, u'll need edit all files again...
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline www.girls-on-bikes.com

  • Full Member
  • ***
  • Posts: 145
    • View Profile
    • http://www.girls-on-bikes.com/
[Mod] More Statistics for your visitors
« Reply #51 on: June 03, 2003, 06:05:00 AM »
Yes, but I have set it up for minimal editing.
All I did was set some variables, so the only time I would need to go back through and change something is if I change a variable name, or add a new one.

If I want to change the look and feel of how they are displayed, I edit 1 file ;)

Offline Apollo13

  • Addicted member
  • ******
  • Posts: 1.093
    • View Profile
[Mod] More Statistics for your visitors
« Reply #52 on: June 22, 2003, 10:00:00 PM »
OK 4 all who want 2 display the last 5 resgisterd members.

Code: [Select]

//-----------------------------------------------------
//--- New Member --------------------------------------
//-----------------------------------------------------
   $sql = "SELECT user_id, user_name FROM ".USERS_TABLE."
          WHERE user_id > ".USER_AWAITING."
          ORDER by user_joindate DESC
          LIMIT 5";
  $result = $site_db->query($sql);

    while ($row = $site_db->fetch_array($result)) {
    $user_new_member_list .= '<img border="0" src="templates/1/images/arrow_icon.gif"> <a href ="'.ROOT_PATH.'member.php?action=showprofile&user_id='.$row['user_id'].'"><b>'.$row['user_name'].'</b></a><br>';
    }

$user_new_member_box = $site_template->parse_template("user_new_member_box");
$site_template->register_vars(array(
  "user_new_member_box" => $user_new_member_box,
  "user_new_member_list" => $user_new_member_list
));
  unset($user_new_member_box);
  unset($user_new_member_list);


create a new template called user_new_member_box.html and put {user_new_member_list} somewhere in.

Offline effemmess

  • Sr. Member
  • ****
  • Posts: 304
    • View Profile
[Mod] More Statistics for your visitors
« Reply #53 on: June 28, 2003, 03:50:27 AM »
Hi,

I´ve rewrote the stats.php for various reasons,in particular due to the non-standard db-tables. Plz look in this thread:http://www.4homepages.de/forum/viewtopic.php?t=6484 But there is my text in german, because i had not the time to translate it. Plz use google-tools! :wink: possibly I do later the translation...
Plz say me your opinion about the mod!
bye

Offline bentleykf

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: [Mod] More Statistics for your visitors
« Reply #54 on: May 02, 2005, 01:35:21 PM »
ummm, was the variable $sum intended to be used in any instance?

for example;
Code: [Select]
$sum = (isset($row['sum'])) ? $row['sum'] : 0;
 $total_hits = "".$lang['total_hits']."<B> ".$row['sum']."</B>\n";

should it not be;
Code: [Select]
$sum = (isset($row['sum'])) ? $row['sum'] : 0;
 $total_hits = "".$lang['total_hits']."<B> ". $sum."</B>\n";

Offline artpics

  • Full Member
  • ***
  • Posts: 173
    • View Profile
    • my site
Re: [Mod] More Statistics for your visitors
« Reply #55 on: May 03, 2005, 03:09:34 AM »
upload it anywhere on your server, then insert this in the .php file u want it be displayed:

Code: [Select]
<?php
define
&#40;'ROOT_PATH', './4images/'&#41;;
include&#40;ROOT_PATH.'global.php'&#41;;
include&#40;'PATH_TO_NEW_STATS/newstats.php'&#41;;
?>



change PATH_TO_NEW_STATS to .... path to the new stats.php file   
after that, u have 5 variables that content the stats:

$total_users
$total_hits
$total_votes
$total_downloads
$total_comments[/list:u]
u can use this:
Code:
echo $total_users;
or this:
Code:
<?=$total_users?>
to print them on screen.
Code:

have done the first part but haveing trouble printing the stats  it says
"upload it anywhere on your server, then insert this in the .php file u want it be displayed:"

 i want it to display on a html file but does not work

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Mod] More Statistics for your visitors
« Reply #56 on: May 03, 2005, 03:11:09 AM »
please use bbcode if u post a code and check the syntax of the code u've posted,
Code: [Select]
define&#40;'ROOT_PATH', './gallery/'&#41;;
doesnt looks right.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline artpics

  • Full Member
  • ***
  • Posts: 173
    • View Profile
    • my site
Re: [Mod] More Statistics for your visitors
« Reply #57 on: May 03, 2005, 04:08:14 AM »
my 4 images is inside a folder called gallery

so i insert this into my html file outside 4images

Code: [Select]
<?php
define
&#40;'ROOT_PATH', './4images/'&#41;;
include&#40;ROOT_PATH.'global.php'&#41;;
include&#40;'PATH_TO_NEW_STATS/newstats.php'&#41;;
?>

then on the html page i want to show the stats i insert this

tag
<?=$total_users?>

is this correct thanks  :D

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Mod] More Statistics for your visitors
« Reply #58 on: May 03, 2005, 04:20:09 AM »
no, the syntax is not correct, try it yourself ;) u'll get parse error.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline artpics

  • Full Member
  • ***
  • Posts: 173
    • View Profile
    • my site
Re: [Mod] More Statistics for your visitors
« Reply #59 on: May 03, 2005, 04:53:59 AM »
sorry veno do not understand syntax , will try tomorrow after some sleep