I think JT missed some parts...
here my modified version, tested on my local machine only..
remove this code:
if($credits < 1) {
$error_msg="You must enter at least 1 credit!";
}
replace with this code:
if( ereg("[^0-9]", $credits) ){
$error_msg="You can only put in numbers 0 to 9";
}
Remove this code
else if( ereg("[0-9]", $credits) ){
$error_msg="You can only put in numbers 0 to 9";
}
So, the final piece of code looks like this:
if($action == "retract") {
if( ereg("[^0-9]", $credits) ){
$error_msg="You can only put in numbers 0 to 9";
}
else if($thisad[username] != $username) {
$error_msg="You do not have permission to edit this!!";
}
else if($credits > $thisad[credits]) {
$error_msg="You can not remove more credits than you have!!";
}
else {
$sql=$Db1->query("UPDATE ads SET credits=credits-$credits WHERE id='$id'");
$sql=$Db1->query("UPDATE user SET link_credits=link_credits+".($credits*$settings['class_'.strtolower($thisad['class']).'_credit_ratio'])." WHERE username='$username'");
$Db1->sql_close();
header("Location: index.php?view=account&ac=myads&adtype=link&".$url_variables."");
}
}
and same with other retract credit ad (banner, fbanner, xsite, ptsu, ptrads, fad, email)
Hope this help...