本文整理汇总了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);
}