function checkLogined() { if ($_SESSION['username'] == "" && $_COOKIE['username'] == "") { alertMes("您还没有登录,请先登录", "index.php?c=list&cs=kehu&login"); return false; } }
/** * 检查是否有登陆 */ function checkLogined() { $SAID = @$_SESSION['adminId']; $CAID = @$_COOKIE['adminId']; if ($SAID == "" && $CAID == "") { alertMes("请先登陆", "login.php"); } }
function addOrder() { $arr = $_POST; $arr['user_id'] = $_SESSION['user_id']; $arr['oDate'] = date('Y-m-d'); if ($arr['oName'] == '' && $arr['oPrice'] == '' && $arr['oQuantity'] == '' && $arr['oUnit'] == '') { echo "<script>alert('请填写完整信息');</script>"; } else { $res = insert("tpexpress_order", $arr); //echo "<img src='images/default/check.png' class='check-icon'></img>"; alertMes('商品订单添加成功', 'order.php'); } }
function checkLogined() { // if((!isset($_SESSION['adminId']))){ // alertMes("Login first!", "login.php"); // } // To check whether _SESSION or _COOKIE has been defined if (!isset($_SESSION['adminId']) && !isset($_COOKIE['adminId'])) { alertMes("请先登录!", "login.php"); } if (@$_SESSION['adminId'] == "" && $_COOKIE['adminId'] == "") { alertMes("请先登录!", "login.php"); } }
/** *删除分类 * @param string $where * @return string */ function delCate($id) { $res = checkProExist($id); if (!$res) { $where = "type_id=" . $id; if (delete("tigris_user_type", $where)) { $mes = "Deleted success!<br/><a href='listCate.php'>View list</a>|<a href='addCate.php'>Add user type</a>"; } else { $mes = "Deleted failed!<br/><a href='listCate.php'>View list</a>"; } return $mes; } else { alertMes("Can't delelte, please delete the content in the cate first!", "listPro.php"); } }
/** *删除分类 * @param string $where * @return string */ function delCate($id) { $res = checkProExist($id); if (!$res) { $where = "id=" . $id; if (delete("imooc_cate", $where)) { $mes = "分类删除成功!<br/><a href='listCate.php'>查看分类</a>|<a href='addCate.php'>添加分类</a>"; } else { $mes = "删除失败!<br/><a href='listCate.php'>请重新操作</a>"; } return $mes; } else { alertMes("不能删除分类,请先删除该分类下的商品", "listPro.php"); } }
/** *图片水印 * @param int $id * @return string */ function doWaterPic($id) { $rows = getProImgsById($id); if ($rows) { foreach ($rows as $row) { $filename = "../image_800/" . $row['albumPath']; waterPic($filename); /* waterPic() --image.func.php 图片水印*/ } //$mes="操作成功"; alertMes("添加图片水印成功!", "listProImages.php"); } else { alertMes("添加图片水印失败!", "listProImages.php"); } return $mes; }
public function checkUser() { $username = I('post.userName'); $pwd = I('post.passWord'); $autoLogin = I('post.remember_me'); $ica = M("ica_admin"); //查询数据库 $result = $ica->where("admin = '{$username}' AND password = '******'")->find(); if ($result == null || $result == FALSE) { alertMes("用户名或密码错误!请重新登录", C('ADMIN_PATH') . "/login"); } else { if ($autoLogin == !null) { cookie("adminId", $result['id'], 7 * 24 * 3600); cookie("adminName", $result['name'], 7 * 24 * 3600); } session('adminName', $result['name']); session('adminId', $result['id']); alertMes("登录成功!", C('ADMIN_PATH')); } }
<?php require_once '../include.php'; checkLogined(); $rows = getAllProv(); if (!$rows) { alertMes("没有相应省份,请先添加省份!!", "addProv.php"); } $rows_city = getAllCity(); if (!$rows_city) { alertMes("没有相应城市,请先添加城市!!", "addCity.php"); } ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>-.-</title> <link href="./styles/global.css" rel="stylesheet" type="text/css" media="all" /> <script type="text/javascript" charset="utf-8" src="../plugins/kindeditor/kindeditor.js"></script> <script type="text/javascript" charset="utf-8" src="../plugins/kindeditor/lang/zh_CN.js"></script> <script type="text/javascript" src="./scripts/jquery-1.6.4.js"></script> <script> KindEditor.ready(function(K) { window.editor = K.create('#editor_id'); }); $(document).ready(function(){ $("#selectFileBtn").click(function(){ $fileField = $('<input type="file" name="thumbs[]"/>'); $fileField.hide();
\t将文件剪切到:<input type="text" name="dstname" placeholder="将文件剪切到"/> \t<input type="hidden" name="path" value="{$path}" /> \t<input type='hidden' name='filename' value='{$filename}' /> \t<input type="submit" value="剪切文件"/> \t</form> EOF; echo $str; } elseif ($act == "doCutFile") { $dstname = $_REQUEST['dstname']; $mes = cutFile($filename, $path . "/" . $dstname); alertMes($mes, $redirect); } elseif ($act == "上传文件") { //print_r($_FILES); $fileInfo = $_FILES['myFile']; $mes = uploadFile($fileInfo, $path); alertMes($mes, $redirect); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Insert title here</title> <link rel="stylesheet" href="cikonss.css" /> <script src="jquery-ui/js/jquery-1.10.2.js"></script> <script src="jquery-ui/js/jquery-ui-1.10.4.custom.js"></script> <script src="jquery-ui/js/jquery-ui-1.10.4.custom.min.js"></script> <link rel="stylesheet" href="jquery-ui/css/ui-lightness/jquery-ui-1.10.4.custom.css" type="text/css"/> <style type="text/css"> body,p,div,ul,ol,table,dl,dd,dt{ margin:0;
<?php require_once '../include.php'; $username = $_POST['username']; $password = $_POST['password']; $verify = $_POST['verify']; $verify1 = $_SESSION['verify2']; if ($verify == $verify1) { $sql = "select * from imooc_admin where username='******' password='******'"; $row = checkAdmin($sql); if ($row) { alertMes("登陆成功", "../index.php"); } else { alertMes("登陆失败,密码错误", "login.php"); } } else { alertMes("登陆失败,重新登录", "login.php"); }
function udelImg($album_id, $img_path) { $sql = "delete from tg_house_img where album_id = {$album_id} and img_path='{$img_path}'"; $res = mysql_query($sql); if ($res) { header('location: edit-profile.php'); } else { alertMes('Delete failed!', 'edit-profile.php'); } }
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>新增用户</title> </head> <body> <?php error_reporting(0); require_once 'commonfunc.php'; $url = 'index.php'; $Username = $_POST['Username']; $Sex = $_POST['Sex']; $Phonenumber = $_POST['Phonenumber']; $Userlevel = $_POST['Userlevel']; $dbc = mysqli_connect('localhost', 'root', '6581526', 'mms_t') or die('数据插入失败,请重新插入'); $query = "INSERT INTO userinfo ( Username,Sex,Phonenumber,Userlevel ) Values ('{$Username}','{$Sex}','{$Phonenumber}','Userlevel')"; $res = mysqli_query($dbc, $query) or die('数据插入失败,请重新插入'); if ($res) { $mes = '添加成功'; } else { $mes = '添加失败'; } alertMes($mes, $url); mysqli_close($dbc); ?> </body> </html>
<?php require_once '../include.php'; $username = $_POST['username']; $password = md5($_POST['password']); $verify = $_POST['verify']; $verify1 = $_SESSION['verify']; $autoFlag = isset($_POST['autoFlag']) ? $_POST['autoFlag'] : ''; if ($verify == $verify1) { $sql = "select * from imooc_admin where username='******' and password='******'"; $res = checkAdmin($sql); if ($res) { if ($autoFlag) { setcookie("adminId", $row['id'], time() + 7 * 24 * 3600); setcookie("adminName", $res['username'], time() + 7 * 24 * 3600); } $_SESSION['adminName'] = $res['username']; $_SESSION['adminId'] = $res['id']; header("location:index.php"); } else { alertMes("登陆失败,重新登陆", "login.php"); } } else { alertMes("验证码错误", "login.php"); }
//$sql="select * from admin"; //$totalRows=getResultNum($sql); //$pageSize=2; //$totalPage=ceil($totalRows/$pageSize); //$pageSize=2; //$page=$_REQUEST['page']?(int)$_REQUEST['page']:1; //if($page<1||$page==null||!is_numeric($page)){ // $page=1; //} //if($page>=$totalPage)$page=$totalPage; //$offset=($page-1)*$pageSize; //$sql="select id,username,email from imooc_admin limit {$offset},{$pageSize}"; //$rows=fetchAll($sql); //$rows=getAllAdmin(); if (!$rows) { alertMes("sorry,没有管理员,请添加!", "addAdmin.php"); exit; } ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>管理员列表</title> <link rel="stylesheet" href="styles/backstage.css"> </head> <body> <div class="details"> <div class="details_operation clearfix"> <div class="bui_select">
$page = $_REQUEST['page'] ? (int) $_REQUEST['page'] : 1; $sql = "select * from tigris_user_type"; $totalRows = getResultNum($sql); $pageSize = 2; $totalPage = ceil($totalRows / $pageSize); if ($page < 1 || $page == null || !is_numeric($page)) { $page = 1; } if ($page >= $totalPage) { $page = $totalPage; } $offset = ($page - 1) * $pageSize; $sql = "select type_id,type from tigris_user_type order by type_id asc limit {$offset},{$pageSize}"; $rows = fetchAll($sql); if (!$rows) { alertMes("Please set user type first!", "addCate.php"); exit; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> <link rel="stylesheet" href="styles/backstage.css"> </head> <body> <div class="details"> <div class="details_operation clearfix"> <div class="bui_select"> <input type="button" value="Add" class="add" onclick="addCate()">
<?php include "mycon.php"; function alertMes($mes, $url) { echo "<script>alert('{$mes}');</script>"; echo "<script>window.location='{$url}';</script>"; } $sql = "delete from reader where rid='" . $_GET['id'] . "'"; $res = mysql_query($sql); if ($res) { alertMes("ɾ³ý¶ÁÕ߳¹¬", "index1?aa=¶Áµµ¹ÜÀí"); } else { alertMes("ɾ³ý¶ÁÕßʧ°Ü", "index1?aa=¶Áµµ¹ÜÀí"); }
<?php require_once '../houtai/include.php'; $name = $_POST['name']; $business = $_POST['position']; $phoneNumber = $_POST['phone']; $emailAddress = $_POST['email']; $application = $_POST['application']; $applicationReasons = $_POST['applicationReasions']; $array = array('name' => $name, 'phoneNumber' => $phoneNumber, 'application' => $application, 'emailAddress' => $emailAddress, 'applicationReasons' => $applicationReasons, 'business' => $business); $keys = "`" . join("`,`", array_keys($array)) . "`"; $vals = "'" . join("','", array_values($array)) . "'"; $sql = "INSERT INTO `biaodan`({$keys}) VALUES({$vals})"; //print_r($sql); if (mysql_query($sql)) { alertMes("提交成功", "index2.php"); } //INSERT INTO `biaodan`(`name`, `phoneNumber`, `application`, `emailAddress`, `applicationReasons`, `business`) VALUES (1,1,1,1,11,1) //INSERT INTO `biaodan`(`name`,`phoneNumber`,`application`,`emailAddress`,`applicationReasons`,`business`) VALUES(ASD ,ASD ,ASD ,ASD,ASDA,SD)
function checkLogined() { if (!isset($_SESSION['adminId']) && !isset($_COOKIE['adminId'])) { alertMes("请先登陆", "login.php"); } }
<?php require_once '../houtai/include.php'; $name = $_POST['name']; $email = $_POST['email']; $xing = $_POST['sex']; $phone = $_POST['phone']; $section = $_POST['section']; $position = $_POST['speciality']; $username = $_POST['username']; $password = md5($_POST['password']); $array = array('name' => $name, 'email' => $email, 'xing' => $xing, 'phone' => $phone, 'section' => $section, 'position' => $position, 'username' => $username, 'password' => $password); $keys = "`" . join("`,`", array_keys($array)) . "`"; $vals = "'" . join("','", array_values($array)) . "'"; $sql = "INSERT INTO `zhuce`({$keys}) VALUES({$vals})"; //print_r($sql); if (mysql_query($sql)) { alertMes("注册成功", "index1.php"); }
<?php require_once '../include.php'; $rows = getAllAdmin(); if (!$rows) { alertMes("sorry!没有管理员,请添加", "addAdmin.php"); exit; } ?> <!DOCTYPE html> <html> <head> <title>Insert title here</title> </head> <body> <input type="button" value="添 加" onclick="addAdmin()"> <table cellspacing='0' cellpadding='0' width='70%'> <thead bgcolor="#ccc"> <tr> <td width="15%">编号</td> <td width="25%">管理员名称</td> <td width='30%'>管理员邮箱</td> <td>操作</td> </tr> </thead> <tbody> <?php $i = 1; foreach ($rows as $row) { ?> <tr>
<?php require_once '../include.php'; checkLogined(); $rows = getAllCate(); if (!$rows) { alertMes("没有相应分类,请先添加分类!!", "addCate.php"); } ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>-.-</title> <link href="./styles/global.css" rel="stylesheet" type="text/css" media="all" /> <script type="text/javascript" charset="utf-8" src="../plugins/kindeditor/kindeditor.js"></script> <script type="text/javascript" charset="utf-8" src="../plugins/kindeditor/lang/zh_CN.js"></script> <script type="text/javascript" src="./scripts/jquery-1.6.4.js"></script> <script> KindEditor.ready(function(K) { window.editor = K.create('#editor_id'); }); $(document).ready(function(){ $("#selectFileBtn").click(function(){ $fileField = $('<input type="file" name="thumbs[]"/>'); $fileField.hide(); $("#attachList").append($fileField); $fileField.trigger("click"); $fileField.change(function(){ $path = $(this).val(); $filename = $path.substring($path.lastIndexOf("\\")+1);
} $id = $_REQUEST['id']; //接受传来的书单id $adminId = $_REQUEST['adminId']; //接收管理员用户ID $sql = "select booklistname from booklistname"; $booklistname = fetchOne($sql); //$sql = "select * from booklistname where listcode={$id}"; $sql = "select * from booklistname"; $totalRow = getResultRow($sql); if ($totalRow) { $sql = "select bookname,bookprice,discount,id from booklist where listcode={$id}"; $rows = fetchAll($sql); } else { $rows = array(); alertMes("没有书单信息!!请添加!!", "addBookList.php"); } ?> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>星购书</title> <link rel="stylesheet" type="text/css" href="css/reset.css" /> <link rel="stylesheet" type="text/css" href="css/addBookList.css" /> </head> <body> <div class="header"> <div class="header_con">
<?php require_once "../include.php"; //要分页时调用以下函数 $pageSize = 2; $page = $_REQUEST['page'] ? (int) $_REQUEST['page'] : 1; $rows = getAdminByPage($page, $pageSize); //不用分页时,调用以下函数 //$rows = getAllAdmin(); //判断是否有管理员存在,若没有则跳转到addAdmin.php中,并执行exit退出本页面 if (!$rows) { alertMes("sorry,没有管理员,请添加!", "addAdmin.php"); exit; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> <link rel="stylesheet" href="styles/backstage.css"> </head> <body> <div class="details"> <div class="details_operation clearfix"> <div class="bui_select"> <input type="button" value="添 加" class="add" onclick="addAdmin()"> </div> </div>
<?php require_once '../include.php'; $email = addslashes($_POST['email']); $password = sha1($_POST['password']); $sql = "select * from tg_admin where email='{$email}' and password='******'"; $row = checkAdmin($sql); //var_dump($row); if ($row) { $_SESSION['email'] = $row['email']; $_SESSION['admin_id'] = $row['admin_id']; //alertMes("Login success!","index.php"); header("location:index.php"); } else { alertMes("Login failed~ Please enter username and password", "login.php"); }
function checkLogined() { if ($_SESSION['adminId'] == "" && $_COOKIE['adminId'] == "") { alertMes("请先登录", "login.php"); } }
@($page = $_REQUEST['page'] ? (int) $_REQUEST['page'] : 1); // “@”表示:即使有错误也不要输出,不过我们之前的warning是notice类型,所以无所谓 $sql = "select * from biogas_city"; $totalRows = getResultNum($sql); $totalPage = ceil($totalRows / $pageSize); if ($page < 1 || $page == null || !is_numeric($page)) { $page = 1; } if ($page >= $totalPage) { $page = $totalPage; } $offset = ($page - 1) * $pageSize; $sql = "select id,city from biogas_city order by id asc limit {$offset},{$pageSize}"; $rows = fetchAll($sql); if (!$rows) { alertMes("对不起, 没有城市, 请先添加!", "addCity.php"); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> <link rel="stylesheet" href="styles/backstage.css"> </head> <body> <div class="details"> <div class="details_operation clearfix"> <div class="bui_select"> <input type="button" value="添 加" class="add" onclick="addCity()">
$page = $_REQUEST['page'] ? (int) $_REQUEST['page'] : 1; $sql = "select * from imooc_cate"; $totalRows = getResultNum($sql); $pageSize = 2; $totalPage = ceil($totalRows / $pageSize); if ($page < 1 || $page == null || !is_numeric($page)) { $page = 1; } if ($page >= $totalPage) { $page = $totalPage; } $offset = ($page - 1) * $pageSize; $sql = "select id,cName from imooc_cate order by id asc limit {$offset},{$pageSize}"; $rows = fetchAll($sql); if (!$rows) { alertMes("sorry,没有分类,请添加!", "addCate.php"); exit; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> <link rel="stylesheet" href="styles/backstage.css"> </head> <body> <div class="details"> <div class="details_operation clearfix"> <div class="bui_select"> <input type="button" value="添 加" class="add" onclick="addCate()">
<?php require_once '../houtai/include.php'; $name = $_POST['name']; $business = $_POST['position']; $phoneNumber = $_POST['phone']; $emailAddress = $_POST['email']; $application = $_POST['application']; $applicationReasons = $_POST['applicationReasions']; $array = array('name' => $name, 'phoneNumber' => $phoneNumber, 'application' => $application, 'emailAddress' => $emailAddress, 'applicationReasons' => $applicationReasons, 'business' => $business); $keys = "`" . join("`,`", array_keys($array)) . "`"; $vals = "'" . join("','", array_values($array)) . "'"; $sql = "INSERT INTO `biaodan`({$keys}) VALUES({$vals})"; //print_r($sql); if (mysql_query($sql)) { alertMes("提交成功", "application.php"); } //INSERT INTO `biaodan`(`name`, `phoneNumber`, `application`, `emailAddress`, `applicationReasons`, `business`) VALUES (1,1,1,1,11,1) //INSERT INTO `biaodan`(`name`,`phoneNumber`,`application`,`emailAddress`,`applicationReasons`,`business`) VALUES(ASD ,ASD ,ASD ,ASD,ASDA,SD)
<?php require_once '../include.php'; checkLogined(); $sql = "select id,username,email,activeFlag from imooc_user"; $rows = fetchAll($sql); if (!$rows) { alertMes("sorry,没有用户,请添加!", "addUser.php"); exit; } ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>-.-</title> <link rel="stylesheet" href="styles/backstage.css"> </head> <body> <div class="details"> <div class="details_operation clearfix"> <div class="bui_select"> <input type="button" value="添 加" class="add" onclick="addAdmin()"> </div> </div> <!--表格--> <table class="table" cellspacing="0" cellpadding="0"> <thead> <tr>