function __construct() { parent::__construct(); if (!is_login()) { redirect_to_login(); } $this->theme = theme(); $this->theme->setBreadcrumb("用户中心", "User"); }
public function index() { if (!isset($_SESSION['id']) || $_SESSION['level'] < 1) { redirect_to_login(); } $this->kiemtraModel = new kiemtraModel(); $this->registry->template->danhsachdethi = $this->kiemtraModel->get_dethi_all(); $this->registry->template->dethi_by_author = $this->kiemtraModel->get_dethi_all_by_author($_SESSION['id']); $this->registry->template->show('kiemtra/index'); }
function __construct() { parent::__construct(); if (!is_login()) { redirect_to_login(); } $this->theme = theme(); $this->theme->setBreadcrumb("消息中心", "Message"); l_h("html_tag.php"); }
function will($permission, $object = NULL, $exit_url = '/', $message = 'Sorry, you do not have permission to access this page.') { if (!can($permission, $object)) { if (current_user()) { redirect($exit_url, $message); } else { redirect_to_login($_SERVER['REQUEST_URI'], "Please login to access this page."); } } }
function __construct() { parent::__construct(); if (!is_login()) { redirect_to_login(); } else { if (!login_user()->is_active()) { redirect(['User', 'activation']); } } $this->theme = theme(); $this->theme->setBreadcrumb("图片中心", "Photo"); l_h("html_tag.php"); }
<?php require_once 'appfunctions.php'; if (is_logged_in()) { show_header(); } else { redirect_to_login(); } $remove_url = get_curr_dir() . "/remove.php?type=3&typecnt="; ?> <?php if (isset($_REQUEST['typecnt'])) { $dbh = get_database_handler(); $dbh->beginTransaction(); $query = 'SELECT t.typecnt,c.typecnt,c.campocnt,c.nome FROM tipo_registo as t, campo as c WHERE t.userid=c.userid AND c.userid=? AND c.ativo=1 AND t.ativo=1 AND t.typecnt=c.typecnt AND t.typecnt=? GROUP BY c.nome;'; $sth = $dbh->prepare($query); try { $sth->execute(array($_SESSION['userid'], $_REQUEST['typecnt'])); echo "<h2>campos do registo {$_REQUEST['typecnt']}</h2>"; echo "<table border=\"1\" cellspacing=\"5\">\n"; echo "<tr>\n"; echo "<th>campocnt</th>"; echo "<th>nome</th>"; echo "<th></th>"; echo "</tr>\n"; foreach ($sth as $row) { echo "<tr>\n";
if ($fromurl && !eregi("login\\.php", $fromurl) && !eregi("reg\\.php", $fromurl)) { $jumpto = $fromurl; } else { $jumpto = "{$webdb['www_url']}/"; } refreshto("{$jumpto}", "QQ方式登录成功{$uc_login_code}", 1); } else { refreshto("qq_bind.php", "QQ登录成功,请进行帐号绑定设置", 10); } //第三方处理用户绑定逻辑 //将openid与第三方的帐号做关联 //bind_to_openid(); } else { //登录前 set_cookie('qq_fromurl', $FROMURL); redirect_to_login($webdb[QQ_appid], $webdb[QQ_appkey], "{$webdb['www_url']}/do/qq_login.php"); } /** * @brief get a access token * rfc1738 urlencode * @param $appid * @param $appkey * @param $request_token * @param $request_token_secret * @param $vericode * * @return a string, as follows: * oauth_token=xxx&oauth_token_secret=xxx&openid=xxx&oauth_signature=xxx&oauth_vericode=xxx×tamp=xxx */ function get_access_token($appid, $appkey, $request_token, $request_token_secret, $vericode) {
echo "<h3>返回值:</h3>{$request_token}</br>"; echo '<h3>请参考</h3><a href="http://wiki.opensns.qq.com/wiki/%E3%80%90QQ%E7%99%BB%E5%BD%95%E3%80%91%E5%85%AC%E5%85%B1%E8%BF%94%E5%9B%9E%E7%A0%81%E8%AF%B4%E6%98%8E" target="_blank">错误码说明</a>与<a href="http://open.qzone.qq.com/oauth_tool/oauth_url_check.htm">调试工具</a>'; echo '</body>'; echo '</html>'; exit; } //解析返回值 $result = array(); parse_str($request_token, $result); //request token, request token secret 需要保存起来 //在demo演示中,直接保存在全局变量中. //为避免网站存在多个子域名或同一个主域名不同服务器造成的session无法共享问题 //请开发者按照本SDK中comm/session.php中的注释对session.php进行必要的修改,以解决上述2个问题, $_SESSION["token"] = $result["oauth_token"]; $_SESSION["secret"] = $result["oauth_token_secret"]; ////构造请求URL $redirect .= "oauth_token=" . $result["oauth_token"] . "&oauth_callback=" . QQConnect_urlencode($callback); header("Location:{$redirect}"); } //redirect_to_login接口调用示例(当用户点击QQ登录按钮时,应该调用该接口以引导用户到QQ登录页面) $new_app_key = $_GET["qq_app_key"]; $new_app_secret = $_GET["qq_app_secret"]; //如果站点申请了应用,就使用新应用的信息,否则使用默认的应用信息 if ($new_app_key && $new_app_secret) { $_SESSION["appid"] = $new_app_key; $_SESSION["appkey"] = $new_app_secret; $_SESSION["callback"] = "http://" . $_SERVER["HTTP_HOST"] . "/includes/third/qq_api/oauth/get_access_token.php?" . "appid=" . $new_app_key . "&appkey=" . $new_app_secret; } //exit(print_r($_SESSION)); redirect_to_login($_SESSION["appid"], $_SESSION["appkey"], $_SESSION["callback"]);
<?php if (!$_PEFI->crdntls->can('commercials')) { redirect_to_login($_PEFI->route->page); } include_once "{$_PEFI->libPath}/pefi_fileshelper.php"; include_once "{$_PEFI->libPath}/pefi_stringhelper.php"; $todo = $_PEFI->todo; $_PEFI->view->title = 'Commercials Action Output'; if ($todo == 'clean') { $_PEFI->view->content .= clean(array_key_exists('clean_tmp', $_REQUEST) ? true : false); } elseif ($todo == 'publish') { $_PEFI->view->content .= publish(); } elseif ($todo == 'upload') { $_PEFI->view->content .= upload(); } elseif ($todo == 'generate') { $_PEFI->view->content .= generate(array_key_exists('download', $_REQUEST) ? true : false); } // actions function clean($clean_tmp = false) { $tmp = '_tmp/Pefi_COMRES/'; $res = 'Cleaning commercials<br>'; // remove commercial files $files = explode(';', tr('commercials.urls:admin')); foreach ($files as $fName) { $fName = '_pages/' . $fName; if (@unlink($fName)) { $res .= "Removed file: {$fName} <br>"; } else { $res .= "Tried to remove file: {$fName} but no success <br>";
public function search() { if (isset($_SESSION['id'])) { $this->classModel = new classModel(); $this->usersModel = new usersModel(); if (isset($_SESSION['id'])) { $this->registry->template->num_notice = $this->classModel->count_notice($_SESSION['id']); } $this->registry->template->vaitro = $this->usersModel->getLevel($_SESSION['id']); $this->registry->template->users = $this->usersModel->getUsers($_SESSION['id']); $this->registry->template->class = $this->classModel->getClass(); $this->registry->template->menu = $this->classModel->getMenu(); $this->registry->template->title = "Tìm kiếm lớp học"; $this->registry->template->show("class/search/index"); } else { redirect_to_login(); } }
?> "> <button id="CommentReplyCancel" style="display: none;" type="button" class="btn btn-warning pull-left">取消回复</button> <button id="CommentSubmit" type="submit" class="btn btn-success pull-right">评论/Ctrl+Enter</button> </form> <script> function keyTrySubmit() { if (event.ctrlKey && event.keyCode == 13) { document.getElementById('CommentSubmit').click(); } } $(function () { $("#CommentForm").submit(function () { if (!IS_LOGIN) { location.href = '<?php echo redirect_to_login(true); ?> '; } var data = $("form#CommentForm").serialize(); $.post(this.action, data, function (data) { if (data['status']) { location.reload(); } else { alert(data['msg']); } }); return false; }); $(".comment-reply").click(function () { var i = this.href.indexOf('#');
* @param $appid * @param $appkey * @param $callback * * @return 返回字符串格式为:oauth_token=xxx&openid=xxx&oauth_signature=xxx×tamp=xxx&oauth_vericode=xxx */ function redirect_to_login($appid, $appkey, $callback) { //跳转到QQ登录页的接口地址, 不要更改!! $redirect = "http://openapi.qzone.qq.com/oauth/qzoneoauth_authorize?oauth_consumer_key={$appid}&"; //调用get_request_token接口获取未授权的临时token $result = array(); $request_token = get_request_token($appid, $appkey); parse_str($request_token, $result); //request token, request token secret 需要保存起来 //在demo演示中,直接保存在全局变量中. //正式网站运营环境中,我们强烈建议你将这两个值保存在MySQL或者其他永久的存储中以便于后续使用 //尤其是在网站不止一台服务器的情况下,两次请求的sessoin信息可能不会保存再同一台服务器导致访问出错 es_session::set("token", $result["oauth_token"]); es_session::set("secret", $result["oauth_token_secret"]); if ($result["oauth_token"] == "") { //示例代码中没有对错误情况进行处理。真实情况下网站需要自己处理错误情况 exit; } ////构造请求URL $redirect .= "oauth_token=" . $result["oauth_token"] . "&oauth_callback=" . rawurlencode($callback); header("Location:{$redirect}"); } //redirect_to_login接口调用示例(当用户点击QQ登录按钮时,应该调用该接口以引导用户到QQ登录页面) redirect_to_login($appid, $appkey, $callback);
public function time_line() { if (!is_login()) { redirect_to_login(); } $this->theme->setTitle("时间线"); $this->theme->footer_add($this->theme->js(['src' => get_style("time_line.js")])); $this->theme->footer_add($this->theme->js(['src' => get_js_url("jquery.form.js")])); $this->__view("Home/header.php"); $this->__view("Show/time_line.php"); $this->__view("Home/footer.php"); }