Jump to content

"Most Viewed" script/code/tutorial?


Jarlo

Recommended Posts

I am DESPERATE!  I have been searching for hours, and I need someone's help.  I have a page with thumbnail images.  I have a click counter set up already, but I need to know how to display the images that were clicked the most.

 

Any help would be greatly appreciated.

Link to comment
Share on other sites

can you give us your mysql table of the click counter..

 

or, atleast describe your method for counting the clicks

 

either way

 

the method of returning the "Most Viewed" image.. would be simple if in mysql

 

 

SELECT `image_src`,`image_id` FROM `images` ORDER BY `image_clicks` DESC LIMIT 1

Link to comment
Share on other sites

I should have added that I'm a total newb when it comes to php.  I downloaded something called "ccount" and am using that as a click counter.  I couldn't figure it out via MySQL.

 

Do you think you could walk me through it using MySQL?

 

My site is www.designsbybarlow.com if that helps.

Link to comment
Share on other sites

ok.. create a landing page for all of the images.. then echo the content of the image inside the php file..

 

example

 

image.php?file=whatever.jpg

 

then inside of image.php

 

do something like

 

<?php

  $file = "images/".$_GET['file'];

  // here record it as a click for $file in mysql

  $e = getimagesize($file);

  header("content-type: {$e['mime']}");

  readfile($file);

?>

Link to comment
Share on other sites

omg...

this request need more than 1 script.. u need 2 script to have what u need

 

in global..

1. u need 2 table

a. table contain image => build yourself but have picid

b. table named pic_counter=> contain picid & picclick

 

this pic/image table must seperated.. don't ever try to put together.. and DON't make same mistake like i do

*and don't ask what is it.. that's something related to corrupt table

 

2. let's say when you want to see 1 image.. he/she must click mypic.php?id=1 plz add time after id. reason.. to avoid someone steal ur image and put on his/her site; to expire your image. you image today have expire until ... (put on time).. without time.. he will show blank img

 

3. inside mypic.php contain 3 modules.. more the better

 

a. view if the time already expire or not

 

b. if everything goes wrong.. show bad img.. but if not.. query table pic_counter to add 1

 

c. show the image

 

sry.. i was work here.. and there a lot user need my/our help

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.