Tilted Forum Project Discussion Community  

Go Back   Tilted Forum Project Discussion Community > Interests > Tilted Technology


 
 
LinkBack Thread Tools
Old 07-13-2004, 06:35 PM   #1 (permalink)
Crazy
 
Location: Arnold, MD
[PHP] Free Rate Me script?!

Does anyone know where I can get a free rate me script? I've found plenty of ones that I can buy but I would rather not spend the money. Any one seen one around?
j0hnb is offline  
Old 07-13-2004, 06:57 PM   #2 (permalink)
Junkie
 
Try hotscripts.com or scriptsearch.com
SinisterMotives is offline  
Old 07-14-2004, 04:14 AM   #3 (permalink)
Junkie
 
Location: RI
Shouldn't be that hard to create...
basically I think you'd want to create a table in a DB and have the table have three fields, ID, img location, rating. Have a function generate a random number and have that run against the table, pull that ID, and pull the image location and send it to your field.
Probably not the best solution but that's what I can see from here after looking at it for a minute.
Fallon is offline  
Old 07-14-2004, 04:38 AM   #4 (permalink)
paranoid
 
Silvy's Avatar
 
Location: The Netherlands
In addition to the above suggestion, to create correct ratings, your DB will need at least another field: number_of_votes.

The field 'rating' should contain the sum of all votes received. The average is then easily calculated:
PHP Code:
$old_rating db_results['rating'];   //current average rating
$old_votes db_results['number_of_votes'];  //number of people that have voted until now.
$current_rating user_input['rating'];   //the rating the current user has entered
$new_votes $old_votes+1;   //the number of votes after the new rating.

$new_rating $old_rating $current_rating;
// you can now insert $new_rating and $new_votes into the DB.

And you can use: $average $new_rating $new_votes to display the current standings
Now this will result in large numbers in your table (the total points awarded will get big real quick). If that's not what you want (for ordering the table perhaps) you can also store the average into the table. But you'll need to calculate the total points awarded whenever a new vote is added....
__________________
"Do not kill. Do not rape. Do not steal. These are principles which every man of every faith can embrace. "
- Murphy MacManus (Boondock Saints)

Last edited by Silvy; 07-14-2004 at 04:41 AM..
Silvy is offline  
Old 07-14-2004, 08:57 AM   #5 (permalink)
Junkie
 
Location: RI
Herm, what about this for a table
PHP Code:
Here's the table:
_________________________________
| ID | Img_loc | rating | num_votes |
------------------------------------ 
Simple little semi-flowchart:
When the voter sees the pic/story/etc, they vote on it, it gets added to the current rating then divide it by two. If you wanted to record the complete total, you'd need to probably make an array which would probably get kinda ugly.
If you want to keep track of all of the votes that someone does, then you'll need to create a login. When the person views a pic, and then rates it, have a seperate table such as:
PHP Code:
User:
___________________________
|UIDUsername Password|
-------------------------
Ratings:
_____________________
|Pic_IDUID Rating |
------------------- 
So when they submit a rating, it inserts the picture ID, the user ID and their rating. Then when you show the ratings, it'll do a search thru the database and do an average of all of the unique id's and report the totals. Probably missing out on bunchs of it, but I'm only giving it half a thought.
Fallon is offline  
Old 07-14-2004, 01:28 PM   #6 (permalink)
paranoid
 
Silvy's Avatar
 
Location: The Netherlands
Quote:
Originally posted by Fallon

When the voter sees the pic/story/etc, they vote on it, it gets added to the current rating then divide it by two. If you wanted to record the complete total, you'd need to probably make an array which would probably get kinda ugly.
If I see this correctly any vote would weigh the same as all previous votes combined...

I'd say store the total awarded points (the sum of all votes) in the 'rating' column and the total number of votes in the 'num_votes' column. When a user votes, add the value to 'rating', and add 1 to 'num_votes'. The average vote is then 'rating' / 'num_votes'.
This way there is no need for an array... (don't know how you figured that?)

If you want one vote per user (and thus a login type system) use the second, more elegant, solution by Fallon
__________________
"Do not kill. Do not rape. Do not steal. These are principles which every man of every faith can embrace. "
- Murphy MacManus (Boondock Saints)
Silvy is offline  
Old 07-14-2004, 06:43 PM   #7 (permalink)
Junkie
 
Location: RI
Quote:
This way there is no need for an array... (don't know how you figured that?)
Me neither now that I think about it. I think I was thinking about it as if it were a limited length array, which mostly likely wouldn't happen.

It all depends on what you want to do I believe. You could use the system as a rating for user writing/drawing/photo/etc. In that type of environment, I'd personally want the way I had it because I'd want to be able to ban people =p
Fallon is offline  
Old 07-14-2004, 11:54 PM   #8 (permalink)
paranoid
 
Silvy's Avatar
 
Location: The Netherlands
Quote:
Originally posted by Fallon
M In that type of environment, I'd personally want the way I had it because I'd want to be able to ban people =p
And to keep voting fair...
Though for the last point you could probably use cookies...
__________________
"Do not kill. Do not rape. Do not steal. These are principles which every man of every faith can embrace. "
- Murphy MacManus (Boondock Saints)
Silvy is offline  
 

Tags
free, php, rate, script


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 02:41 AM.

Tilted Forum Project

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73