Esempio n. 1
0
}
if (!isset($_REQUEST[KEY_MODE])) {
    $response[KEY_STATUS] = R_STATUS_FAILED;
    if (SETTING_ERROR) {
        $response[KEY_ERROR_CODE] = E_INSUFFICIENT_PARAMS;
        $response[KEY_ERROR_MESSAGE] = EM_INSUFFICIENT_PARAMS;
    }
    echo json_encode($response);
    exit;
}
switch ($_REQUEST[KEY_MODE]) {
    case M_INIT:
        if (!isset($_REQUEST[P_PLATFORM_CODE])) {
            break;
        }
        $response = $modes->init();
        // if email and password
        // functionality here
        break;
    case M_LOGIN:
        // if email and pwd are sent, continue, else exit
        if (isset($_REQUEST[P_EMAIL]) && isset($_REQUEST[P_PASSWORD]) && isset($_REQUEST[P_HAS_EXISTING_SESSION])) {
            $email = strtolower($_REQUEST[P_EMAIL]);
            $hasExistingSession = strtolower($_REQUEST[P_HAS_EXISTING_SESSION]);
            if ($hasExistingSession == "true" || $hasExistingSession == "yes" || $hasExistingSession == "1") {
                $password = $_REQUEST[P_PASSWORD];
            } else {
                if ($hasExistingSession == "false" || $hasExistingSession == "no" || $hasExistingSession == "0") {
                    $password = md5($_REQUEST[P_PASSWORD]);
                    //echo $password;
                }