Tilted Forum Project Discussion Community

Tilted Forum Project Discussion Community (https://thetfp.com/tfp/)
-   Tilted Technology (https://thetfp.com/tfp/tilted-technology/)
-   -   [PHP] Free Rate Me script?! (https://thetfp.com/tfp/tilted-technology/62387-php-free-rate-me-script.html)

j0hnb 07-13-2004 06:35 PM

[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?

SinisterMotives 07-13-2004 06:57 PM

Try hotscripts.com or scriptsearch.com

Fallon 07-14-2004 04:14 AM

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.

Silvy 07-14-2004 04:38 AM

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....

Fallon 07-14-2004 08:57 AM

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.

Silvy 07-14-2004 01:28 PM

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

Fallon 07-14-2004 06:43 PM

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

Silvy 07-14-2004 11:54 PM

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...


All times are GMT -8. The time now is 12:50 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, 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 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360