Beispiel #1
0
 public function process($a, $get)
 {
     array_shift($a);
     switch (array_shift($a)) {
         case 'restore':
             require 'Restore.php';
             $restore = new Restore();
             return $restore->process($a, $get);
             break;
         default:
             $post = json_decode(file_get_contents("php://input"), TRUE);
             if (!isset($post['credentials'])) {
                 return 'OOPS';
             }
             $cred = explode(',', $post['credentials']);
             $cmd = $cred[0];
             if ($cmd == 'welcome') {
                 return $this->_login($cred[1], $cred[2]);
             } elseif ($cmd == 'logout') {
                 return $this->logout();
             } else {
                 if ($cmd == 'login') {
                     return $this->_login($cred[1], $cred[2]);
                 } else {
                     if ($cmd == 'createuser') {
                         return $this->createUser($cred[1], $cred[2], $cred[3]);
                     } else {
                         if ($cmd == 'checkuser') {
                             return $this->checkUser($cred[1]);
                         }
                     }
                 }
             }
             break;
     }
     return 'OPPS2';
 }
Beispiel #2
0
        return $out;
        //'ERROR,no_user_with_username,'.$username;
    }
    private function getUserId()
    {
        return '';
    }
    function log($log)
    {
        error_log("\r\n " . date("Y-m-d H:i:s") . '  ' . $log, 3, '../logs/restore_' . $this->getUserId() . '.log');
    }
    function emailError($err)
    {
        error_log($err, 1, '*****@*****.**');
    }
    function logError($err)
    {
        error_log("\r\n " . date("Y-m-d H:i:s") . '  ' . $err, 3, '../logs/ERROR_restore_' . $this->getUserId() . '.log');
    }
}
if (isset($_GET['a'])) {
    $a = explode('.', $_GET['a']);
    $res = 0;
    if (array_shift($a) === 'restore') {
        $restore = new Restore();
        $res = $restore->process($a);
    }
    if ($res) {
        echo is_string($res) ? $res : json_encode($res);
    }
}