Exemple #1
0
 public static function createUser($data)
 {
     $sql = "INSERT INTO " . self::$table . " SET " . "email_user = '******'email_user']) . "'," . "login_user = '******'login_user']) . "'," . "password_user = '******'login_user'])) . "'";
     print $sql;
     parent::query($sql);
     return parent::queryError();
 }
 private function Authorize($login, $password)
 {
     if (authModel::checkInBase($login, $password)) {
         classModel::setSession(array('login' => true));
         // set loggined user data
         authModel::$userData = usersModel::getUser("login_user = '******' AND " . "password_user = '******'");
         // write to session
         classModel::setSession(array('userData' => authModel::$userData));
         // go to main admin page
         header("Location: " . $this->makeURI(array('controller' => 'archive')));
         exit;
     } else {
         authModel::$errors[] = 'Wrong login\\password';
     }
     return null;
 }
Exemple #3
0
 public static function checkInBase($data, $exceptions = array())
 {
     $condition = array();
     if (is_array($data)) {
         foreach ($data as $k => $v) {
             if (!in_array($k, $exceptions)) {
                 $condition[] = $k . ' = "' . parent::escapeString($v) . '"';
             }
         }
     }
     if (count($condition)) {
         $sql = "SELECT * FROM check_log\n                    WHERE " . implode(" AND ", $condition);
         $q = parent::query($sql);
         $r = parent::fetchAssoc($q);
         print parent::queryError();
         return $r['id_check_log'] ? $r['id_check_log'] : false;
     }
     return false;
 }