本文整理匯總了PHP中show_alert函數的典型用法代碼示例。如果您正苦於以下問題:PHP show_alert函數的具體用法?PHP show_alert怎麽用?PHP show_alert使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了show_alert函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: add
function add($product_id)
{
//Get the product using id
$product = $this->database->getProductbyId($product_id);
if ($product) {
$size = $this->input->post('size');
if ($size) {
$cart_item = array('id' => $product_id, 'qty' => '1', 'price' => $product['product_price'], 'name' => $product['product_name'], 'options' => array('Size' => $size));
$row_id = $this->cart->insert($cart_item);
}
}
show_alert($product['add_to_cart_comment']);
redirect('cart');
}
示例2: isset
//獲取表單提交的用戶名與密碼信息
$userName = isset($_POST['username']) ? $_POST['username'] : '';
$userPwd = isset($_POST['userpwd']) ? $_POST['userpwd'] : '';
//判斷用戶名和密碼是否為空
if ($userName == '') {
show_alert('用戶名不能為空!', '/login.php');
}
if ($userPwd == '') {
show_alert('密碼不能為空!', '/login.php');
}
//生成SQL語句,執行
$sql = "SELECT * FROM xw_users WHERE uname='{$userName}' AND pwd='{$userPwd}'";
$query = $db->query($sql);
$userInfo = $db->fetch_one($query);
if (empty($userInfo)) {
//沒有查找到記錄,說明用戶名密碼錯誤,提示
show_alert('用戶名或密碼不正確!', '/login.php');
}
//登錄成功,記錄已登錄標示,然後跳轉到首頁
$_SESSION['isLogin'] = true;
jump_url('/');
} else {
if ($action == 'logout') {
//執行退出操作
$_SESSION['isLogin'] = false;
jump_url('/');
} else {
//加載首頁模版
include APPPATH . '/tpl/login.tpl.php';
}
}
示例3: users
if (isset($_POST["cbxactive"])) {
$i = 1;
}
if (isset($_POST["cbxadmin"])) {
$j = 1;
}
$str = "insert into users(username,password,firstname,lastname,salutation,email,officeno,office,permission,active,deptid,sm)";
$str .= "values('" . $_POST["username"] . "','" . $_POST["password"] . "','" . ucfirst(strtolower($_POST["firstname"])) . "','" . ucfirst(strtolower($_POST["lastname"])) . "','" . $_POST["ddlsal"];
$str .= "','" . $_POST["email"] . "','" . $_POST["officeno"] . "','" . $_POST["office"];
$str .= "',{$j},{$i},1,'" . $_POST["ddlsm"] . "')";
echo $str;
$cnt = ExecuteNonQuery($str);
if ($cnt == 1) {
redirect_to("viewusers.php");
} else {
show_alert("Error in adding record..Please verify values");
}
}
} else {
if (count($errors) == 1) {
$message = "There was 1 error in the form.";
} else {
$message = "There were " . count($errors) . " errors in the form.";
}
}
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
示例4: show_alert
$userName = $_POST['username'];
$content = $_POST['content'];
if (empty($userName)) {
show_alert('昵稱不能為空!');
}
if (empty($content)) {
show_alert('內容不能為空!');
}
$sql = "INSERT INTO xw_comment (aid, username, comment, adddate) VALUES('{$aid}', '{$userName}', '{$content}', '" . time() . "')";
if ($db->query($sql)) {
show_alert('發表評論成功!', 'read.php?aid=' . $aid);
} else {
show_alert('發表評論失敗!');
}
}
$sql = "SELECT * FROM xw_article WHERE aid='{$aid}' LIMIT 1";
$query = $db->query($sql);
$articleInfo = $db->fetch_one($query);
if (empty($articleInfo)) {
//沒有查詢到指定的AID的文章內容
show_alert('文章查找失敗!');
}
//更新此文章的點擊量
$sql = "UPDATE xw_article SET clicks=clicks+1 WHERE aid='{$aid}'";
$db->query($sql);
//查找該文章的所有評論
$sql = "SELECT * FROM xw_comment WHERE aid='{$aid}'";
$query = $db->query($sql);
$commentInfo = $db->fetch_all($query);
//顯示修改文件的模版文件
include APPPATH . '/tpl/read.tpl.php';
示例5: ini_set
ini_set("display_errors", "off");
include "includes/connect/php";
include "includes/DataAccess.php";
include "includes/form_functions.php";
include "includes/functions.php";
include "includes/session.php";
if (!logged_in()) {
redirect_to("index.php");
}
if (isset($_POST['Submit'])) {
$errors = array();
$required_fields = array('username', 'firstname', 'lastname', 'email', 'office');
$errors = array_merge($errors, check_required_fields($required_fields, $_POST));
if (empty($errors)) {
if ($_POST["ddlsal"] == "") {
show_alert("Please select dropdown");
} else {
$i = 0;
$j = 0;
if (isset($_POST["cbxactive"])) {
$i = 1;
}
if (isset($_POST["cbxadmin"])) {
$j = 1;
}
$str = "update users set username='" . $_POST["username"] . "',firstname='" . $_POST["firstname"];
$str .= "',lastname='" . $_POST["lastname"] . "',salutation='" . $_POST["ddlsal"] . "',email='" . $_POST["email"] . "',officeno='" . $_POST["officeno"] . "',office='" . $_POST["office"] . "',permission={$j},active={$i},sm='" . $_POST["ddlsm"] . "' where uid=" . $_GET["id"];
echo $str;
ExecuteNonQuery($str);
redirect_to("viewusers.php");
}
示例6: conf
</h3>
<span><?php
echo conf('app.desc');
?>
</span>
</div>
<nav id="site-nav" class="clearfix">
<?php
echo app('main-menu')->nav('menu menu-h');
?>
<?php
echo app('user-menu')->nav('menu menu-h menu-right');
?>
</nav>
</header>
<div id="site-contents" class="clearfix">
<header id="content-header" class="clearfix">
<h3 id="page-title"><?php
echo $heading;
?>
</h3>
<?php
if (isset($toolbar)) {
echo '<nav id="page-tool" class="clearfix">' . $toolbar->nav('menu menu-h menu-tool') . '</nav>';
}
?>
</header>
<div id="content-main" class="clearfix">
<?php
echo show_alert();
示例7: substr
}
//有圖片上傳,則進行圖片上傳操作,保存圖片到指定目錄
if ($image['name'] != '') {
//上傳並保存圖片
$imageType = substr($image['name'], strrpos($image['name'], '.') + 1);
if (!in_array($imageType, $upload_type)) {
show_alert('上傳的文件類型不允許!', '');
}
$imageName = date('Y-m-dHis') . '.' . $imageType;
$imageUrl = $img_upload . $imageName;
if (!move_uploaded_file($image['tmp_name'], APPPATH . trim($imageUrl, '/'))) {
show_alert('圖片上傳失敗,請重試!', '');
}
} else {
$imageUrl = '';
}
//將文章記錄保存到數據庫
$title = addslashes($title);
$content = addslashes($content);
$sql = "INSERT INTO xw_article (`title`, `content`, `image`, adddate, editdate) VALUES(\n\t'{$title}', '{$content}', '{$imageUrl}', " . time() . ", " . time() . ")";
if ($db->query($sql)) {
//添加成功
$aid = $db->insert_id();
show_alert('文章添加成功!', '/read.php?aid=' . $aid);
} else {
//添加失敗
show_alert('文章添加失敗,請重試', '');
}
}
//顯示添加文章的模版界麵
include APPPATH . '/tpl/add_article.tpl.php';
示例8: ob_start
ob_start();
ini_set('display_errors', 'off');
require_once "includes/session.php";
include_once "includes/form_functions.php";
require_once "includes/functions.php";
include_once "includes/DataAccess.php";
if (!logged_in()) {
redirect_to("index.php");
}
if (isset($_POST["Submit"])) {
if ($_POST["ddlsem1"] != "") {
$_SESSION["statusincsem"] = $_POST["ddlsem1"];
redirect_to("statusindicator.php");
} else {
show_alert("Please select semester");
}
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Select Semester</title>
<link href="css/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="container">
示例9: ExecuteNonQuery
ExecuteNonQuery($str);
$str = "delete from catelog_temp where id=" . $_GET["id"];
ExecuteNonQuery($str);
redirect_to("viewcourses.php");
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
} else {
$str = "delete from catelog_temp where id=" . $_GET["id"];
$cnt = ExecuteNonQuery($str);
if ($cnt == 1) {
redirect_to("viewuacourses.php");
}
}
} else {
show_alert("Please select department");
}
} else {
}
} else {
if (count($errors) == 1) {
$message = "There was 1 error in the form.";
} else {
$message = "There were " . count($errors) . " errors in the form.";
}
}
}
?>
<!doctype html>
示例10: ExecuteNonQuery
}
if (isset($_POST["submit"])) {
if ($_POST["slctver"] != "") {
if ($_GET["flag"] == "1") {
$sql = "update fileinfo set active=0 where ftype='gmatrix'";
ExecuteNonQuery($sql);
$sql = "update fileinfo set active=1 where ftype='gmatrix' and version='" . $_POST["slctver"] . "'";
ExecuteNonQuery($sql);
} else {
$sql = "update fileinfo set active=0 where ftype='matrix'";
ExecuteNonQuery($sql);
$sql = "update fileinfo set active=1 where ftype='matrix' and version='" . $_POST["slctver"] . "'";
ExecuteNonQuery($sql);
}
$msg = "Version Activated";
show_alert($msg);
}
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Select Version</title>
<link href="css/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="container">
示例11: getcwd
$uploads_dir = getcwd() . '/csfu';
if (file_exists($uploads_dir . "/" . $filename)) {
unlink($uploads_dir . "/" . $filename);
}
$tmp_name = $_FILES["matrixfile"]["tmp_name"];
$name = $_FILES["matrixfile"]["name"];
$moveResult = copy($tmp_name, "{$uploads_dir}/" . $name);
if ($moveResult == true) {
// echo "File has been moved from " . $tmp_name . " to" . $name;
redirect_to("insertcsassigns.php");
} else {
echo "ERROR: File not moved correctly";
}
}
} else {
show_alert("Please select filename");
}
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Upload Live Excel File</title>
<link href="css/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="container">
示例12: htmlspecialchars
echo htmlspecialchars($str);
echo '");</script></body></html>';
}
session_start();
if (!isset($_SESSION['user'])) {
show_alert('Not logged in.');
exit;
}
require 'inc/database.php';
require 'inc/preferences.php';
require 'inc/lang_conf.php';
require 'inc/tgz.lib.php';
$pref = unserialize($_SESSION['pref']);
$now = time();
if ($now - $pref->backuptime < 604800) {
show_alert('You can only do this once a week!');
exit;
}
$archive = "backup-{$now}";
header('Content-type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . $archive . '.tar.gz"');
$fout = fopen('php://output', 'wb');
if ($fout === FALSE) {
exit;
}
$tar = new TGZfile($fout);
$pref->backuptime = $now;
$_SESSION['pref'] = serialize($pref);
$user = mysql_real_escape_string($_SESSION['user']);
mysql_query("insert into preferences(user_id,property,value) values ('{$user}','backuptime','{$now}') ON DUPLICATE KEY UPDATE value='{$now}'");
$res = mysql_query("SELECT problem_id,language,source FROM source_code , (SELECT max_sol,problem_id,language FROM solution, (SELECT max(solution_id) AS max_sol FROM solution WHERE user_id='{$user}' AND result=0 GROUP BY problem_id) last WHERE solution_id=max_sol) tmp WHERE source_code.solution_id=max_sol");
示例13: redirect_to
// echo $query;
if ($cnt > 0) {
redirect_to("retrivesurvey.php?msg=Survey updated successfully?flag=1");
} else {
redirect_to("retrivesurvey.php?msg=Error in updating survey?flag=2");
}
}
} else {
$name = GetSingleField("select subname from subject where subid=" . $subid, "subname");
show_alert("Please enter objective of '" . $name . "\\'");
}
} else {
show_alert("Subject selection same on both side");
}
} else {
show_alert("please select subject from both list");
}
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Course Assesment Survey</title>
<link href="css/menu.css" rel="stylesheet" type="text/css">
<script src="js/jquery-latest.min.js"></script>
<script type='text/javascript' src='js/menu_jquery.js'></script>
<link href="css/style.css" rel="stylesheet" type="text/css">
<script>
function showUser(str)
{
示例14: header
include_once 'linkstart.php';
if (!is_login()) {
header("location: login.php?action=err&mes=你需要登錄才能查看用戶信息!");
exit;
}
show_head('狀態信息');
echo '<!-- 導航條 -->';
show_bar();
echo '<!-- 導航條結束 -->
<!-- 主體部分 -->';
//print_r($user);
?>
<?php
echo '<div class="container">';
show_alert();
echo '</div>';
global $message;
if (!@$_GET['messageid']) {
header("location: messagelist.php?action=err&mes=信息不存在!");
exit;
}
$message = get_message_by_id($_GET['messageid']);
show_message($message);
?>
<!-- Bootstrap core JavaScript
示例15: show_form_error
function show_form_error()
{
$string = validation_errors();
return show_alert($string);
}