Advertisement
Guest User

Untitled

a guest
Oct 28th, 2011
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.44 KB | None | 0 0
  1. <?php
  2. if ((isset ($_GET['good'])))
  3. { $goodid = (int)$_GET['good'];
  4.     if ($goodid == 0){echo "<h2><strong>Reputation Error</strong></h2>";}
  5.     else{
  6. if ($goodid == $_SESSION['SESS_MEMBER_ID']) {echo "<h2>You cannot give reputation to you're self</h2>";}
  7. else{
  8.     $mymymyid = $_SESSION['SESS_MEMBER_ID'];
  9.     $query = "SELECT * FROM rep WHERE member_id='$goodid' and giver_id='$mymymyid' " or die("<br/>hihi<br/>".mysql_error());
  10. $result = mysql_query($query) or die(mysql_error());
  11.  
  12. if (mysql_num_rows($result) )
  13. {
  14.     print '<h2><strong>You have already gave this user a reputation</strong></h2>';
  15. }
  16. else
  17. {
  18.     $count_ifuserexists = mysql_query("SELECT COUNT(member_id) FROM members WHERE member_id=$goodid") or die("<br/>hihi<br/>".mysql_error());
  19.     $c_iue = mysql_fetch_row($count_ifuserexists);
  20.     if ($c_iue == 1) {
  21.     $query = mysql_query("INSERT INTO rep (member_id, giver_id, good) VALUES ('$goodid', '$mymymyid', '1')") or die("<br/>hihi<br/>".mysql_error());
  22.     if($query) {
  23. echo "<h2><strong>Reputation Added</strong></h2>";
  24. } else {
  25. echo "<h2><strong>Reputation Error</strong></h2>";
  26. }}
  27.     else echo "<h2><strong>User Doesn't Exist</strong></h2>";
  28.  
  29. }
  30. }
  31. }
  32. }
  33. else if((isset ($_GET['bad'])))
  34. { $badid = (int)$_GET['bad'];
  35. if ($badid == $_SESSION['SESS_MEMBER_ID']) {echo "<h2> You cannot give youreself bad reputation</h2>";}
  36. else {
  37. echo "<h2><strong> Negative Reputation Added </strong></h2>";
  38. }} else
  39.  
  40. echo header("location: profile.php");
  41. ?>
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement