So I got Cranavvo's badgeshop and everything worked fine. But the badges are bought with credits which i want to make shells from. But I cant seem to make it work to buy the badges with shells instead of credits. Anyone here that has any idea?
PHP Code:<?PHP
include("config.php");
$badgeid = mysql_real_escape_string($_GET['badgeid']);
$q1 = mysql_query("SELECT * FROM badgeshop WHERE id='{$badgeid}'");
$n1 = mysql_num_rows($q1);
while($row = mysql_fetch_assoc($q1)){
$badgecode = $row['badgecode'];
$price = $row['price'];
}
if($badgeid){
if($n1!=0){
$q2 = mysql_query("SELECT * FROM user_badges WHERE badge_id='{$badgecode}' AND user_id='{$userid}'");
$n2 = mysql_num_rows($q2);
if($n2!=1){
if($credits>$price||$credits==$price){ //forgot the or is equal in last update.
$cred = mysql_query("UPDATE users SET credits = credits -{$price} WHERE id='{$userid}'");
$badge = mysql_query("INSERT INTO user_badges(`user_id`, `badge_id`, `badge_slot`) VALUES('{$userid}','{$badgecode}','0')");
if($cred&&$badge){
header("Location: ../index.php?error=5");
mysql_close($server);
}
else{
header("Location: ../index.php?error=2");
mysql_close($server);
}
}
else{
header("Location: ../index.php?error=3");
mysql_close($server);
}
}
else{
header("Location: ../index.php?error=10");
mysql_close($server);
}
}
else{
header("Location: ../index.php?error=1");
mysql_close($server);
}
}
else{
header("Location: ../index.php?error=2");
mysql_close($server);
}
?>


Reply With Quote


