public function _initialize()
 {
     if (C('STOP_REPAIR')) {
         $this->error('您好,由于临近期中考试,飞扬报修系统暂时关闭系统。系统重新开放后,我们将会在四川大学飞扬俱乐部官方微信/微博进行通知,尽请留意!', '', 8);
         exit;
     }
     if ($_GET['access_token']) {
         if ($_GET['access_token'] != $_SESSION['access_token']) {
             session(null);
             session('access_token', $_GET['access_token']);
             redirect('/Home/AccountPage/ucLogin?access_token=' . $_GET['access_token']);
             exit;
         }
         $uid = is_tokenLogin($_GET['access_token']);
         if (!$uid) {
             $this->error('登录超时,请重新登录', C('UC_LOGIN_URL'));
         }
     } else {
         if ($_SESSION['access_token']) {
             $self = __SELF__;
             redirect(__SELF__ . '?access_token=' . $_SESSION['access_token']);
         } else {
             not_login();
         }
     }
 }
<?php

require_once "inc/init.php";
not_login($_SESSION['admin_id'], "login.php");
if (isset($_GET['id'])) {
    $id = escape($_GET['id']);
    $del = $db->Delete("category", "id='{$id}'");
    $affected_row = mysqli_affected_rows($mysqli);
    if ($affected_row == 1) {
        redirect("category.php");
    } else {
        echo "<h2 class='text-red text-center'>Error in Deleting category</h2>";
        exit;
    }
} else {
    die("Invalid Url");
}
 public function register()
 {
     if (C('STOP_REPAIR')) {
         $this->error('您好,飞扬报修系统由于一些原因暂时关闭系统。系统重新开放后,我们将会在四川大学飞扬俱乐部官方微信/微博进行通知,尽请留意!', '', 8);
         exit;
     }
     if ($_GET['access_token']) {
         $uid = is_tokenLogin($_GET['access_token']);
         if (!$uid) {
             $this->error('登录超时,请重新登录', C('UC_LOGIN_URL'));
         } else {
             if (is_userExtend($_SESSION['tel'])) {
                 $this->error('您已经注册过飞扬报修系统了,将跳转至首页', '/Home/Index/index?access_token=' . $_GET['access_token']);
                 exit;
             } else {
                 $this->display();
             }
         }
     } else {
         if ($_SESSION['access_token']) {
             redirect(__SELF__ . '?access_token=' . $_SESSION['access_token']);
         } else {
             not_login();
         }
     }
 }
Example #4
0
function init()
{
    if (C('STOP_REPAIR')) {
        $this->error('您好,飞扬报修系统由于一些原因暂时关闭系统。系统重新开放后,我们将会在四川大学飞扬俱乐部官方微信/微博进行通知,尽请留意!', '', 8);
        exit;
    }
    if ($_GET['access_token']) {
        $userinfo = is_tokenLogin($_GET['access_token']);
        if ($userinfo) {
            $this->user_id = session('user_id');
            $this->ucid = session('ucid');
            $this->type = session('type');
            $this->tel = $userinfo['tel'];
        } else {
            login_expire();
        }
    } else {
        if ($_SESSION['access_token']) {
            $self = __SELF__;
            if (substr($self, -1, 1) == '/') {
                redirect(__SELF__ . 'access_token/' . $_SESSION['access_token']);
            } else {
                redirect(__SELF__ . '/access_token/' . $_SESSION['access_token']);
            }
        } else {
            not_login();
        }
    }
}
 public function admin_login()
 {
     not_login();
 }