FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

Super fast script mod (300 frih)

 


warallthetm
Hey, I've been trying to find a good Ajax/php five star rating script for my site, I have tried a bunch but I really like this one:
Code:

http://www.masugadesign.com/the-lab/scripts/unobtrusive-ajax-star-rating-bar/


You see, my site has a points system, so the user gets 1 point for every item they rate. So I need to include a file called "1up.php", the contents of the file are pretty simple:
Code:

<?php
include("config.php");
include("include/session.php");
   // the point addition system
   if($session->logged_in){
   
    $username = $session->username;
   
// Input/gather data
$gettutorial = mysql_query("SELECT * FROM users WHERE username = '$username' ") or die (mysql_error());
$sqlpoint = mysql_query("SELECT point FROM users WHERE username = '$username' ") or die (mysql_error());
$tutorial= mysql_fetch_array($gettutorial);
// begin adding points and stuff
$points = $tutorial['point'] + 1;
mysql_query("UPDATE users SET point='$points' WHERE username='$username'") or die (mysql_error());

mysql_free_result($gettutorial);
}
else{}
?>


That code works fine when i just view the file 1up.php, but i need it so that they only get the points when the rate the item.

It shouldnt be hard just a simple "include ("1up.php");"
but i cant figure out where to put it.

I will pay $300 frih for this very simple fix
salman_500
welll its simple ....

insert this :
(link to the file)

Code:
include('1up.php');


here :
after line 52 in db.php file :
like this :

Code:
if (($vote_sent >= 1 && $vote_sent <= $units) && ($ip == $ip_num)) { // keep votes within range
   $update = "UPDATE $rating_dbname.$rating_tableName SET total_votes='".$added."', total_value='".$sum."', used_ips='".$insertip."' WHERE id='$id_sent'";
   include('1up.php');


should do the trick ... hope it does...lol :p
warallthetm
tried it already, dosnt work Sad
salman_500
do the same as above with the rpc.php file..

the db.php file states :

Quote:
Page: db.php
Created: Aug 2006
Last Mod: Mar 18 2007
This page handles the database update if the user
does NOT have Javascript enabled.


and the rpc.php states :

Quote:
Page: rpc.php
Created: Aug 2006
Last Mod: Mar 18 2007
This page handles the 'AJAX' type response if the user
has Javascript enabled.


it would be helpfull if you have the include on both pages... so that user with and without java, both get points.. this should help ! hope it does ! lol
warallthetm
thnx, i just paid you
salman_500
thnx !
Reply to topic    Frihost Forum Index -> Miscellaneous -> Marketplace

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.