SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Addict Raioo's Avatar
    Join Date
    Jul 2000
    Location
    Boston
    Posts
    212
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I know I've asked Skunk in private about this but I thought it won't hurt if I ask it in public.

    I've seen it somewhere.. where people submit their photographs, or their girlfriend's, boyfriend's, etc and visitors get to rate the pictures from 0 to 10.

    I thought to myself, how easy is that to implement on my site !

    is it one of those scripts that already exist and I just need to poke around with the variables ? if yes, please point my head to the right direction. Otherwise, I am pretty sure it is something that can be done via php/mySQL a pair I haven't started on yet although I program my site in PHP.

    So, have a good one and let me know,
    I appreciate the help of everyone at SitePoint.com

  2. #2
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Search on http://www.HotScripts.com - I'm 95% sure something similar to what you're looking for can be found there - might be difficult to customize, however.

  3. #3
    SitePoint Addict
    Join Date
    Nov 2000
    Location
    London, UK
    Posts
    223
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you decide to make it yourself, probably the simplest way would be to have a little txt file with the same name as each of your pictures. Then, in it, it would have, say, one line for each rating?
    You'd have a php script to whom would be submitted the rating and the photo's name.
    It could then add the appropriate data.
    When you want to read it, you can simply have it add all the entries in the file together, and divide that by the number of lines the file. That way, you get an averaged thing, but it still keeps all of the data separate in case you want to do something else with it.

    If you need some help with this, just ask

    ... what's the world coming to?

  4. #4
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    What you could do, is create a field called rating in a table with the locations for the images, or something like that.

    Then on the page, you select the current rating, 0 is none. and then the user can rate the picture.

    Their rating added to the one in the database all divided by two, gives the average rating.

    Then you would write code:

    Code:
    if($rating== 0) {
    continue;
    } else {
    $rating_value = $rating / $rating_value;
    }
    
    $sql = "INSERT INTO table SET rating='$rating_value'";
    $do_sql = mysql_query($sql);
    if($do_sql} {
    print "Rating Updated"
    } else {
    print "Rating was not updated:" .
    mysql_error;
    }
    You would also have to remove decimal points etc, but that is a start.

    Peter

  5. #5
    SitePoint Addict
    Join Date
    Nov 2000
    Location
    London, UK
    Posts
    223
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, I fished out a script I made a little while ago.
    Basically, what you do is sort of like what I described earlier. You make a file for each thing you want to rate, making sure it has the appropriate name. You chmod all of those files 777.

    Then you just use querystring commands to have it show either the average for that file, or add a rating then show the average. The simple way of doing it is to include the script into a php file, because then you can have the form submit to itself, and it'll show the ratings where before it had a form.

    If you want, I'll just stick the script up here ...

    ... what's the world coming to?

  6. #6
    [Call me Bram] iBram007's Avatar
    Join Date
    Feb 2001
    Location
    Belgium
    Posts
    339
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Last edited by iBram007; Mar 24, 2001 at 12:16.

  7. #7
    SitePoint Addict Raioo's Avatar
    Join Date
    Jul 2000
    Location
    Boston
    Posts
    212
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cool ! I'll see what I can do, I'll tyr all of these methods you guys suggested and see how it works out.

    iBram that scripts looks like what I want to do, tried to see the demo but it didn't work

    later!
    I appreciate the help of everyone at SitePoint.com

  8. #8
    SitePoint Addict Raioo's Avatar
    Join Date
    Jul 2000
    Location
    Boston
    Posts
    212
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    However folks, all of the above methods (except iBram's pointer script which I haven't looked at yet in detail) will require supervision so that people don't keep on voting again and again. even cookies might be hacked, right ? I don't know how to do them.. maybe keeping track of the IPs can be useful
    I appreciate the help of everyone at SitePoint.com

  9. #9
    [Call me Bram] iBram007's Avatar
    Join Date
    Feb 2001
    Location
    Belgium
    Posts
    339
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think the 2nd one is able to check for more than one vote:

    http://sourceforge.net/projects/php-picturevote/

    From the developpers page on sourceforge:
    A PHP program that allows you to have visitors vote on pictures. Uses email confirmation to make sure only one email address can vote on a topic.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •