Exemple #1
0
    }
    //print_r($code);
} else {
    $call = new api();
    $stage = $call->checkSession($string->cell);
    if ($stage === false) {
        $feedback = array('code' => 0, 'msg' => "Welcome to eCab  \n\r Invalid request \n\r");
    } else {
        //check pin
        switch ($stage) {
            case 0:
                //validate pin
                $pin = $call->validatePIN($code);
                //  echo '<br/>'. md5((int)trim($code))."<<<";
                if ($pin === false) {
                    $attempts = $call->loginAttempts($string->cell);
                    if ($attempts > 3) {
                        $feedback = array('code' => 1, 'msg' => "Invalid Pin Please Try Again! \n\r" . ($attempts - 3) . " Attempts left.");
                    } else {
                        $feedback = array('code' => 0, 'msg' => "Too many invalid attempt \n\r Account blocked");
                    }
                } else {
                    $info = $call->getSession($string->cell);
                    $feedback = array('code' => 1, 'msg' => "Please confirm you want to pay \n N\$ {$info['amount']} \n To Taxi#: {$info['taxi_id']}? \n\r 1. Yes \n\r 2. No");
                    // update session
                    $call->updateSession($string->cell);
                }
                break;
            case 1:
                //process trans
                switch ($code) {