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

0 Members and 1 Guest are viewing this topic.

Offline tansamalaja

  • Full Member
  • ***
  • Posts: 185
    • View Profile
Re: [Mod] More Statistics for your visitors
« Reply #120 on: January 29, 2007, 01:38:54 PM »
Poste doch mal die Zeilen 1-5 aus deiner stats.php, aber sow ie ich das sehe, hast du ein "/" zuviel in Zeile 2, vielleicht ist es ja aus Zeile 3 dort hinein gerutscht...

Send us lines 1-5 of your stats.php. I think you have an "/" too much in line 2, perhaps it belongs in line 3...

Offline Foto-Portal

  • Newbie
  • *
  • Posts: 43
    • View Profile
Re: [Mod] More Statistics for your visitors
« Reply #121 on: February 06, 2007, 12:14:44 PM »
works fine.. thanks!!!!  :wink: :wink: :wink: :wink: :wink: :wink: :P :P :P :P

Hi all,

I did already forgot about this little modification I did. I was in fact the first little mod I did ever in PHP.

The idea is to show more statistics then the number of images and categories (which are shown by default).
This MOD will show:
- Number of Members
- Number of Image Votes
- Number of Image Hits
- Number of Image Comments
- Number of Image Downloads

All these are shown on totals, so it shows the total number of image hits over all images. You can see an example of it here: http://haunter.student.utwente.nl/Terrarevolution/galleries/index.php

// Ok, now lets get started

Creating the stats.php file
Make a new file called: stats.php
Save this empty file in the includes folder of 4images
Open stats.php with any code editor you like.

and copy past the following to your stats.php:
Code: [Select]
<?PHP

//-----------------------------------------------------
//--- Show number of Users ----------------------------
//-----------------------------------------------------
   $sql = "SELECT COUNT(*) as users
          FROM ".USERS_TABLE."
          WHERE user_id <> ".GUEST;
  $row = $site_db->query_firstrow($sql);

  $total_users = "".$lang['users']."<B> ".$row['users']."</B>\n";
 
  $site_template->register_vars("total_users", $total_users);
unset($total_users);

//-----------------------------------------------------
//--- Hits --------------------------------------------
//-----------------------------------------------------
$sql = "SELECT SUM(image_hits) AS sum
          FROM ".IMAGES_TABLE;
  $row = $site_db->query_firstrow($sql);

  $sum = (isset($row['sum'])) ? $row['sum'] : 0;
  $total_hits = "".$lang['total_hits']."<B> ".$row['sum']."</B>\n";
 
  $site_template->register_vars("total_hits", $total_hits);
unset($total_hits);

//-----------------------------------------------------
//--- Votes -------------------------------------------
//-----------------------------------------------------
$sql = "SELECT SUM(image_votes) AS sum
          FROM ".IMAGES_TABLE;
  $row = $site_db->query_firstrow($sql);

  $sum = (isset($row['sum'])) ? $row['sum'] : 0;
  $total_votes = "".$lang['total_votes']."<B> ".$row['sum']."</B>\n";
 
  $site_template->register_vars("total_votes", $total_votes);
unset($total_votes);

//-----------------------------------------------------
//--- Downloads ---------------------------------------
//-----------------------------------------------------
$sql = "SELECT SUM(image_downloads) AS sum
          FROM ".IMAGES_TABLE;
  $row = $site_db->query_firstrow($sql);

  $sum = (isset($row['sum'])) ? $row['sum'] : 0;
  $total_downloads = "".$lang['total_downloads']."<B> ".$row['sum']."</B>\n";
 
  $site_template->register_vars("total_downloads", $total_downloads);
unset($total_downloads);

//-----------------------------------------------------
//--- Comments ----------------------------------------
//-----------------------------------------------------
$sql = "SELECT SUM(image_comments) AS sum
          FROM ".IMAGES_TABLE;
  $row = $site_db->query_firstrow($sql);

  $sum = (isset($row['sum'])) ? $row['sum'] : 0;
  $total_comments = "".$lang['total_comments']."<B> ".$row['sum']."</B>\n";
 
  $site_template->register_vars("total_comments", $total_comments);
unset($total_comments);
?>

Now save the stats.php file.

ALWAYS BACKUP: any file you start editing as you might not be able to restore it when the mod doesn't work

Adding the statistics to the language files:

*NOTE* I only edited this in English, but you will have to copy this to any language you use and maybe translate the english.

Open the main.php file from the lang/[your language] folder of 4images.

Go all the way to the bottom of the file.

Find:
Code: [Select]
//-----------------------------------------------------
//--- Admin Links -------------------------------------
//-----------------------------------------------------
$lang['edit'] = "[Edit]";
$lang['delete'] = "[Delete]";

Add Before:
Code: [Select]
//-----------------------------------------------------
//--- Statistics --------------------------------------
//-----------------------------------------------------
$lang['users'] = "Total Members:";
$lang['total_hits'] = "Total Image Hits:";
$lang['total_votes'] = "Total Image Votes:";
$lang['total_downloads'] = "Total Image Downloads:";
$lang['total_comments'] = "Total Image Comments:";

Including the statistics in Index.php:

Open index.php in the root folder of 4images with any code editor you like.

Find:
Code: [Select]
require(ROOT_PATH.'includes/sessions.php');
Add after:
Code: [Select]
include(ROOT_PATH.'includes/stats.php');
Do the same for catergories.php, lightbox.php, top.php
(it might also work in memberlist.php, search.php, register.php etc. but I did not test them yet)

Now edit the template files that correspond with the php files you added the include to.

index.php = home.html
categories.php = categories.html
lightbox.php = lightbox.html
top.php = top.html

you can find the templates inside the templates/default folder of 4images.

In the templates you can now use the following tags:

{total_users} - This will show the total number of members
{total_votes} - This will show the total number of image votes
{total_comments} - This will show the total number of image comments
{total_hits} - This will show the total number of image hits
{total_downloads} - This will show the total number of image downloads

Uploading all the edited files:

Now upload all files you editted to the right folder at your webserver.

This is a list of files you need to upload:
./index.php
./categories.php
./lightbox.php
./top.php
./includes/stats.php
./lang/ (any language you editted) /main.php
./templates/ (any templates you editted) /home.html
./templates/ (any templates you editted) /categories.html
./templates/ (any templates you editted) /lightbox.html
./templates/ (any templates you editted) /top.html

of course if you editted any more files then the once I mentioned above, you will need to upload them too.

I think this is it. Please note that it could be that I made an error somewhere in the directions above. As soon as you notice any error, please let me know and I will correct it as soon as possible.

Enjoy this little mod!!!

Cheers,
Vraxor

Offline __G__

  • Sr. Member
  • ****
  • Posts: 286
    • View Profile
Re: [Mod] More Statistics for your visitors
« Reply #122 on: February 23, 2007, 01:19:09 AM »
how do i show this on whos_online.html

Offline CeJay

  • Sr. Member
  • ****
  • Posts: 425
    • View Profile
Re: [Mod] More Statistics for your visitors
« Reply #123 on: February 23, 2007, 07:36:04 AM »
how do i show this on whos_online.html

I myself have not done this mod, but what you are asking seems pretty easy to do.
Edit that template to your liking or just add the tags to the bottom of the template (under {user_online_list}).
Then you can use these tags to show what you want:
Quote
In the templates you can now use the following tags:

{total_users} - This will show the total number of members
{total_votes} - This will show the total number of image votes
{total_comments} - This will show the total number of image comments
{total_hits} - This will show the total number of image hits
{total_downloads} - This will show the total number of image downloads

Offline __G__

  • Sr. Member
  • ****
  • Posts: 286
    • View Profile
Re: [Mod] More Statistics for your visitors
« Reply #124 on: February 23, 2007, 07:54:38 AM »
But CeJAy bro

Now edit the template files that correspond with the php files you added the include to.

index.php = home.html
categories.php = categories.html
lightbox.php = lightbox.html
top.php = top.html


Just like this do u know which is the .php file for whos_online.html

Offline CeJay

  • Sr. Member
  • ****
  • Posts: 425
    • View Profile
Re: [Mod] More Statistics for your visitors
« Reply #125 on: February 23, 2007, 08:43:23 AM »
But CeJAy bro

Now edit the template files that correspond with the php files you added the include to.
Sorry I did not read close enough and missed that  :oops:


Quote
Just like this do u know which is the .php file for whos_online.html
I think it is the sessions.php in the includes directory.
Not sure if you can just add the include(ROOT_PATH.'includes/stats.php'); or not on that, or if it has to be added differently.

Offline dgandy

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Sims Fashion Barn
Re: [Mod] More Statistics for your visitors
« Reply #126 on: March 01, 2007, 10:26:35 PM »
I love this mod, Vraxor. I only wanted to see members and downloads. It was easy to add to the bottom of my page, and works fanastically! Thank you!  :thumbup:

http://www.simsfashionbarn.net/downloads/
If it's been done before, you can do it too! If it's never been done before, you can be the first!

Offline Markus/TSC

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
Re: [Mod] More Statistics for your visitors
« Reply #127 on: May 24, 2007, 10:02:42 AM »
Hallo!

Ich verstehe zwar Englisch soweit, dass ich den Mod einigermaßen installieren konnte, nur begreife ich nicht wie und womit ich diesen Schritt erledigen soll:

Quote
Now edit the template files that correspond with the php files you added the include to.

index.php = home.html
categories.php = categories.html
lightbox.php = lightbox.html
top.php = top.html

you can find the templates inside the templates/default folder of 4images.

In the templates you can now use the following tags:

{total_users} - This will show the total number of members
{total_votes} - This will show the total number of image votes
{total_comments} - This will show the total number of image comments
{total_hits} - This will show the total number of image hits
{total_downloads} - This will show the total number of image downloads

Offline meujovem2004

  • Pre-Newbie
  • Posts: 1
    • View Profile
More Statistics
« Reply #128 on: May 28, 2007, 03:35:27 PM »
I am needing a Mod of equal statistics to this of the attached image. I am twirling version 1.7.4

Thank you
meujovem
Brazil

Offline Markus/TSC

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
Banner weg?
« Reply #129 on: June 20, 2007, 10:09:43 AM »
Hallo!

Ich habe das Mod installiert, doch tritt nach Hochladen der geänderten html/php - Datein folgender Fehler auf: Der Banner im Header ist nicht mehr da, ebenso erscheinen 2 Kreuze für ein nicht vorhandenes Bild über dem Rahmen der Kategorieübersicht.

Was muss ich da verändern, dass dieses Problem behoben ist?

Gruß

Markus

Offline Markus/TSC

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
Re: [Mod] More Statistics for your visitors
« Reply #130 on: June 28, 2007, 11:34:34 AM »
Kann denn keiner helfen? (siehe mein obiges Posting)

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [Mod] More Statistics for your visitors
« Reply #131 on: June 28, 2007, 11:39:40 AM »
@Markus/TSC
... dann überprüfe die url des Banners / der Bilder und berichtige sie in den entsprechenden html- / php-Dateien ...
... mehr lässt sich ohne Link nicht sagen ...
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline Markus/TSC

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
Re: [Mod] More Statistics for your visitors
« Reply #132 on: July 06, 2007, 10:59:04 PM »
@mawenzi: Ich habe es zwar inzwischen geschafft, die Statistik einzufügen, aber das angesprochene Problem mit den fehlenden Banner sowie 2 Rahmen o.Ä. ist nach wie vor da: http://www.storm-chasing.de/4images

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [Mod] More Statistics for your visitors
« Reply #133 on: July 07, 2007, 12:09:39 AM »
... wie sollen die Bilddateien auch angezeigt werden, wenn sie nicht da sind ...
... das z.B. ist die URL von deinem Banner entspr. deinem Websitecode ...
... http://www.storm-chasing.de/templates/default/images/header_logo.gif ...
... aber wenn du diesen Link aufrufst ... ist er nicht vorhanden ...
... also sorge dafür das deine Grafik-Bilder im Ordner "http://www.storm-chasing.de/templates/default/images/" liegen ...
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline Markus/TSC

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
Re: [Mod] More Statistics for your visitors
« Reply #134 on: July 10, 2007, 08:03:19 AM »
Danke für den Hinweis, hab ich übersehen  :roll: Kannst du mir eventuell noch hierbei helfen: http://www.4homepages.de/forum/index.php?topic=17193.new#new Die Seite dazu findest du unter http://www.storm-chasing.de/galeriet.htm