To fix the negative donation replace your
###Donate### section in
itemshop.php with this. FYI, this also penalizes anyone who tries to enter a negative amount 10 points.
Replace the ### Donate ### section with this in itemshop.php.
Code:
// ###################### donate #######################
if($action==donate && isset($user)) {
if ($bbuserinfo['userid']==0) {
eval("dooutput(\"".gettemplate("error_notreg")."\");");
} else {
if($user == $bbuserinfo[userid]) {
eval("dooutput(\"".gettemplate("itemshop_donate-self")."\");");
exit;
} else {
if($points > 0) {
eval("dooutput(\"".gettemplate("itemshop_donate")."\");");
exit;
} else {
eval("dooutput(\"".gettemplate("itemshop_donate-error")."\");");
exit;
}
}
}
}
if (isset($iddonate)) {
if($amount < 1) {
eval("dooutput(\"".gettemplate("itemshop_donate-less")."\");");
$penalty = ($points - 10);
$DB_site->query("UPDATE userfield SET $pointfield='$penalty' WHERE userid=$bbuserinfo[userid]");
exit;
}
if($points >= $amount) {
$dpointss=$DB_site->query_first("SELECT $pointfield FROM userfield WHERE userid=$iddonate");
$dpoints = (int) $dpointss[$pointfield];
$donated = ($dpoints + $amount);
$substr = ($points - $amount);
$DB_site->query("UPDATE userfield SET $pointfield='$donated' WHERE userid=$iddonate");
$DB_site->query("UPDATE userfield SET $pointfield='$substr' WHERE userid=$bbuserinfo[userid]");
eval("dooutput(\"".gettemplate("itemshop_donate-thanks")."\");");
exit;
} else {
eval("dooutput(\"".gettemplate("itemshop_donate-more")."\");");
exit;
}
}
Make the template: itemshop_donate-less
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
$metarefresh
<title>$bbtitle - Itemshop</title>
$headinclude
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%">
<tr>
<td valign="middle" align="center">
<smallfont>You are trying to donate a negative amount! Stealing is not allowed! You have been penalized $10.</smallfont></td>
</tr>
</table>