예제 #1
0
 static function setUser()
 {
     self::setAccess();
     self::$defs = json_decode(file_get_contents("ref/defs.json"));
     //print_r(self::$defs); exit();
     if (!isset($_SERVER['PHP_AUTH_USER'])) {
         Error::http(401, "The header must include basic auth information.");
     }
     $user = $_SERVER['PHP_AUTH_USER'];
     self::$user_id = is_numeric($user) ? 1 * $user : 0;
     self::$email = self::$user_id ? "" : "{$user}";
     $pwd = isset($_SERVER['PHP_AUTH_PW']) ? $_SERVER['PHP_AUTH_PW'] : "";
     //exit('"'. self::$user_id ." ". $pwd ."---".  self::$email. '---"');
     if (self::$db_default == 'tatagsim') {
     } else {
         if (strpos($user, "consumer-") !== false) {
             self::consumer_login($user, $pwd);
         } else {
             if (strpos($user, "token-") !== false) {
                 self::token_login($user, $pwd);
             } else {
                 self::login($pwd);
             }
         }
     }
 }