Jump to content
MakeWebGames

SolarBacon

Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by SolarBacon

  1. Ahh, it's to prevent SQL injections right? :) I'll add it into my original post, I'm not great with SQL. In fact this is the first time I've attempted any sort of McCodes modification; haven't even used it for a good few years. :p
  2. Yeah I know the things could be removed, but thanks for the suggestion :) Also, my SQL was terrible, sorry about that. Should be fixed now. :)   Edit: Rockwood is the $_GET['u'] = mysql_real_escape_string($_GET['u'], $link) necessary?
  3. I threw this together in literally 5 minutes, you should read through the .php files you can learn a lot... Run this in PhpMyAdmin ALTER TABLE `users` Add `DailyVote` varchar(255) NOT NULL default 'False', Add `upvotes` int(11) NOT NULL default '0', Add `downvotes` int(11) NOT NULL default '0';   Put this in Viewuser.php print "<tr> <td>Votes: <br> Up: {$r['upvotes']}'> <br>Down: {$r['downvotes']}'</td>" print "<tr> <td><a href='upvote.php?u={$r['userid']}'>Give a up vote!</a></td>" print "<tr> <td><a href='downvote.php?u={$r['userid']}'>Give a down vote!</a></td>"   upvote.php <?php include "globals.php"; $_GET['u'] = abs((int) $_GET['u']); if(!$_GET['u']) { print "Invalid use of file"; } else { $_GET['u'] = mysql_real_escape_string($_GET['u'], $link) $q=$db->query("SELECT u.*,us.*,c.*,h.*,g.*,f.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid LEFT JOIN cities c ON u.location=c.cityid LEFT JOIN houses h ON u.maxwill=h.hWILL LEFT JOIN gangs g ON g.gangID=u.gang LEFT JOIN fedjail f ON f.fed_userid=u.userid WHERE u.userid={$_GET['u']}"); if($db->num_rows($q) == 0) { print "Sorry, we could not find a user with that ID, check your source."; } if($ir['DailyVote'] == 'False') { $db->query("UPDATE `users` SET DailyVote = 'True' WHERE `userid` == &ir"); $db->query("UPDATE `users` SET upvotes=upvotes+1 WHERE `userid` == $r"); print "You have up voted the player!"; } else { print "You may only vote once per day."; } $h->endpage(); ?>   downvote.php <?php include "globals.php"; $_GET['u'] = abs((int) $_GET['u']); if(!$_GET['u']) { print "Invalid use of file"; } else { $_GET['u'] = mysql_real_escape_string($_GET['u'], $link) $q=$db->query("SELECT u.*,us.*,c.*,h.*,g.*,f.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid LEFT JOIN cities c ON u.location=c.cityid LEFT JOIN houses h ON u.maxwill=h.hWILL LEFT JOIN gangs g ON g.gangID=u.gang LEFT JOIN fedjail f ON f.fed_userid=u.userid WHERE u.userid={$_GET['u']}"); if($db->num_rows($q) == 0) { print "Sorry, we could not find a user with that ID, check your source."; } if($ir['DailyVote'] == 'False') { $db->query("UPDATE `users` SET DailyVote = 'True' WHERE `userid` == &ir"); $db->query("UPDATE `users` SET downvotes=downvotes+1 WHERE `userid` == $r"); print "You have up voted the player!"; } else { print "You may only vote once per day."; } $h->endpage(); ?>   Add this into cron_day.php UPDATE users SET DailyVote = 'False'   Sure it could use some formatting improvements, maybe add an image or colours to show up and down votes, but from what I can tell this is the sort of thing you're looking for. :)
×
×
  • Create New...