Skip to content
Snippets Groups Projects
Commit e70f5a39 authored by Robert Scott James's avatar Robert Scott James
Browse files

Fixed ability for Banana capable users to give arbitary amounts of bananas

parent bf05dd50
Loading
......@@ -8,6 +8,10 @@ if (!isset($who)) {
$who = "nobody";
}
// Adding variable to limit maximum bananas awarded at once?
$maxbanana = 3;
// what permission does a user need to be able to award bananas?
$permission = "bananas";
......@@ -21,10 +25,18 @@ if (isset($session->groups[$permission])) {
if ($_REQUEST['action'] == "award") {
if (trim ($_POST['why']) !== "") {
$number = intval($_POST['number']);
$why = $_POST['why'];
$DB->Query("INSERT INTO awards (username, score, whn, who, why) VALUES (?,?,NOW(),?,?)", array($who, $number, $session->username, $why));
header("Location: " . $_SERVER['PHP_SELF']);
if ( abs($number) <= $maxbanana ){
$DB->Query("INSERT INTO awards (username, score, whn, who, why) VALUES (?,?,NOW(),?,?)", array($who, $number, $session->username, $why));
header("Location: " . $_SERVER['PHP_SELF']);
} else {
trigger_error("Nice try ".$session->username."! You've submitted a request with too many bananas");
}
} else {
trigger_error("No reason entered for the awarding of bananas.", E_USER_WARNING);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment