private function item()
 {
     if (is_numeric(app::getargs())) {
         $service = new \min\service\product();
         $service->item(app::getargs());
     }
 }
Exemple #2
0
 private function category()
 {
     if (is_numeric(app::getargs())) {
         $service = new \min\service\product();
         $service->category(app::getargs());
     }
 }
Exemple #3
0
 public function showcaptcha($name = '')
 {
     $var1 = empty($name) ? 0 : app::cache('loginerror')->get($name);
     if ($var1 > 9) {
         app::usrerror(0, '账户已锁定,请2小时后再登录');
     }
     $var2 = empty($_SESSION['loginerror']) ? 0 : $_SESSION['loginerror'];
     return $var1 > 2 || $var2 > 7;
 }
 private function phone()
 {
     if (!validate('phone', $_GET['phone'])) {
         app::usrerror(0, '手机号码格式错误');
     } else {
         $result = $this->callservice($_GET['phone'], 'phone');
         app::response($result);
     }
 }
 private function check()
 {
     if (!is_numeric($_GET['callback']) || !preg_match('/^[a-z]+$/', $_GET['type'])) {
         trigger_error('captcha parameter error', E_USER_ERROR);
     }
     $code = new \min\inc\captcha();
     if (true === $code->checkcode($_GET['code'], $_GET['type'])) {
         app::response(1);
     }
 }
Exemple #6
0
 public function inituser($user)
 {
     if ($user['uid'] > 0) {
         // 每次登陆都需要更换session id ;
         session_regenerate_id();
         $nickname = empty($user['name']) ? $user['phone'] : $user['name'];
         app::usrerror(-999, $nickname, $user);
         setcookie('nickname', $nickname, 0, '/', COOKIE_DOMAIN);
         //app::usrerror(-999,ini_get('session.gc_maxlifetime'));
         // 此处应与 logincontroller islogged 相同
         setcookie('logged', 1, time() + ini_get('session.gc_maxlifetime') - 10, '/', COOKIE_DOMAIN);
         $_SESSION['logined'] = true;
         $_SESSION['UID'] = $user['uid'];
         //清理 注册缓存
         if ($this->clean_cache) {
             app::cache('checkaccount')->delete('{phone:}' . md5($_user['phone']));
         }
     }
 }
Exemple #7
0
 private function sqltest()
 {
     $sql = 'SELECT SQL_NO_CACHE  uid,name, email, pwd FROM user  WHERE name =?';
     $name = 'def';
     $sql_result = app::mysqli('user#user')->pquery('single', $sql, 's', [$name]);
     var_dump($sql_result);
     $sql = 'insert into user (email,name,pwd,phone) values (\'a@qq.com\',\'zhangsan\',\'abcefadfafa\',\'12323232323\')';
     $name = '*****@*****.**';
     $sql_result = app::mysqli()->query('insert', $sql);
     var_dump($sql_result);
     /*
     $sql = 'SELECT uid,name, email, pwd FROM user  WHERE name =:name';
     
     $driver_options[\PDO::ATTR_ERRMODE] = \PDO::ERRMODE_SILENT;
     $driver_options[\PDO::MYSQL_ATTR_USE_BUFFERED_QUERY] = false;
     $driver_options[\PDO::ATTR_EMULATE_PREPARES] = false;
     $dbh = new \PDO('mysql:dbname=qi_user;host=127.0.0.1','root','adolf',$driver_options);
      
     $sth = $dbh->prepare($sql);
     
     
     
     $sth->bindParam(':name', $name, \PDO::PARAM_STR);
     $name ='yb';
     $sth->execute();
     
     $red = $sth->fetchAll();
     
     var_dump($red);
     $name ='yb2';
      
     $sth->execute();
     sleep(10);
     $yellow = $sth->fetchAll();
     
     var_dump($yellow);
     */
 }
Exemple #8
0
 private function confirm()
 {
     app::layout('cart');
 }
Exemple #9
0
 private function showcaptcha($name)
 {
     $var1 = (int) app::cache('loginerror')->get($name);
     if ($var1 > 9) {
         app::usrerror(0, '账户已锁定,请2小时后再登录');
     }
     $var2 = isset($_SESSION['loginerror']) ? $_SESSION['loginerror'] : 0;
     $x = 0;
     $y = 0;
     if (0 < $var1) {
         $x = 1;
     }
     if (2 < $var1 || 7 < $var2) {
         $y = 1;
     }
     return ['cache' => $x, 'show' => $y];
 }
Exemple #10
0
 private function test()
 {
     app::layout();
 }
Exemple #11
0
 public function adduserbyphone($phone, $pwd)
 {
     $pwd = password_hash($pwd, PASSWORD_BCRYPT, ['cost' => 10]);
     $sql = 'insert into user (`phone`,`pwd`) values(? ,?)';
     return app::mysqli('user#user')->query('insert', $sql, 'ss', [$phone, $pwd]);
 }
Exemple #12
0
 private function confirm()
 {
     app::layout('checkout');
 }
Exemple #13
0
 public function category($id)
 {
     app::layout();
 }
Exemple #14
0
 private function success()
 {
     app::layout();
 }