Jump to content
MakeWebGames

Grumpy

Members
  • Posts

    4
  • Joined

  • Last visited

Everything posted by Grumpy

  1. Thankyou for the advice Sniko. There is a good reason for a semi-colon after a closing brace. Because I have no idea what I am doing and the most simple things to you are extremely complicated to myself. However as each day passes I learn a little more. (semi-colon now removed :))
  2. I figured it was something like that thankyou CodingKid. Here is where I am now at with it. There is no voting limits and you can vote yourself which is pretty silly however that's my next mission.   <?php include "header.php"; $name = mysql_real_escape_string($_GET['name']); mysql_query("UPDATE grpgusers SET rate=rate+1 WHERE username = '$name'"); mysql_query("UPDATE grpgusers SET canrate=canrate-1 WHERE id=`id`='".$user_class->id."'"); $b = mysql_query("SELECT username,rate FROM grpgusers WHERE username='$name'"); $a = mysql_fetch_array($b); echo "You have given 1 rating to $name! Their rating is now ".$a['rate']."!"; include "footer.php"; die(); if ($_GET['action'] == "take") { mysql_query("UPDATE grpgusers SET rate=rate-1 WHERE username ='$name'"); mysql_query("UPDATE grpgusers SET canrate=canrate-1 WHERE id=`id`='".$user_class->id."'"); $b = mysql_query("SELECT username,rate FROM grpgusers WHERE username='".$_GET['u']."'"); $a = mysql_fetch_array($b); echo "You have taken 1 rating from $name! Their rating is now '".$a['rate']."'!"; die(); }else{ echo "Unknown action!"; include "footer.php"; die(); } ; ?>
  3. Thankyou for your help adamhull. I see where a lot of my errors were now. I did warn everyone my skills are poor. However I feel there is but one way to learn. Dive in the deep end. I was unable to get your actual code to work however I just changed it and now it works ok like below.   <?php $b = mysql_query("SELECT username,rate FROM grpgusers WHERE username='".$profile_class->username."'"); $a = mysql_fetch_array($b); $rating = $a['rate']; print "Rating: [<a href=giverate.php?name=$profile_class->username&action=take>-</a>] $rating [<a href=giverate.php?name=$profile_class->username&action=give>+</a>]"; ?>   As for securing it, one step at a time tiger :) Just getting it to work is proving difficult enough. In all seriousness however i am looking into how to protect the $_GET which i assume is the problem? Again thanks for the replies.
  4. I am trying to convert an mccodes mode over to grgp (simple rating system). I have made 2 columns inside grpgusers called rate and canrate Created one file called giverate.php as below. I know the show rating is wrong also... had not got that far as its already falling over. Don't hate on me please as my level of experience is looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooow.   <?php mysql_query("UPDATE grpgusers SET rate=rate+1 WHERE user_class->id={$_GET['u']}", $c); mysql_query("UPDATE grpgusers SET canrate=canrate-1 WHERE userid={$user_class->userid}", $c); $b = mysql_query("SELECT username,rate FROM grpgusers WHERE user_class->id={$_GET['u']}", $c); $a = mysql_fetch_array($b); print "You have given 1 rating to {$user_class->username}! Their rating is now {$a['rate']}!"; die($h->endpage()); }else if ($_GET['action'] == "take") { mysql_query("UPDATE grpgusers SET rate=rate-1 WHERE user_class->id={$_GET['u']}", $c); mysql_query("UPDATE grpgusers SET canrate=canrate-1 WHERE userid={$user_class->userid}", $c); $b = mysql_query("SELECT username,rate FROM grpgusers WHERE user_class->id={$_GET['u']}", $c); $a = mysql_fetch_array($b); print "You have taken 1 rating from {$user_class->username}! Their rating is now {$a['rate']}!"; die($h->endpage()); }else{ print "Unknown action!"; die($h->endpage()); } $h->endpage(); ?>   Here is the profile code.   <?php if ($user_class->rate == 0) { $rate = "<font color='blue'>{$user_class->id['rate']}</font>"; }else if ($r['rate'] > 0) { $rate = "<font color='green'>{$user_class->id['rate']}</font>"; }else if ($r['rate'] < 0) { $rate = "<font color='red'>{$user_class->id['rate']}</font>"; } print "Rating: [<a href='giverate.php?u={$user_class->id}&action=take'>-</a>] {$rate} [<a href='giverate.php?u={$user_class->id}&action=give'>+</a>]"; ?> </td></tr> <? if ($user_class->id != $profile_class->id){ ?>   If someone could point me in the correct direction that would be great thanks. Grumpy.
×
×
  • Create New...