Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff
Author Message
djw2
Regular
Regular



Joined: Sep 19, 2003
Posts: 95
Location: St. Louis, MO

PostPosted: Fri Sep 19, 2003 6:35 am Reply with quote

Hey,

I'm very green to the whole PHP/MySQl world so go easy on me. Very Happy

First of all I'm installing PHP-Nuke 6.5 and I'm using MySQLadmin to access the MySQL. Now then, I have two issues occurring in the same counter.

First.

I've installed a Total Hits counter block. The counter tracks hourly hits, daily hits, as well as averages per hour, day, month and year. When I installed the counter the nuke_stats_date and nuke_stats_month were set to zero variables and had no tables established.

What I did was build a table for A day in nuke_stats_date and A table for the month in nuke_stats_month. All seemed good, my "warning: division by zero error went away and the counter was counting. We I got up this morning the counter was no longer counting NEW hits for the day. I had to go back in and make a table for today.

My question is.... Do I have to build the tables for every day of the year, or can the daily rollover be automated somehow?

If my nuke_stats_date isn't updating automatically them I bet come October my nuke_stats_month won't either.

Obviously I’m not much of a MySQL wiz so I could use someone pointing me in the right direction.

Second

The Nuke Total Hits counter I have will show today's hits, yesterday's hits and then average hits per hour, day, month and year. As well as total hits for the site. The problem is as part of the nuke it counts everything... it counts me over and over, it counts every single page click regardless where it is, it counts reloads, it just counts everything.

I really like the counters features, but I only want to count unique page views on the index in like 12-hour blocks.

How could the script be modified to make that happen?

Here's my site.

http://www.right2left.org

and here's the script.

Only registered users can see links on this board! Get registered or login!


Thanks,

Dan


Last edited by djw2 on Sun Sep 21, 2003 2:55 pm; edited 1 time in total 
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Fri Sep 19, 2003 10:39 am Reply with quote

You have 2 closing tags in your script. If that's for real you need to get rid of the duplicate.

Back to your issue. So you are using nuke's logic to actually record the hits in the standard nuke tables but are using a different script to report the hits. Is that correct?
 
View user's profile Send private message
djw2







PostPosted: Fri Sep 19, 2003 2:01 pm Reply with quote

Shocked

I'm not exactly sure what you mean.

In the MySQL database there are the tables

nuke_stats_date
nuke_stats_hour
nuke_stats_month
nuke_stats_year

My script is just your average block. It's called Total Hits Block, which shows your hits for the hour, day month, and year. It also shows an average hits for each category in addition to the total hits.

My specific problem is that when it becomes a new day the counter stops counting. When you go to the database to see why it's because that day isn't in the table. Everyday I have to create a new day in the table in order for it to start counting again. I don't know if this is a script problem or a database problem.

When I first loaded the block it was returning a Warning: division by zero error for the nuke_stats_date and nuke_stats_month variables. I got rid of the errors and got the counter started by creating a (as in one) day in the nuke_stats_date table and a (also as in one) month in the nuke_stats_month table. The errors went away and the counter started, but the next day it wasn't counting anymore. I went to the database and the day I created was there (9/16/03) but a table for 9/17/03 had not been created... so I created it manually again. The next day the same thing happened.

So, either I've set the database up wrong or the script isn't doing something properly.


I hope this helps.

Dan


PS the extra closing tag isn't really there. I screwed up posting the code. oops!
 
djw2







PostPosted: Sun Sep 21, 2003 10:37 am Reply with quote

Hey,

I went back to the beginning before I ever goofed with anything and reinstalled the nuke to start over. So I'm back to the beginning.

Just as a reference. I’m using PHP Nuke 6.5, php v. 4.3.2, and MySQL v. 4.0.15-standard. The counter script is your standard hits today, hits yesterday, total hits, average hits per hour, per day, month, per year type counter found in nukes.

The error looks like this...

Quote:
Warning: Division by zero in /home/*****/public_html/test/blocks/block-User_Info.php on line 177


Now, when I check the date table (nuke_stats_date) in phpMyAdmin it has the fields listed like this...

Code:


Field     Type     Attributes Null Default Extra           Action
year   smallint(6)             No     0            Ch Dr Pri Ind Uni Full
month  tinyint(4)              No     0            Ch Dr Pri Ind Uni Full
date   tinyint(4)              No     0            Ch Dr Pri Ind Uni Full
hits   bigint(20)              No     0            Ch Dr Pri Ind Uni Full


My question is... shouldn't those default variables be filled in?

Something more along the lines of...

Code:


Field     Type     Attributes Null Default Extra           Action
year   smallint(6)             No     1            Ch Dr Pri Ind Uni Full
month  tinyint(4)              No     12           Ch Dr Pri Ind Uni Full
date   tinyint(4)              No     365          Ch Dr Pri Ind Uni Full
hits   bigint(20)              No     0            Ch Dr Pri Ind Uni Full



I sure would appreciate some help on this; I'm having a hell on a time hacking it out.


Thanks a lot.


Last edited by djw2 on Sun Sep 21, 2003 2:22 pm; edited 1 time in total 
Raven







PostPosted: Sun Sep 21, 2003 10:45 am Reply with quote

No on the defaults. In 6.5 there is no line 177 in User_Info block, so That is really confusing Confused . Since you're willing to start over Smile, why don't you get the 6.9 version from my site and try installing it?
 
djw2







PostPosted: Sun Sep 21, 2003 1:06 pm Reply with quote

No line 177?

Wait... It's not the "stock" user info block. It's an Extensive user info block I got from somewhere. Question

Go Only registered users can see links on this board! Get registered or login! to view the script.
*note* I think the HTML page throws it off a little, when you copy/paste it in PHPEdit it shows the lines as 176 and 181 but that's where the errors are none the less.

Right here are the lines in question...

/* Daily Hits */
$result = sql_query("SELECT count(*) FROM $prefix"._stats_date."", $dbi);
list($days) = sql_fetch_row($result, $dbi);
$daily = number_format($count_holder/$days, 0); **Line 177**

/* Monthly Hits */
$result = sql_query("SELECT count(*) FROM $prefix"._stats_month."", $dbi);
list($months) = sql_fetch_row($result, $dbi);
$monthly = number_format($count_holder/$months, 0); **182**

It did the same thing (different line obviously, but the same section of script) when I first installed the Total Hits Counter. (i.e. Warning: Division by zero)

Okay, so I'm wrong on the defaults... now what? Confused What is causing the errors? It's at two tables... the nuke_stats_date and the nuke_stats_month where the problem is. How can I figure this out? What should I look at next?

6.9... I don't know... I have a ton of work put in this thing, I mean sure I'm starting over but no from scratch. I still have all my artwork, the forums config., css files and so on. I just reloaded it to get back to the original errors because it didn't seem like I was getting anywhere. I'm still gonna keep all my work and just re-upload everything.

Let's say I was to consider going to 6.9, do the Nukemods Theme Packs work? This wouldn't lessen the amount of "redesign" I had to do. Keeping the same Theme Pack is key here, we're talking lots of hours and launch isn't too far off.

Thanks,

Dan
 
Raven







PostPosted: Sun Sep 21, 2003 1:32 pm Reply with quote

Try the site info block from my site and see if the counters work in it.
 
djw2







PostPosted: Sun Sep 21, 2003 1:40 pm Reply with quote

Okay
 
djw2







PostPosted: Sun Sep 21, 2003 2:18 pm Reply with quote

Okay,

I downloaded the Site Info block

The counter counts total hits.

We received
29
page views since
9/20/2003

It does NOT display Hits new today or hits new yesterday. (It is still new Question )

Hits New Today:
Hits New Yesterday:

Now, another thing this counter does not do that mine does is the averages.

Average Hits
· Hourly 0
· Daily 0
· Monthly 0
· Yearly 1

I tend to think this is where the problem is... hence Warning: Division by zero errors. It's trying to divide zero... to get an average. Question

Also, I downloaded your Real Time Stats block thinking I could get something off it as well and it's not able to access my database. Still working on it.


Warning: mysql_select_db(): Access denied for user: '*****@localhost' (Using password: NO)<- Question in /home/*****/public_html/test/modules/realtime-stats/index.php on line 46

Warning: mysql_select_db(): A link to the server could not be established in /home/*****/public_html/test/modules/realtime-stats/index.php on line 46

Warning: Cannot modify header information - headers already sent by (output started at /home/*****/public_html/test/modules/realtime-stats/index.php:46) in /home/*****/public_html/test/modules/realtime-stats/index.php on line 48

My database says...

"<PASSWORD HERE>") or die ('I cannot connect to the database because: ' . mysql_error());

So I think this block needs a password option


Last edited by djw2 on Sun Sep 21, 2003 2:25 pm; edited 1 time in total 
Raven







PostPosted: Sun Sep 21, 2003 2:22 pm Reply with quote

Nope. No password option is needed. It uses the nuke config.php file for all access. Did you install and activate both the block and the module for the realtime stats?
 
djw2







PostPosted: Sun Sep 21, 2003 2:29 pm Reply with quote

Yes, both are installed and activated.
 
Raven







PostPosted: Sun Sep 21, 2003 2:32 pm Reply with quote

I just went to http://www.right2left.org/ and everything is showing up fine. What am I missing?
 
djw2







PostPosted: Sun Sep 21, 2003 2:51 pm Reply with quote

That's not where I installed the base PHP-Nuke 6.5 to test on That's sitting idol till I get it figured out.

On R2L you see the Extensive Info Block on the right?

Average Hits
· Hourly 0
· Daily 0
· Monthly 0
· Yearly 1

The averages aren't working.

My first post explains how I got rid of the errors... but I haven't fixed the problem. I just made the errors go away by adding some values, it's still not working.


I installed another impression of the PHP-Nuke 6.5 Only registered users can see links on this board! Get registered or login!. and started adding me scripts to it to trouble shot them one at a time. I started with the Extensive User Info block and that's where I am now. The problem is with my script... or the database and that's what I'm trying to figure out.

btw, notice I can't run both the extensive user info and the site info at the same time? What's up with that?

Which do you want to see?


Thanks
 
Raven







PostPosted: Sun Sep 21, 2003 2:56 pm Reply with quote

I know this is frustrating. I'd like to ask you to do some more work to try to isolate this. Do this.

Do a fresh insatllation of 6.9 files and database.
Create a dbuser and give that user a password and then give that user permission to access the new database.
Update the config.php file to match those credentials.
Create the super user.
Modify Preferences so that the SiteURL points to the location of this new install/config.php folder.
Install my site info block, virgin, and activate it. Did that work?
Install my realtime stats block and module. Did that work?
 
djw2







PostPosted: Sun Sep 21, 2003 4:54 pm Reply with quote

Okay,

I have a 6.9 up.

See it Only registered users can see links on this board! Get registered or login!.


Your Site Info block appears to be working fine.

Shows hits in both the total hits and hits today categories.


Real time stats however is not... same errors as before.

I'm not sure I care about real time stats though, I'm happy to see the counter working.


So it reads nuke_stats_date in 6.9 but not in 6.5... what's the difference?


Thanks
 
djw2







PostPosted: Sun Sep 21, 2003 5:07 pm Reply with quote

BTW,

My Extensive User Info block works too. Something about the database structure is different. NOW we're on to something.

It looks exactly the same... I guess I have to read the changes. I thought there would be more visible differences.
 
Raven







PostPosted: Sun Sep 21, 2003 5:22 pm Reply with quote

Real time stats is working. To use it correctly, you activate the block, but keep the module hidden.

There is no difference between 6.5 and 6.9. I would imagine if you installed the virgin 6.5 from my site in place of 6.9, it too will work. There's something else conflicting in your setup. Probably an errant block or module that has interfered with the stats Tables.
 
djw2







PostPosted: Sun Sep 21, 2003 6:01 pm Reply with quote

Yeah, I'm trying to figure out what it is now. I should note that the virgin 6.5 I was using didn't come from your site, or any other sites I'm aware of. My host recently installed Fantasico and it was a bundled version. Your 6.5 might have saved me a ton of headaches.


Real Time Stats doesn't seem to be working. On the block the refresh was already 30 so I left it, I entered my Admin name into the space I was supposed to. The block is active and can be seem by all and the module is activated but invisible. I'm still getting the same errors as before.


PEACE!
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©