Most viewed section doesn't include certain categories Most viewed section doesn't include certain categories
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Most viewed section doesn't include certain categories

Started by johnwr, June 11, 2004, 12:59:48 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

johnwr

As far as I can get the most viewed section on the startpage (index.php) should include all pictures available in the gallery. (As long as they're in visible albums of course)

That function on my site ...

http://fotoalbum.serveftp.net/index.php?lang=english

... does not include pictures from the category I have called "Feriebilder".

However if I go into that category (or any other) this works well.

That category doesn't have any albums attached, only subcategories (with albums), and I guess that has something to do with it?

I'm quite certain this is the case for the Random files section as well

John

johnwr

Hi

I have done some research on this:

I created a testalbum in the category without any albums (as mentioned in last post). No effect, the pictures still not present in the random or topn sections.

Then I enabled debugmode, and saw as I already knew that the categories were not parsed.
At the bottom of this post is included the queries referenced below from the request of the HOMEpage:
(http://fotoalbum.serveftp.net/index.php)

Query[12] returns the category in question (category=6)
Query[13] returns nothing as there are no albums there
Query[14] returns 0 (of course as there still is no albums...)
Query[16] returns the useralbums, which means it never parsed the subcategories in the category in question (category = 6)
Query[18-22] Then it continues to the other "root"categories (10 & 11)
Query[23] The field 'category' in the table cpg11d_albums is an int(11) in the database, but in this query it's a string? Why is this?

Hopefully this can lead some of you developers on track of this problem.
I have only researched this in the database, as I unfortunately don't know PHP.

I am quite positive that this problem occured after I updated all files from CVS, and ran update.php. on this Tuesday
The previous time I did this was two weeks ago.

John

==========================
Queries:
------------------
Array
(
   
  • => SELECT extension, mime, content FROM cpg11d_filetypes;
       [1] => SELECT * FROM cpg11d_users WHERE user_id='2'AND user_active = 'YES' AND user_password != '' AND BINARY MD5(user_password) = '69fdb858fc70373879e6b775333dabe5'
       [2] => SELECT MAX(group_quota) as disk_max, MIN(group_quota) as disk_min, MAX(can_rate_pictures) as can_rate_pictures, MAX(can_send_ecards) as can_send_ecards, MAX(upload_form_config) as ufc_max, MIN(upload_form_config) as ufc_min, MAX(custom_user_upload) as custom_user_upload, MAX(num_file_upload) as num_file_upload, MAX(num_URI_upload) as num_URI_upload, MAX(can_post_comments) as can_post_comments, MAX(can_upload_pictures) as can_upload_pictures, MAX(can_create_albums) as can_create_albums, MAX(has_admin_access) as has_admin_access, MIN(pub_upl_need_approval) as pub_upl_need_approval, MIN( priv_upl_need_approval) as  priv_upl_need_approval FROM cpg11d_usergroups WHERE group_id in (2,1)
       [3] => SELECT group_name FROM  cpg11d_usergroups WHERE group_id= 1
       [4] => DELETE FROM cpg11d_banned WHERE expiry < 1086974883
       [5] => SELECT * FROM cpg11d_banned WHERE ip_addr='192.168.0.101' OR ip_addr='192.168.0.101' OR user_id=2
       [6] => SELECT * FROM cpg11d_online WHERE user_ip = '192.168.0.101' AND user_id = 2
       [7] => UPDATE cpg11d_online SET last_action = NOW() WHERE user_ip = '192.168.0.101' AND user_id = 2
       [8] => DELETE FROM cpg11d_online WHERE last_action < NOW() - INTERVAL 5 MINUTE
       [9] => SELECT cid, name, description, thumb FROM cpg11d_categories WHERE parent = ''  ORDER BY pos
       [10] => SELECT aid FROM cpg11d_albums WHERE category = 4
       [11] => SELECT count(*) FROM cpg11d_pictures, cpg11d_albums WHERE cpg11d_pictures.aid = cpg11d_albums.aid AND category = 4
       [12] => SELECT cid, name, description, thumb FROM cpg11d_categories WHERE parent = '4'  ORDER BY pos
       [13] => SELECT aid FROM cpg11d_albums WHERE category = 6
       [14] => SELECT count(*) FROM cpg11d_pictures, cpg11d_albums WHERE cpg11d_pictures.aid = cpg11d_albums.aid AND category = 6
       [15] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='641'
       [16] => SELECT aid FROM cpg11d_albums WHERE category>=10000
       [17] => SELECT count(*) FROM cpg11d_pictures, cpg11d_albums WHERE cpg11d_pictures.aid = cpg11d_albums.aid AND category >= 10000
       [18] => SELECT aid FROM cpg11d_albums WHERE category = 10
       [19] => SELECT count(*) FROM cpg11d_pictures, cpg11d_albums WHERE cpg11d_pictures.aid = cpg11d_albums.aid AND category = 10
       [20] => SELECT aid FROM cpg11d_albums WHERE category = 11
       [21] => SELECT count(*) FROM cpg11d_pictures, cpg11d_albums WHERE cpg11d_pictures.aid = cpg11d_albums.aid AND category = 11
       [22] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='477'
       [23] => SELECT aid FROM cpg11d_albums as a WHERE category = '0'
       [24] => SELECT count(*) FROM cpg11d_albums as a WHERE category>0
       [25] => SELECT count(*) FROM cpg11d_pictures as p LEFT JOIN cpg11d_albums as a ON a.aid=p.aid WHERE a.category>=0
       [26] => SELECT count(*) FROM cpg11d_comments as c LEFT JOIN cpg11d_pictures as p ON c.pid=p.pid LEFT JOIN cpg11d_albums as a ON a.aid=p.aid WHERE a.category>=0
       [27] => SELECT count(*) FROM cpg11d_categories WHERE 1
       [28] => SELECT sum(hits) FROM cpg11d_pictures as p LEFT JOIN cpg11d_albums as a ON p.aid=a.aid WHERE a.category>=0
       [29] => SELECT count(*) FROM cpg11d_albums as a WHERE category = '0'
       [30] => SELECT COUNT(*) from cpg11d_pictures WHERE approved = 'YES' AND aid IN (3,6,29,30,31,32,33,24,27,28)
       [31] => SELECT pid, filepath, filename, url_prefix, filesize, pwidth, pheight, ctime, aid, aid FROM cpg11d_pictures WHERE approved = 'YES' AND aid IN (3,6,29,30,31,32,33,24,27,28)  ORDER BY RAND() LIMIT 5
       [32] => SELECT COUNT(*) from cpg11d_pictures WHERE approved = 'YES' AND hits > 0  AND aid IN (3,6,29,30,31,32,33,24,27,28)  
       [33] => SELECT pid, filepath, filename, url_prefix, filesize, pwidth, pheight, ctime, aid, hits, aid, filename FROM cpg11d_pictures WHERE approved = 'YES'AND hits > 0 AND aid IN (3,6,29,30,31,32,33,24,27,28)   ORDER BY hits DESC, filename   LIMIT 0 ,5
       [34] => SELECT COUNT(*) from cpg11d_pictures WHERE approved = 'YES' AND aid IN (3,6,29,30,31,32,33,24,27,28)
       [35] => SELECT pid, filepath, filename, url_prefix, filesize, pwidth, pheight, ctime, aid,title, caption, owner_id, owner_name, aid FROM cpg11d_pictures WHERE approved = 'YES' AND aid IN (3,6,29,30,31,32,33,24,27,28)  ORDER BY pid DESC  LIMIT 0 ,5
       [36] => SELECT COUNT(*) FROM cpg11d_users
       [37] => SELECT COUNT(*) FROM cpg11d_online
       [38] => SELECT COUNT(*) FROM cpg11d_online WHERE user_id <> 0
       [39] => SELECT user_id, user_name FROM cpg11d_users ORDER BY user_id DESC LIMIT 1
       [40] => SELECT user_id FROM cpg11d_online WHERE user_id <> 0
       [41] => SELECT user_name FROM cpg11d_users WHERE user_id = '2'
    )

johnwr

Am I really the only one with this problem?

The index.php page won't include all categories for the random and topn sections, while all other pages behave correctly.

As I only discovered today, this leads to the situation that when a user click on e.g. the apparently most viewed pic, he/she gets the real most viewed picture, since this is the displayimage.php. That would be good, but for the fact that it wasn't the picture the user requested in the first place...

John

rrosalion

John, I'm not sure what was happening with my site when you checked - but I was experiencing some problems earlier today.

It seems to be all working again, so feel free to check it out (I temporarily got rid of the "topn" and "toprated" sections cause of the bug, but I've put them back so you can see what's going on)

Is anyone working on this problem? Have other people experienced the same issue??

Joachim Müller

I'm not able to replicate this behaviour, if have no clue where to start looking for.

GauGau

rrosalion

Quote from: GauGau on June 28, 2004, 08:20:23 AM
I'm not able to replicate this behaviour, if have no clue where to start looking for.

GauGau

visit http://www.sobriquet.net/gallery/, and click on ANY of the thumbnails in "most viewed", or "top rated", and they link to different images (i.e. not the image shown)

if you visit:
http://www.sobriquet.net/gallery/thumbnails.php?album=topn&cat=0
or
http://www.sobriquet.net/gallery/thumbnails.php?album=toprated&cat=0
the thumnails and links work fine, so the issue is only with the index.php page.

from what i can gather, the LINKS on index.php are correct, but the THUMBNAILS and details are not

Tarique Sani

#6
OK, I think John is right - Sub categories are not getting included in the "Most Viewed" and "Top Rated" on the index page - now to see if this happens only if the Category has only Sub Categories but no Albums...

[update]
This bug seems to have been fixed in the CVS  - Try with the attached index.php (rename it before using to index.php)  Let us know what happens
[/update]

[attachment deleted by admin]
SANIsoft PHP applications for E Biz

johnwr

Hi Tarique Sani,

I've installed your included index file, but no change for me.

The Most Viewed section of

    http://fotoalbum.serveftp.net/

still don't show the right files (though they link to the right ones as usual).
The random function still only includes the useralbums as well.

Let me know if you need some debug info from my site.

John

Tarique Sani

Since none of us are able to replicate this behaviour I assume that there is something wrong with the data in your tables - unless we can see the data in your table we willl not be able to help you.

You can PM me with needed information for phpMyAdmin if you have it installed
SANIsoft PHP applications for E Biz

johnwr

I didn't have phpMyAdmin installed, but I have now, and I have sent you the info.
Hopefully you can identify the error, and keep it from occuring to others. As mentioned earlier in this thread I first noticed this error after running update.php 2004-06-11, with the then current CVS code.

John

johnwr