本文整理匯總了PHP中Tool::alertLocation方法的典型用法代碼示例。如果您正苦於以下問題:PHP Tool::alertLocation方法的具體用法?PHP Tool::alertLocation怎麽用?PHP Tool::alertLocation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Tool
的用法示例。
在下文中一共展示了Tool::alertLocation方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Action
public function Action()
{
switch ($_GET['action']) {
case 'login':
if (isset($_POST['send'])) {
if (!Validate::Check_Length($_POST['code'], 4, 'equals')) {
Tool::alertBack('驗證碼必須為四位');
}
if (!Validate::Check_Equals($_POST['code'], strtolower($_SESSION['code']))) {
Tool::alertBack('驗證碼不正確');
}
$object = $this->model->Manage_Login();
if (!Validate::Check_Null($object)) {
$_SESSION['admin']['username'] = $object->username;
//生成session
$_SESSION['admin']['level_position'] = $object->level_position;
$this->model->Login_Count();
Tool::alertLocation(null, 'admin.php');
} else {
Tool::alertBack('用戶名或者密碼錯誤,請重新輸入');
}
}
break;
case 'logout':
if (session_start()) {
session_destroy();
}
Tool::alertLocation(null, 'admin_login.php');
break;
}
}
示例2: checkAdmin
public static function checkAdmin()
{
if (!isset($_SESSION['ticeAdmin'])) {
Tool::alertLocation('請先登錄', Controller::createUrl('default/login'));
return false;
}
return true;
}
示例3: checkLogin
public function checkLogin()
{
if (!isset($_SESSION['ticeStuId'])) {
Tool::alertLocation(null, Controller::createUrl('user/login'));
return false;
}
return true;
}
示例4: Check_Login
static function Check_Login()
{
if (session_start()) {
if (!isset($_SESSION['admin'])) {
Tool::alertLocation(null, 'admin_login.php');
}
}
}
示例5: delete
private function delete()
{
if (isset($_GET['id'])) {
$this->_model->id = $_GET['id'];
$this->_model->deleteComment() ? Tool::alertLocation('Succeed', PREV_URL) : Tool::alertBack('Fail');
} else {
Tool::alertBack("illegal operation");
}
}
示例6: Comment_Del
private function Comment_Del()
{
if (isset($_GET['id']) && $_GET['action'] == 'del') {
$this->model->id = $_GET['id'];
if ($this->model->Del_Comment()) {
Tool::alertLocation('刪除成功', PREV_URL);
}
}
}
示例7: add
private function add()
{
if (@$_POST['send'] == '新增管理員') {
$this->_model->admin_user = $_POST['admin_user'];
$this->_model->admin_pass = sha1($_POST['admin_pass']);
$this->_model->level = $_POST['level'];
$this->_model->addManage() ? Tool::alertLocation('添加成功', 'manage.php?action=list') : Tool::alertBack('添加失敗');
}
$this->_tpl->assign('add', true);
$this->_tpl->assign('title', '新增管理員');
}
示例8: Delete_Level
public function Delete_Level()
{
$this->id = $_GET['id'];
$sql_delete = "delete from manage_level where id='{$this->id}' limit 1";
$affected_rows = parent::add_up_de($sql_delete);
if ($affected_rows == 1) {
Tool::alertLocation('刪除成功', 'level.php?action=show');
} else {
Tool::alertBack('刪除失敗');
}
}
示例9: delete
private function delete()
{
if (isset($_GET['id'])) {
$this->_model->id = $_GET['id'];
$_manage = new ManageModel();
$_manage->level = $this->_model->id;
if ($_manage->getOneManage()) {
Tool::alertBack('this level could not be deleted. please delete user first');
}
$this->_model->deleteLevel() ? Tool::alertLocation('Succeed', PREV_URL) : Tool::alertBack('Fail');
} else {
Tool::alertBack("illegal operation");
}
}
示例10: delCache
private function delCache()
{
$_dir = ROOT_PATH . '/cache/';
if (!($_dh = @opendir($_dir))) {
return;
}
while (false !== ($_obj = readdir($_dh))) {
if ($_obj == '.' || $_obj == '..') {
continue;
}
@unlink($_dir . '/' . $_obj);
}
closedir($_dh);
Tool::alertLocation('succeed', 'main.php');
}
示例11: setCount
private function setCount()
{
if (isset($_POST['send'])) {
if (empty($_POST['vote'])) {
Tool::alertClose('警告:請選擇一個投票項目!');
}
if ($_COOKIE['ip'] == $_SERVER["REMOTE_ADDR"]) {
if (time() - $_COOKIE['time'] < 86400) {
Tool::alertLocation('警告:您已經參與了本投票,請不要重複投票!', 'cast.php');
}
}
$this->_model->id = $_POST['vote'];
$this->_model->setCount();
setcookie('ip', $_SERVER["REMOTE_ADDR"]);
setcookie('time', time());
Tool::alertLocation('恭喜,累計投票成功,感謝您的參與!', 'cast.php');
}
}
示例12: login
public function login()
{
if (isset($_POST['send'])) {
if (Validate::checkLength($_POST['code'], 4, 'equals')) {
Tool::alertBack('validation code must be 4');
}
if (Validate::checkEquals(strtolower($_POST['code']), $_SESSION['code'])) {
Tool::alertBack('wrong validation code');
}
if (Validate::checkNull($_POST['admin_user'])) {
Tool::alertBack('username empty');
}
if (Validate::checkLength($_POST['admin_user'], 2, 'min')) {
Tool::alertBack('username less than 2');
}
if (Validate::checkLength($_POST['admin_user'], 20, 'max')) {
Tool::alertBack('username more than 20');
}
if (Validate::checkNull($_POST['admin_pass'])) {
Tool::alertBack('password empty');
}
if (Validate::checkLength($_POST['admin_pass'], 6, 'min')) {
Tool::alertBack('password less than 6');
}
$this->_model->admin_user = $_POST['admin_user'];
$this->_model->admin_pass = md5($_POST['admin_pass']);
$_login = $this->_model->getLoginManage();
if ($_login) {
$_SESSION['admin']['admin_user'] = $_login->admin_user;
$_SESSION['admin']['level_name'] = $_login->level_name;
Tool::alertLocation(null, 'admin.php');
} else {
Tool::alertBack('username or password not right');
}
}
}
示例13: delete
private function delete()
{
if (isset($_GET['id'])) {
$this->_model->id = $_GET['id'];
$this->_model->deleteNav() ? Tool::alertLocation('succeed', PREV_URL) : Tool::alertBack('fail');
} else {
Tool::alertBack('illegal act');
}
}
示例14: Action
public function Action()
{
global $templates;
switch ($_GET['action']) {
case 'show':
$templates->assgin('title', '文檔列表');
$templates->assgin('show', true);
$nav = new NavModel();
$id = $nav->Get_All_Childid();
foreach ($id as $value) {
$arr[] = $value->id;
}
$nav_id = implode(',', $arr);
$content = new ContentModel();
$content->nav = $nav_id;
$templates->assgin('Show_Content', $content->Get_Content());
//顯示所有的content
$this->Nav();
//顯示所有的導航,select標簽
if (isset($_GET['nav']) && $_GET['send'] == '刷選') {
//開始刷選
if ($_GET['nav'] != 0) {
//不為零
$content->nav = $_GET['nav'];
} else {
$content->nav = $nav_id;
//為零的話,默認全部
}
$templates->assgin('Show_Content', $content->Get_Content());
//顯示所有的content
}
break;
case 'update':
if ($_POST['send'] == '修改文檔') {
$this->model->id = $_POST['id'];
$this->Get_Post();
$this->model->Update_Content() ? Tool::alertLocation('文檔修改成功', 'content.php?action=show') : Tool::alertBack('文檔修改失敗');
}
$templates->assgin('title', '修改文檔');
$templates->assgin('update', true);
if (isset($_GET['id'])) {
$content = new ContentModel();
$content->id = $_GET['id'];
$object = $content->Get_One_Content();
if (!$object) {
Tool::alertBack('文檔不存在');
}
$templates->assgin('titlec', $object->title);
$this->attr($object->attr);
$this->Nav($object->nav);
$this->readlimit($object->read_limit);
$this->color($object->color);
$this->sort($object->sort);
$this->commend($object->commend);
$templates->assgin('id', $object->id);
$templates->assgin('tag', $object->tag);
$templates->assgin('keyword', $object->keyword);
$templates->assgin('thumbnail', $object->thumbnail);
$templates->assgin('source', $object->source);
$templates->assgin('author', $object->author);
$templates->assgin('info', $object->info);
$templates->assgin('content', $object->content);
$templates->assgin('read_count', $object->read_count);
$templates->assgin('gold', $object->gold);
$templates->assgin('color', $object->color);
} else {
Tool::alertBack('非法操作');
}
break;
case 'add':
if (isset($_POST['send'])) {
$this->Get_Post();
$affect = $this->model->Add_Content();
if ($affect == 1) {
Tool::alertLocation('添加文檔成功', '?action=show');
} else {
Tool::alertBack('警告:文檔添加失敗');
}
}
$templates->assgin('title', '新增文檔');
$templates->assgin('add', true);
$this->Nav();
break;
case 'delete':
if (isset($_GET['id'])) {
$this->model->id = $_GET['id'];
$this->model->Delete_Content() ? Tool::alertLocation('文檔刪除成功', 'content.php?action=show') : Tool::alertBack('文檔刪除失敗');
}
break;
default:
echo '非法操作';
break;
}
}
示例15: login
public function login()
{
if (isset($_POST['send'])) {
parent::__construct($this->_tpl, new UserModel());
if (Validate::checkNull($_POST['user'])) {
Tool::alertBack('警告:用戶名不得為空!');
}
if (Validate::checkLength($_POST['user'], 2, 'min')) {
Tool::alertBack('警告:用戶名長度不得小於兩位!');
}
if (Validate::checkLength($_POST['user'], 20, 'max')) {
Tool::alertBack('警告:用戶名長度不得大於二十位!');
}
if (Validate::checkLength($_POST['pass'], 6, 'min')) {
Tool::alertBack('警告:密碼不得小於六位!');
}
if (Validate::checkLength($_POST['code'], 4, 'equals')) {
Tool::alertBack('警告:驗證碼必須是四位!');
}
if (Validate::checkEquals(strtolower($_POST['code']), $_SESSION['code'])) {
Tool::alertBack('警告:驗證碼不正確!');
}
$this->_model->user = $_POST['user'];
$this->_model->pass = sha1($_POST['pass']);
if (!!($_user = $this->_model->checkLogin())) {
$_cookie = new Cookie('user', $_user->user, $_POST['time']);
$_cookie->setCookie();
$_cookie = new Cookie('face', $_user->face, $_POST['time']);
$_cookie->setCookie();
$this->_model->id = $_user->id;
$this->_model->time = time();
$this->_model->setLaterUser();
Tool::alertLocation(null, './');
} else {
Tool::alertBack('警告:用戶名或密碼錯誤!');
}
}
$this->_tpl->assign('login', true);
}