本文整理匯總了PHP中sys::alert方法的典型用法代碼示例。如果您正苦於以下問題:PHP sys::alert方法的具體用法?PHP sys::alert怎麽用?PHP sys::alert使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sys
的用法示例。
在下文中一共展示了sys::alert方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: date
* 負責處理新發表文章的邏輯
* Createed By C860 at 2014-1-19
*/
if (!class_exists('sys')) {
include_once '../conf/config.php';
}
//需要登錄
sys::needLog('../login.php');
//檢測數據合法性
if (isset($_POST['title']) && !empty($_POST['title']) && isset($_POST['content']) && !empty($_POST['content']) && isset($_POST['tags']) && !empty($_POST['tags'])) {
//引入相關模型類
include_once '../Models/article.php';
include_once '../Models/tag_relate_article.php';
include_once '../Models/user_info.php';
$currentTime = date('Y-m-d H:i:s');
//新增文章
if (article::add($_POST['title'], $_POST['content'], $currentTime, $_SESSION['userId'])) {
$ID = article::getId($_POST['title'], $_SESSION['userId'], $currentTime);
$tags = explode('|', $_POST['tags']);
foreach ($tags as $tag) {
tag_relate_article::add($tag, $ID);
}
user_info::increaseArticleCount($_SESSION['userId']);
sys::alert('發表成功!');
sys::redirect('../index.php');
}
} else {
//引入相關模型類
include_once 'Models/tag.php';
$taglist = tag::getAllTags();
}
示例2:
<?php
/*
* back_login.php
* 負責後台登錄邏輯
* Created By C860 at 2014-1-22
*/
include_once '../conf/config.php';
//引入相關模型類
include_once '../Models/user_basic.php';
//檢查數據合法性
if (isset($_POST['user']) && !empty($_POST['user']) && isset($_POST['password']) && !empty($_POST['password'])) {
if (user_basic::check($_POST['user'], $_POST['password'], 1)) {
$_SESSION['admin'] = user_basic::getUserId($_POST['user']);
sys::redirect('../back/main.php');
} else {
sys::alert('error!');
sys::redirect('../back/index.php');
}
}
示例3:
if (slider::add($_POST['weight'], $_POST['link'], $_POST['title'], $_POST['img'])) {
sys::alert('添加成功!');
} else {
sys::alert('出現未知錯誤!');
}
sys::redirect('../back/sliderControl.php');
}
} else {
if ($_POST['type'] == 'modify') {
if (isset($_POST['weight']) && is_numeric($_POST['weight']) && isset($_POST['title']) && !empty($_POST['title']) && isset($_POST['link']) && !empty($_POST['link']) && isset($_POST['img']) && !empty($_POST['img']) && isset($_POST['ID']) && is_numeric($_POST['ID'])) {
if (slider::update($_POST['ID'], $_POST['weight'], $_POST['link'], $_POST['title'], $_POST['img'])) {
sys::alert('修改成功!');
} else {
sys::alert('出現未知錯誤!');
}
sys::redirect('../back/sliderControl.php');
}
}
}
} else {
if (isset($_GET['type']) && $_GET['type'] == 'delete') {
if (isset($_GET['id']) && is_numeric($_GET['id'])) {
if (slider::delete($_GET['id'])) {
sys::alert('刪除成功!');
} else {
sys::alert('出現未知錯誤!');
}
sys::redirect('../back/sliderControl.php');
}
}
}
示例4: paging
include_once '../conf/config.php';
//需要管理員權限
sys::needAdmin('index.php');
//引入相關模型類
include_once '../Models/user_basic.php';
/*
* paging方法
* 獲取用戶信息並分頁
* @author C860
* @param $perpage int 每頁顯示條數
* @return array
*/
function paging($perpage)
{
if (!isset($_GET['page']) || !is_numeric($_GET['page'])) {
$curpage = 1;
} else {
$curpage = $_GET['page'];
}
$rs = user_basic::getTotalInfo($perpage, $curpage);
return $rs;
}
//設置或取消管理員權限
if (isset($_GET['uid'])) {
if (user_basic::setIsAdmin($_GET['uid'])) {
sys::alert('操作成功!');
sys::redirect('../back/userControl.php');
} else {
alert('操作失敗!');
}
}
示例5:
<?php
/*
* removeArticle.php
* 負責刪除文章邏輯
* Created By C860 at 2014-2-28
*/
include_once '../conf/config.php';
//引入相關模型類
include_once '../Models/article.php';
include_once '../Models/user_info.php';
//檢驗數據合法性
if (isset($_GET['id']) && is_numeric($_GET['id'])) {
$id = $_GET['id'];
$article = article::getArticle($id);
if (sys::hasLogged() && $article != false && $_SESSION['userId'] == $article['user_id']) {
if (article::removeArticle($id)) {
sys::alert('刪除成功!');
sys::redirect('../index.php');
}
} else {
sys::redirect('../index.php');
}
}
示例6:
<?php
/*
* checkLog.php
* 用戶登錄檢測程序
* Created By C860 at 2014-1-18
*/
include_once '../conf/config.php';
//引入相關模型類
include_once '../Models/user_basic.php';
include_once '../Models/user_info.php';
//檢測數據合法性
if (isset($_POST['user']) && !empty($_POST['user']) && isset($_POST['password']) && !empty($_POST['password'])) {
if (user_basic::check($_POST['user'], $_POST['password'], 0)) {
$uid = user_basic::getUserId($_POST['user']);
$nickname = user_info::getNickname($uid);
//設置SESSION
$_SESSION['userId'] = $uid;
$_SESSION['user'] = $_POST['user'];
$_SESSION['nickname'] = $nickname;
sys::redirect('../index.php');
} else {
sys::alert('用戶名或密碼錯誤!');
sys::redirect('../login.php');
}
}
示例7: sys_process_session_request
function sys_process_session_request()
{
if (!empty($_REQUEST["popup"]) and !empty($_REQUEST["iframe"])) {
unset($_REQUEST["iframe"]);
}
if (!empty($_REQUEST["iframe"])) {
sys::$smarty->assign("iframe", 1);
}
$keep_vars = array("popup", "preview", "lookup", "eto");
foreach ($keep_vars as $var) {
if (empty($_REQUEST[$var])) {
continue;
}
sys::$urladdon .= "&" . $var . "=" . $_REQUEST[$var];
sys::$smarty->assign($var, $_REQUEST[$var]);
}
$_SESSION["view"]["_" . $GLOBALS["tfolder"]] = $GLOBALS["tview"];
sys::$urladdon = "folder2=" . rawurlencode($GLOBALS["tfolder"]) . "&view2=" . $GLOBALS["tview"] . sys::$urladdon;
sys::$smarty->assign("urladdon", sys::$urladdon);
if (!empty($_REQUEST["action_sys"]) and !empty($_SESSION["username"]) and sys_is_super_admin($_SESSION["username"])) {
admin::process_action_sys();
}
if (!empty($_REQUEST["style"])) {
$_SESSION["theme"] = basename($_REQUEST["style"]);
}
sys::$smarty->assign("sys_style", !empty($_SESSION["theme"]) ? $_SESSION["theme"] : DEFAULT_STYLE);
$table = $GLOBALS["table"];
if ($GLOBALS["tview"] != $table["view"]) {
$GLOBALS["tview"] = $table["view"];
}
$tview = $GLOBALS["tview"];
$tfolder = $GLOBALS["tfolder"];
$tfolders = $GLOBALS["tfolders"];
$tname = $GLOBALS["tname"];
$tquota = $GLOBALS["tquota"];
$anchor = $GLOBALS["sel_folder"]["anchor"];
if (!empty($_REQUEST["reset_view"])) {
$_SESSION[$tname][$tview] = array();
$_SESSION["_" . $tfolder] = array();
$_SESSION["view"]["_" . $tfolder] = $tview;
$_SESSION[$tname]["_" . $tfolder] = array();
}
$current_view = $table["views"][$tview];
$cview = $current_view;
$template = $tview;
if ($current_view["TEMPLATE"] != "") {
$template = $current_view["TEMPLATE"];
}
if (isset($current_view["SCHEMA"]) and $current_view["SCHEMA"] != "") {
$table2 = db_get_schema(sys_find_module($current_view["SCHEMA"]));
$current_view = array_shift($table2["views"]);
// preserve in search, override for schema=x
if (!empty($table["att"]["SQL_HANDLER"]) and empty($current_view["SQL_HANDLER"])) {
$current_view["SQL_HANDLER"] = $table["att"]["SQL_HANDLER"];
}
$GLOBALS["table"] = $table2;
// needed for asset-functions and triggers
$table["att"] = $table2["att"];
if ($current_view["TEMPLATE"] != "") {
$template = $current_view["TEMPLATE"];
}
}
$GLOBALS["current_view"] = $current_view;
$field_names = array();
foreach ($current_view["fields"] as $key => $field) {
if (isset($field["NODB"]) and empty($current_view["SQL_HANDLER"])) {
continue;
}
$field_names[] = $key;
}
if (!empty($_SESSION["alert"])) {
sys::$alert = array_merge(sys::$alert, $_SESSION["alert"]);
$_SESSION["alert"] = array();
}
if (!empty($_SESSION["notification"])) {
sys::$notification = array_merge(sys::$notification, $_SESSION["notification"]);
$_SESSION["notification"] = array();
}
if (!empty($_SESSION["warning"])) {
sys::$warning = array_merge(sys::$warning, $_SESSION["warning"]);
$_SESSION["warning"] = array();
}
if ($table["views"][$tview]["SCHEMA_MODE"] != "") {
$tfolders = _build_merge_folders(array_keys($tfolders), $tfolder, $tview, true);
}
$dclick = $current_view["DOUBLECLICK"];
if ($dclick == "") {
if (in_array($template, array("display", "free")) and isset($current_view["views"]["details"])) {
$dclick = "details";
} else {
$dclick = "edit";
}
}
if (isset($current_view["MERGE_TABS"])) {
unset($current_view["tabs"]);
foreach (array_keys($current_view["fields"]) as $key) {
$current_view["fields"][$key]["SIMPLE_TAB"] = array("general");
}
}
$tfield_1 = isset($current_view["TFIELD_1"]) ? $current_view["TFIELD_1"] : modify::get_required_field($current_view["fields"]);
//.........這裏部分代碼省略.........
示例8:
<?php
/*
* changePWD.php
* 負責處理修改密碼的邏輯
* Created By C860 at 2014-1-20
*/
include_once '../conf/config.php';
//引入相關模型類
include_once '../Models/user_basic.php';
//檢測數據合法性
if (isset($_POST['oldpwd']) && !empty($_POST['oldpwd']) && isset($_POST['newpwd']) && !empty($_POST['newpwd'])) {
//檢測舊密碼是否正確
if (user_basic::check($_SESSION['user'], $_POST['oldpwd'], 0)) {
//替換舊密碼為新密碼
if (user_basic::changePassword($_SESSION['userId'], $_POST['newpwd'])) {
sys::alert('修改密碼成功!請重新登錄!');
sys::logout();
sys::redirect('../login.php');
}
}
}
示例9:
<?php
/*
* article.php
* 負責文章顯示頁麵的邏輯
* Created By C860 at 2014-2-7
*/
include_once 'conf/config.php';
//引入相關模型類
include_once 'Models/article.php';
include_once 'Models/user_info.php';
//檢驗數據合法性
if (isset($_GET['id']) && is_numeric($_GET['id'])) {
$id = $_GET['id'];
$article = article::getArticle($id);
$author = user_info::getNickname($article['user_id']);
if (!$article || !$author) {
sys::alert('未知錯誤!');
sys::redirect('index.php');
}
}