Cranavvos badgeshop

Results 1 to 9 of 9
  1. #1
    Apprentice Code46 is offline
    MemberRank
    Jun 2009 Join Date
    18Posts

    Cranavvos badgeshop

    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);

    }



    ?>
    Last edited by Code46; 12-12-14 at 01:50 PM.


  2. #2
    o/ Konquer is offline
    MemberRank
    Apr 2014 Join Date
    464Posts

    Re: Cranavvos badgeshop

    If you could post the php script that actually updates the users table then maybe we could change it out for ya. Shouldn't be too hard :)

  3. #3
    Apprentice Code46 is offline
    MemberRank
    Jun 2009 Join Date
    18Posts

    Re: Cranavvos badgeshop

    This is the script
    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);

    }



    ?>

  4. #4
    Apprentice AspFan is offline
    MemberRank
    Nov 2014 Join Date
    7Posts

    Re: Cranavvos badgeshop

    Quote Originally Posted by Code46 View Post
    This is the script
    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);

    }



    ?>
    Change
    $cred = mysql_query("UPDATE users SET credits = credits -{$price} WHERE id='{$userid}'");
    to
    $cred = mysql_query("UPDATE users SET activity_points = activity_points -{$price} WHERE id='{$userid}'");

  5. #5
    Apprentice Code46 is offline
    MemberRank
    Jun 2009 Join Date
    18Posts

    Re: Cranavvos badgeshop

    Quote Originally Posted by AspFan View Post
    Change
    $cred = mysql_query("UPDATE users SET credits = credits -{$price} WHERE id='{$userid}'");
    to
    $cred = mysql_query("UPDATE users SET activity_points = activity_points -{$price} WHERE id='{$userid}'");
    Tried that already that doesnt work. It works when you have shells. Then it takes off shells but if you dont have shells you can still buy them.

  6. #6
    Apprentice AspFan is offline
    MemberRank
    Nov 2014 Join Date
    7Posts

    Re: Cranavvos badgeshop

    If activity_points is shells then this should check if the user has enough shells before buying.
    $cred = mysql_query("UPDATE users SET activity_points = activity_points - '{$price}' WHERE id = '{$userid}' AND activity_points >= '{$price}'");

  7. #7
    Apprentice Code46 is offline
    MemberRank
    Jun 2009 Join Date
    18Posts

    Re: Cranavvos badgeshop

    Quote Originally Posted by AspFan View Post
    If activity_points is shells then this should check if the user has enough shells before buying.
    $cred = mysql_query("UPDATE users SET activity_points = activity_points - '{$price}' WHERE id = '{$userid}' AND activity_points >= '{$price}'");
    vip_points is shells but i tried what u said and my activity points were high enough but it still didnt work it said that i had not enough currency to buy it (error 3) It appears you have insufficiant funds!

  8. #8
    Apprentice AspFan is offline
    MemberRank
    Nov 2014 Join Date
    7Posts

    Re: Cranavvos badgeshop

    if($shells > $price|| $shells == $price){

    $cred = mysql_query("UPDATE users SET vip_shells = vip_shells - {$price} WHERE id = '{$userid}'");
    $badge = mysql_query("INSERT INTO user_badges(`user_id`, `badge_id`, `badge_slot`) VALUES('{$userid}','{$badgecode}','0')");


    Didn't read carefully enough sorry, there is already a logic checking if user has enough. Can you show where the variable $credits get initialized (where is it first seen)?
    The code was
    if($credits > $price|| $credits == $price){

  9. #9
    Apprentice Code46 is offline
    MemberRank
    Jun 2009 Join Date
    18Posts

    Re: Cranavvos badgeshop

    Quote Originally Posted by AspFan View Post
    if($shells > $price|| $shells == $price){

    $cred = mysql_query("UPDATE users SET vip_shells = vip_shells - {$price} WHERE id = '{$userid}'");
    $badge = mysql_query("INSERT INTO user_badges(`user_id`, `badge_id`, `badge_slot`) VALUES('{$userid}','{$badgecode}','0')");


    Didn't read carefully enough sorry, there is already a logic checking if user has enough. Can you show where the variable $credits get initialized (where is it first seen)?
    The code was
    if($credits > $price|| $credits == $price){
    is it shells > price or vip_points > price? And i dont know where it was first seen. But here is the download link of the whole shop: http://www.mediafire.com/download/uc...by+Aruthra.rar. Thanks for being so kind to help me out though :D



Advertisement