dimanche 29 octobre 2017

Else not showing good message

What my problem is, is that, when $kwota is the same as $sms_wallet in mysql database, it's still showing wrong message. I don't know what's wrong here. If anyone knows what's wrong here, respond please.

    if($get)
{
    $get = json_decode($get);

    if(is_object($get))
    {
        if($get->error)
        {
            echo $get->error;
        }
        else
        {
            $status = $get->status;

            if($status=="ok")
            {
                $q = mysql_result(mysql_query("SELECT sms_wallet FROM sms WHERE id = $key"),0);
                $kwota = $get->kwota;
                if ($kwota == $q) {
                $time = time();
                $cmd = $row['command'];
                mysql_query("INSERT INTO sms_database (user, buy_time, smskey, service, command) VALUES ('$username', $time, '$code', '$id', '$cmd')");
                foreach(explode(";", $row['command']) as $key)
                rcommand($rconIp, $rconPort, $rconPass, 10, $username, trim(str_replace("{GRACZ}", $username, $key)));
                $_SESSION['message'] = "code correct.";
                }                   
                if ($kwota !== $q) {
                    $_SESSION['message'] = "incorrect code.";
                }
            }
        }
    }
    else
    {
        echo "Nieznany błąd API.";
    }
}
else
{
    echo "Błąd połączenia z API.";
}   
fclose($get); 

Header("Location: /?action=sms&key=".$id."");
die();
}

Aucun commentaire:

Enregistrer un commentaire