Trying To Make A User Rating System

Started on the old forum in February 2009 · view the original in the archive · old links redirect here

26 replies · 1,399 views · started 17 years ago · 1 min read

TL;DR · summary of 26 replies
  • $check = mysql_fetch_array(mysql_query("SELECT id FROM wap_users WHERE id='$who'")); should be added in the update code to prevent self-rating.
  • The validation for preventing users from rating themselves was fixed by adding a check in the update query.

Written automatically from the replies by a language model on our own server. It can be wrong; the posts below are the source.

4 participants
crazybrumi Super moderator Principal · 1,064 posts #21

QUOTE (nclemale36 @ Feb 11 2009, 06:02 PM) <{POST_SNAPBACK}>

na it dont do a thing now . not even update my own .

ur form needs to be edited to this

$who = mysql_real_escape_string( $_REQUEST["who"] );

echo "<form action=\"genproc.php?action=rate&sid=$sid&who=$who\" method=\"post\"><p align=\"center\">";
  echo "<select name=\"rate\">";
  echo "<option value=\"1\">1</option>";
  echo "<option value=\"2\">2</option>";
  echo "<option value=\"3\">3</option>";
  echo "<option value=\"4\">4</option>";
  echo "<option value=\"5\">5</option>";
  echo "<option value=\"6\">6</option>";
  echo "<option value=\"7\">7</option>";
  echo "<option value=\"8\">8</option>";
  echo "<option value=\"9\">9</option>";
  echo "<option value=\"10\">10</option>";
  echo "</select>";
  echo "<input type=\"Submit\" Name=\"Rate\" Value=\"Rate\"></form>";

Want something coded email me at sales@webnwaphost.com for a prices.

http://flagcounter.com/more/W80q

subzero Super moderator Fellow · 3,954 posts #23

$check = mysql_fetch_array(mysql_query("SELECT id FROM wap_users WHERE id='".$sid."'"));

if($check[0] == "$who") { echo "HAHAHAHA NO NO"; }else{

just add a } at end

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

crazybrumi Super moderator Principal · 1,064 posts #24

erm try this

////////////////////
else if($action=="rate")
{
  $rate= mysql_real_escape_string( $_REQUEST["rate"] );
  $bid = mysql_real_escape_string( $_REQUEST["bid"] );
  $who = mysql_real_escape_string( $_REQUEST["who"] );

   addonline(getuid_sid($sid),"Rating a member","");

if ($uid==$who)
{
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
      echo "<p align=\"center\">";
      echo "You Cant Rate Yourself Silly
";
      echo "</p></body></html>";
      exit();
} 

  
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
       echo "<p align=\"center\">";

$addplus = mysql_fetch_array(mysql_query("SELECT rate FROM wap_users WHERE id='".$who."'"));

$add = $rate;
$addplus = $add + $addplus[0];
$res = mysql_query("UPDATE wap_users SET rate= '".$addplus."' WHERE id='".$who."'");
  if($res)
   {
        echo "<img src=\"../images/ok.gif\" alt=\"o\"/> rated successfully
";
   }else {
        echo "<img src=\"../images/notok.gif\" alt=\"x\"/>You have rated this user before
";
   }

  echo "

";
  echo "[b]0 [/b]<a accesskey=\"0\" href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p></body>";
  }

Want something coded email me at sales@webnwaphost.com for a prices.

http://flagcounter.com/more/W80q

subzero Super moderator Fellow · 3,954 posts #26

no error i replaced one thing but u got it to work...

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close