public static function processInput($dataInput)
 {
     $result = array();
     $result = getData($dataInput);
     if (ValidationController::validate($dataInput)) {
         $commands = Controller::getCommandsFromInput($dataInput);
         $cursor = 1;
         for ($i = 0; $i < $commands[0]; $i++) {
             $cursor = Controller::interpreteSubCommand($commands, $cursor, $result);
         }
     }
     return $result;
 }
예제 #2
0
/**
 * Xử lý đăng nhập
 * @param string
 * @param string
 * @return void
 */
function PostLogin($username, $password)
{
    if (ValidationController::Login($username, $password)) {
        $result = UserSelect($username, $password);
        if ($result) {
            $_SESSION['login'] = $result;
            if ($_SESSION['login'][11] == '1') {
                echo 'admin';
            } else {
                echo 'user';
            }
        } else {
            //Tài khoản và mật khẩu không hợp lệ
            echo 'false';
        }
    } else {
        //Kiểm tra không hợp lệ
        echo 'false';
    }
}
    return;
}
$args = explode("/", $request);
$controller = $args[0];
if ($controller == "driver") {
    $driverCon = new DriverController($request, $method);
    $driverCon->resolve();
} else {
    if ($controller == "user") {
    } else {
        if ($controller == "admin") {
            $adminCon = new AdminController($request, $method);
            $adminCon->resolve();
        } else {
            if ($controller == "validate") {
                $validCon = new ValidationController($request, $method);
                $validCon->resolve();
            } else {
                if ($controller == "mail") {
                    $mailCon = new MailController($request, $method);
                    $mailCon->resolve();
                } else {
                    header('HTTP/1.1 400 Bad Request');
                    header('Content-Type: text/xml; charset=UTF-8');
                    echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
                    echo "<error>\n";
                    echo "<reason>Undefined API</reason>\n";
                    echo "<description>Kindly refer Ride on Bike API documentation</description>\n";
                    echo "</error>";
                    return;
                }