php forum
php mysql forum
php mysql smarty
 
Topic Options
#249222 - 06/06/03 10:27 AM Finished-[6.0-6.1-6.2-6.3] Small Site Statistics 1.0
dimopoulos Offline
Kahuna

Registered: 08/18/02
Posts: 1271
Loc: Vienna, Austria
Mod Name / Version: Small Site Statistics 1.0 <br /> <br />Description: This modification will collect and display in a box (like a pals box) the hits per month on your site. It can be altered to show the OS used, language etc. <br /> <br />Working Under: UBB.Threads 6.0-6.1-6.2-6.3 <br /> <br />Mod Status: Finished <br /> <br />Any pre-requisites: none <br /> <br />Author(s): dimopoulos <br /> <br />Date: 06/06/03 <br /> <br />Credits: Nikos Dimopoulos <br /> <br />Files Altered: The file that you want to collect the data, usually index.php <br /> <br />New Files: statistics.php <br /> <br />Database Altered: Yes, new table visits created <br /> <br />Info/Instructions: CAUTION!!! <br />This script will most probably increase the load on your database significantly, especially if you have a busy site. If you place the script that collects data in your front page then every visitor will require one hit in the database, so be careful before implementing it. <br /> <br />Instructions are included in the attached file. <br /> <br />Disclaimer: Please backup every file that you intend to modify. <br />If the modification modifies the database, it's a good idea to backup your database before doing so. <br /> <br />Note: If you modify your UBB.Threads code, you may be giving up your right for "official" support from Infopop.If you need official support, you'll need to restore unmodified files. <br /> <br />


Attachments
83262-Small Site Statistics 1.0.zip (59 downloads)

_________________________
Nikos

Top
#249223 - 06/06/03 10:28 AM Re: Finished-[6.0-6.1-6.2-6.3] Small Site Statistics 1.0 [Re: Hal_dup2]
dimopoulos Offline
Kahuna

Registered: 08/18/02
Posts: 1271
Loc: Vienna, Austria
Screenshot of what you will be able to see in a few months if you implement this modification.


Attachments
83263-visits.jpg (12 downloads)

_________________________
Nikos

Top
#249224 - 06/06/03 01:36 PM Re: Finished-[6.0-6.1-6.2-6.3] Small Site Statistics 1.0 [Re: Hal_dup2]
Slawek_L Offline
Enthusiast

Registered: 01/28/03
Posts: 364
Loc: Poland, Warsaw
Very nice:<br /><br />http://zlosnik.pl - look at the bottom of page <img src="/forum/images/graemlins/smile.gif" alt="" />
_________________________
[]http://www.mb.org.pl/forum/images/graemlins/icon_astro.gif[/] MB Klub Polska
[b]& Orlen-Team

Top
#249225 - 06/06/03 02:00 PM Re: Finished-[6.0-6.1-6.2-6.3] Small Site Statistics 1.0 [Re: Dawg_dup1]
DLWebmaestro Offline
Member

Registered: 08/08/00
Posts: 1753
Loc: California, MD
Does this record hits, or unique visits?
_________________________
Webmaster
Drumlines.org

Drumlines.org UBBThreads

Top
#249226 - 06/06/03 02:26 PM Re: Finished-[6.0-6.1-6.2-6.3] Small Site Statistics 1.0 [Re: eslmix]
Zackary Offline
Member

Registered: 03/01/01
Posts: 652
Loc: West Fargo, ND USA
Very cool Nikos. <img src="/forum/images/graemlins/smile.gif" alt="" /><br /><br />Looks like it counts hits... I went to Slawek_L's link, hit refresh and it counted the refresh.<br /><br />I'd like something like this for unique visitors myself, I have some users who just sit on the site all day and refresh. <img src="/forum/images/graemlins/smile.gif" alt="" />

Top
#249227 - 06/06/03 02:53 PM Re: Finished-[6.0-6.1-6.2-6.3] Small Site Statistics 1.0 [Re: Hal_dup2]
JoshPet Offline
I type Like navaho

Registered: 11/29/01
Posts: 11330
Loc: Charlotte, NC
Very cool! <img src="/forum/images/graemlins/cool.gif" alt="" />
_________________________
Joshua Pettit
www.JoshuaPettit.com
My abilities are for hire.

Top
#249228 - 06/07/03 01:01 AM Re: Finished-[6.0-6.1-6.2-6.3] Small Site Statistics 1.0 [Re: Daine]
AllenAyres Administrator Offline
I type Like navaho

Registered: 03/10/00
Posts: 25452
Loc: Texas
Very nice work <img src="/forum/images/graemlins/laugh.gif" alt="" />
_________________________
- Allen wavey
- What Drives You?

Top
#249229 - 06/07/03 07:01 AM Re: Finished-[6.0-6.1-6.2-6.3] Small Site Statistics 1.0 [Re: SurfMinister]
dimopoulos Offline
Kahuna

Registered: 08/18/02
Posts: 1271
Loc: Vienna, Austria
Thanks guys. <br /><br />Josh (other) and Zackary. Yes it will count hits even if they come from people that sit all day long and refresh the page.<br /><br />I was thinking of incorporating some sort of a cookie to the user's machine which will tell the script that this user has visited the site and no longer do we need to keep these statistics. But how can you justify what is a valid time to live for a browsing? To me if a user hits refresh on a page just to increase the counter is not a valid hit, but the person who is there and reads some posts, does something else later and then refreshes the page again is a valid hit.<br /><br />We can definitely enhance the script to become a proper pal box and to have it integrated with IIP providing information like the hits per day/month/year, referrer checks etc.<br /><br />Once again this is not meant to replace retro stats or any other statistics package (especially your raw webserver files). And make sure that if you run this script on your site to monitor the MySQL performance over the period that you run the script. From personal experience, if you have a small site like mine circa 150 hits a day on average then you are fine. For more hits a day, please run your own metrics and let us all know about it.<br /><br /><br />
_________________________
Nikos

Top
#249230 - 06/07/03 08:28 AM Re: Finished-[6.0-6.1-6.2-6.3] Small Site Statistics 1.0 [Re: Hal_dup2]
omegatron Offline
Member

Registered: 04/05/01
Posts: 3440
Loc: abingdon,md
For the life of me I can't get this to work. I know the answer is staring me in my face.<br /><br />I keep getting SQL Database only visible to forum administrator's.<br /><br />I have cleared cookies. I have checked the MYDSL tables and I have even flushed and recreated. The code below is what I enter into the index.php<br /><br />// --------------------------------------------------------------------------------------------------<br /> <br /> // Include the threads main.inc.php file<br /> include_once("{$palspath}/main.inc.php");<br /> <br /> // Get the referrer information<br /> $strPathInfo = addslashes(find_environmental("PATH_INFO"));<br /> $strPathTranslated = addslashes(find_environmental("PATH_TRANSLATED"));<br /> $strRemoteAddress = addslashes(find_environmental("REMOTE_ADDR"));<br /> $strRemoteHost = addslashes(find_environmental("REMOTE_HOST"));<br /> $strHTTPAccept = addslashes(find_environmental("HTTP_ACCEPT"));<br /> $strHTTPAcceptLanguage = addslashes(find_environmental("HTTP_ACCEPT_LANGUAGE"));<br /> $strHTTPUserAgent = addslashes(find_environmental("HTTP_USER_AGENT"));<br /> $strHTTPCookie = addslashes(find_environmental("HTTP_COOKIE"));<br /> <br /> // Initialize variables<br /> $strQuery = "";<br /> <br /> $strQuery = "<br /> INSERT INTO visits <br /> (<br /> path_info, <br /> path_translated, <br /> remote_addr, <br /> remote_host, <br /> http_accept, <br /> http_accept_language, <br /> http_user_agent, <br /> http_cookie <br /> ) <br /> VALUES<br /> ( <br /> '$strPathInfo',<br /> '$strPathTranslated',<br /> '$strRemoteAddress',<br /> '$strRemoteHost',<br /> '$strHTTPAccept',<br /> '$strHTTPAcceptLanguage',<br /> '$strHTTPUserAgent',<br /> '$strHTTPCookie'<br /> )<br /> ";<br /> $dbh -> do_query($strQuery);<br /> <br /> $strQuery = "SELECT COUNT(*) FROM ffff_visits";<br /> $sth = $dbh -> do_query($strQuery);<br /> list($lngTotalVisits) = $dbh -> fetch_array($sth);<br /> <br /> $lngTotalVisits = number_format($lngTotalVisits);<br /> <br /> $dbh -> finish_sth($sth);<br /> <br />// --------------------------------------------------------------------------------------------------<br />
_________________________
Chuck S

DIVE IN AND VISIT ME:

Omegatron\'s Reefs

Administrator at ReefTalk

Top
#249231 - 06/08/03 11:40 AM Re: Finished-[6.0-6.1-6.2-6.3] Small Site Statistics 1.0 [Re: sf49rminer]
dimopoulos Offline
Kahuna

Registered: 08/18/02
Posts: 1271
Loc: Vienna, Austria
Chuck,<br /><br />There is a slight error in the instructions (I should have used find/replace).<br /><br />In my database I call the table ffff_visits while in the modification that I havge posted it is called visits. Hence the statement:<br />
Code:
<br />$strQuery = "SELECT COUNT(*) FROM ffff_visits";<br />$sth = $dbh -&gt; do_query($strQuery);<br />list($lngTotalVisits) = $dbh -&gt; fetch_array($sth);<br />
<br />should be in fact<br />
Code:
<br />$strQuery = "SELECT COUNT(*) FROM [:"red"]visits[/]";<br />$sth = $dbh -&gt; do_query($strQuery);<br />list($lngTotalVisits) = $dbh -&gt; fetch_array($sth);<br />
<br />Sorry about that everybody. I have ammended the instructions and also added an image file (bluebar.jpg) which needs to be in the images folder or wherever you need it to be (your choice in the script)
_________________________
Nikos

Top
#249232 - 06/08/03 11:53 AM Re: Finished-[6.0-6.1-6.2-6.3] Small Site Statistics 1.0 [Re: Hal_dup2]
omegatron Offline
Member

Registered: 04/05/01
Posts: 3440
Loc: abingdon,md
Nope must not like my server<br /><br />If I put this in my index.php all I get is a white screen.<br /><br />Same with statistics.php. I look and the table visits has a recorded entry for me. So its half working. But it stops the page from loading.
_________________________
Chuck S

DIVE IN AND VISIT ME:

Omegatron\'s Reefs

Administrator at ReefTalk

Top
#249233 - 06/08/03 05:43 PM Re: Finished-[6.0-6.1-6.2-6.3] Small Site Statistics 1.0 [Re: sf49rminer]
dimopoulos Offline
Kahuna

Registered: 08/18/02
Posts: 1271
Loc: Vienna, Austria
Weird. Let me check the scripts once more and I will let you know Chuck.
_________________________
Nikos

Top
#249234 - 06/08/03 06:08 PM Re: Finished-[6.0-6.1-6.2-6.3] Small Site Statistics 1.0 [Re: Hal_dup2]
omegatron Offline
Member

Registered: 04/05/01
Posts: 3440
Loc: abingdon,md
I solved my problem by placing your script inbetween the Threada header and footer statements. So basically I modified it a bit. <br /> <br />You can see what I did. I placed your code in my index.php and then the resulting left code of statistics.php I made into the following attached.


Attachments
83510-statistics.txt (22 downloads)

_________________________
Chuck S

DIVE IN AND VISIT ME:

Omegatron\'s Reefs

Administrator at ReefTalk

Top
#249235 - 06/08/03 08:02 PM Re: Finished-[6.0-6.1-6.2-6.3] Small Site Statistics 1.0 [Re: Hal_dup2]
Zackary Offline
Member

Registered: 03/01/01
Posts: 652
Loc: West Fargo, ND USA
Good points Nikos. <img src="/forum/images/graemlins/smile.gif" alt="" /><br /><br />I'll consider this. I run the server here in my home and I don't get a HUGE amount of hits, but I hate to get "inflated" stats because I check the site between 5-10 times a day and I know other users do as well. <img src="/forum/images/graemlins/smile.gif" alt="" /><br /><br />I have no other software or services to track stats on my site and this would be handy. <img src="/forum/images/graemlins/smile.gif" alt="" /><br /><br />Thanks again for the great mod, I've added it to my "to add" list for when I upgrade to 6.3. <img src="/forum/images/graemlins/wink.gif" alt="" />

Top
#249236 - 06/09/03 06:46 AM Re: Finished-[6.0-6.1-6.2-6.3] Small Site Statistics 1.0 [Re: sf49rminer]
dimopoulos Offline
Kahuna

Registered: 08/18/02
Posts: 1271
Loc: Vienna, Austria
Chuck,<br /><br />I can see what you did. Since I had that modification as a "pals" box on my site, I was sending the header and footer a lot earlier than this so I didn't need it. With your implementation you can have it even as a standalone page.<br /><br />Thanks for that
_________________________
Nikos

Top
#249237 - 06/09/03 06:49 AM Re: Finished-[6.0-6.1-6.2-6.3] Small Site Statistics 1.0 [Re: ]
dimopoulos Offline
Kahuna

Registered: 08/18/02
Posts: 1271
Loc: Vienna, Austria
Zackary,<br /><br />I don't think that checking the site five or ten times a day makes inflated stats but I see what you mean. I had the same problem with a stupid person who managed to go and refresh so many times just to bring the counter up to 500,000. Fortunately I got there in time and killed his connection.<br /><br />There is of course room for improvement on this script and if we all decide what is the acceptable time to live for a connection to become new then I can modify it to write to a cookie hence not double count hits.
_________________________
Nikos

Top
#249238 - 06/09/03 03:00 PM Re: Finished-[6.0-6.1-6.2-6.3] Small Site Statistics 1.0 [Re: Hal_dup2]
omegatron Offline
Member

Registered: 04/05/01
Posts: 3440
Loc: abingdon,md
Nikos yes I found out f from inadvertantly realizing from your directions you did not say pal box etc. So I tried running it standalone and realized wait it does not know what a tablewrapper variable is. HMM Okay let me add this and that. It's all good.
_________________________
Chuck S

DIVE IN AND VISIT ME:

Omegatron\'s Reefs

Administrator at ReefTalk

Top
#249239 - 06/09/03 03:01 PM Re: Finished-[6.0-6.1-6.2-6.3] Small Site Statistics 1.0 [Re: Hal_dup2]
omegatron Offline
Member

Registered: 04/05/01
Posts: 3440
Loc: abingdon,md
Nikos yes I found out f from inadvertantly realizing from your directions you did not say pal box etc. I did notice on this thread though it says can run in a box ( like a pal box <img src="/forum/images/graemlins/wink.gif" alt="" /> ) So I tried running it standalone and realized wait it does not know what a tablewrapper variable is. HMM Okay let me add this and that. It's all good.
_________________________
Chuck S

DIVE IN AND VISIT ME:

Omegatron\'s Reefs

Administrator at ReefTalk

Top


Moderator:  Ian_W 
Who's Online
0 registered (), 25 Guests and 14 Spiders online.
Key: Admin, Global Mod, Mod
Shout Box

Latest Posts
Wisdom needed
by Gizmo
56 minutes 29 seconds ago
How to hide sub forums from summary page
by blaaskaak
Yesterday at 09:54 AM
Spell Check [beta]
by Bill B
12/01/08 09:16 PM
PhotoPost BB Code Popup
by AllenAyres
12/01/08 09:41 AM
Problems reading a lot of old posts here
by AllenAyres
12/01/08 09:35 AM
Forum 'Trader Ratings'.
by AllenAyres
12/01/08 09:33 AM
Customization needed
by Gizmo
11/12/08 12:28 PM
New Mods
User Authentication Class
by
01/19/07 02:59 PM
Multiple Identity Detector
by
12/30/06 06:39 PM
PhotoPost BB Code Popup
by
11/06/06 05:43 PM
Spell Check [beta]
by
10/17/06 09:24 PM
Newest Members
Truth, David DelMonte, nick1, Begbie, cenk
13364 Registered Users
Top Posters
AllenAyres 25452
JoshPet 11330
Rick 8372
LK 7396
Lord Dexter 6503
Greg Hard 5533
Charles Capps 5438

 

 

 
fusionbb message board php hacks