Example #1
0
File: App.php Project: qious/Hnust
 public function error()
 {
     $content = \Hnust\input('content');
     if (!empty($content)) {
         Log::file('android', $content);
     }
 }
Example #2
0
 public function checkAuth($state, $code, $msg = null)
 {
     Log::recode($this->uid, $this->name, $this->module, $this->method, $this->key, $state);
     if ($code !== Config::RETURN_NORMAL) {
         $this->code = $code;
         $this->msg = $msg;
         exit;
     }
 }
Example #3
0
 protected function record($content)
 {
     return Log::file($this->logFileName, $content);
 }
Example #4
0
 public function daily()
 {
     $result = [];
     $methods = array('age', 'token', 'push', 'log', 'temp');
     foreach ($methods as $method) {
         $result[] = $this->{$method}();
     }
     //写入日志文件
     Log::file('daily', implode(',', array_filter($result)));
 }
Example #5
0
 public function passwd()
 {
     //全负荷执行
     Config::fullLoad();
     //添加学生学号到密码数据库
     $sql = 'INSERT INTO `weak`(`passwd`)
               (SELECT `sid` FROM `student` WHERE `sid` NOT IN
                 (SELECT `passwd` FROM `weak`))';
     Mysql::execute($sql);
     //添加教工号到数据库
     $sql = 'INSERT INTO `weak`(`passwd`)
               (SELECT `tid` FROM `teacher` WHERE `tid` NOT IN
                 (SELECT `passwd` FROM `weak`))';
     Mysql::execute($sql);
     //更新数据库
     while (true) {
         $sql = "SELECT `passwd` FROM `weak` WHERE `sha1` = '' OR `md5` = '' LIMIT 10000";
         $passwds = Mysql::execute($sql);
         if (empty($passwds)) {
             break;
         }
         $sql = 'UPDATE `weak` SET `sha1` = ?, `md5` = ? WHERE `passwd` = ? LIMIT 1';
         for ($i = 0; $i < count($passwds); $i++) {
             $passwd = $passwds[$i]['passwd'];
             $passwds[$i] = array(sha1($passwd), md5($passwd), $passwd);
         }
         if (Mysql::executeMultiple($sql, $passwds)) {
             Log::file('passwd', '成功更新' . count($passwds) . '条密码');
         } else {
             Log::file('passwd', '密码更新失败');
             break;
         }
     }
 }