Re: [Mccodes V2] Player Mood
Good mod mate. I found a cpl errors, but have fixed em
the new code for the function in prefs.php should be
function MoodChange() {
global $ir, $db;
if (isset($_POST['PlayerMood'])) {
if (strlen($_POST['PlayerMood'])>10) {
print "Sorry, but you cannot pass the 10 characters.
[url='prefs.php?act=MoodChange']Go Back[/url]
";
exit;
}else{
$db->query(sprintf("UPDATE `users` SET `mood`='%s' WHERE `userid`='%d'", $_POST['PlayerMood'], $ir['userid']));
echo sprintf("You're Mood Is Now %s", $_POST['PlayerMood']);
exit;
}
} else {
echo '<h3 style="text-decoration: underline;">Mood Change</h3>
<form action="prefs.php?act=MoodChange" method="post">';
echo sprintf("<input type='text' name='PlayerMood' value='%s' />
", $PlayerMood);
echo sprintf("You're Mood Is Currently: %s
", stripslashes($ir['mood']));
echo '<input type="submit" value="Mood Change!" />
</form>';
}
}
Basically the errors I found, was that it was not displaying your Current mood when you go to preferences. I also added a couple
to make it a bit more organised. I hope you don't mind, but I restricted it to 10 characters. I didnt want people to write books. :)
+1 to you though :)