Example #1
0
 static function logout()
 {
     if (!LibUtil::cookie(self::$cookieName)) {
         throw new RuntimeException('您还未登录');
     }
     return LibUtil::cookie(self::$cookieName, '');
 }
Example #2
0
 public function insert($title, $content)
 {
     $cmd = 'INSERT INTO notify(notify_title, notify_content, notify_created)
     VALUES (:title, :content, :time)';
     $param = array('title' => Util::simple_purify($title), 'content' => LibUtil::html_purify($content), 'time' => Util::get_datetime());
     $this->run($cmd, $param);
 }
Example #3
0
 public function update($id, $title, $content)
 {
     $cmd = 'UPDATE news set news_title=:title, news_content=:content, news_created=:time
     WHERE news_id=:id';
     $param = array('id' => $id, 'title' => Util::simple_purify($title), 'content' => LibUtil::html_purify($content), 'time' => Util::get_datetime());
     $this->run($cmd, $param);
 }
Example #4
0
define('EXCEPT_API', -10004);
// 以php连接其它API接口出现的异常
define('EXCEPT_REQ', -20000);
// 参数出现的错误
// 自加载
spl_autoload_register('autoload');
// aotuload注册
// 时区还是设置一下 有时候date会警告
date_default_timezone_set("PRC");
// 调试状态
switch (DEMO) {
    case 1:
        define('DEBUG', true);
        break;
    case 2:
        if (defined('SAFE_IP') && LibUtil::getIp() == SAFE_IP) {
            error_reporting(E_ALL);
            define('DEBUG', true);
        } else {
            define('DEBUG', false);
        }
        break;
    default:
        error_reporting(0);
        define('DEBUG', false);
        break;
}
// 在框架项目之下
if (DEBUG) {
    set_error_handler("error_handler");
}