File: //www/备份的/www.luckcjtw.com/admin_items.php
<?PHP
set_time_limit(0);
header('Content-Type: text/html; charset=UTF-8');
#加载系统配置文件 该文件只包含各种系统配置项
require "./include/config.h";
#加载公共函数 主要是一些工具函数
require "./include/functions.php";
#开启数据库连接
$db = tools::get_db();
$db_ = clone $db;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>獎品列表</title>
<style>
body {
margin:0px;text-align:center;
font-family:微软雅黑;font-size:25px;color:#000000;
}
input,select {
font-size:25px;
}
table, td{ border:1px solid #CCC; padding-top:4px; padding-bottom:4px;}
table{
border-collapse:collapse;
}
.button {
background-color: #4CAF50; /* Green */
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 26px;
cursor: pointer;
}
.btn1 {
margin:5px;
padding: 10px 10px;
font-size: 25px;
font-weight:bold;
}
.btn2 {
margin:2px;
padding: 5px 10px 5px 10px;
font-size: 23px;
}
.btn4 {
margin:2px;
padding: 5px 10px 5px 10px;
font-size: 23px;
background-color: red;
}
h2{line-height:30px; font-size:30px;}
a,a:hover{ text-decoration:none;}
pre{font-family:'微软雅黑'}
.box{width:100px; padding:10px 20px; background-color:#fff; margin:10px auto;}
.box a{padding-right:20px;}
</style>
<script src="js/jquery-3.5.1.min.js"></script>
<script type='text/javascript'>
$(document).ready(function(){
$("button#admin_items_add").click(function(data){
window.location.href = "./admin_items_edit.php?game_id=" + data.currentTarget.name;
});
$("button#admin_items_edit").click(function(data){
window.location.href = "./admin_items_edit.php?item_id=" + data.currentTarget.name;
});
$("button#admin_items_del").click(function(data){
var oConfirm = confirm("確認刪除?\n(提示:刪除後將不可恢復)");
if (oConfirm) {
$.post("./admin_items_edit.php",
{
action:"del",
item_id:data.currentTarget.name,
},
function(data,status){
alert("刪除成功");
//window.location.href = window.location.href + '&refresh=1';
window.location.reload()
});
}
});
$("button#admin_items").click(function(data){
window.location.href = "./admin_items.php?game_id=" + data.currentTarget.name;
});
$("button#admin_user").click(function(data){
window.location.href = "./admin_user.php?game_id=" + data.currentTarget.name;
});
$("button#back").click(function(data){
//history.go(-1);
window.location.href = "./admin_game.php";
});
});
</script>
</head>
<body>
<?PHP
//获取活动ID
$nGameId = (int)$_REQUEST["game_id"];
#获取 比赛信息
$sSql = "SELECT * FROM gift_items WHERE game_id = '".$nGameId."' ORDER BY item_id ASC";
$db->query( $sSql );
$sHtml = "<table align=center><tr><td colspan=5 style='font-size:30px;color:white;font-weight:bold;padding:10px;background-color:#4CAF50;'>獎品列表</td></tr>";
$sHtml .= "<tr><td colspan=5 style='font-size:30px;font-weight:bold;text-align:right;'><button type=button class='button btn1' id=admin_items_add name=".$nGameId.">新增獎品</button><button type=button class='button btn1' id=back>返回</button></div></td></tr>";
$sHtml .= "<tr style='font-size:25px;font-weight:bold;'><td width=100>獎品ID</td><td width=350>獎品內容</td><td width=120>固定獎品</td><td width=120>顯示順序</td><td width=200>操作</td></tr>";
$num = 0;
while( $row = $db->next_row() ) {
$sHtml .= "<tr>";
$sHtml .= "<td>".$row["item_id"]."</td>";
$sHtml .= "<td>".$row["item_name"]."</td>";
$sHtml .= "<td>".($row["is_force"]?"是":"-")."</td>";
$sHtml .= "<td>".$row["orderby"]."</td>";
$sHtml .= "<td>
<button type=button class='button btn2' id=admin_items_edit name=".$row["item_id"].">編輯</button>
<button type=button class='button btn4' id=admin_items_del name=".$row["item_id"].">刪除</button>
</td>";
$sHtml .= "</tr>";
}
$sHtml .= "</table>";
echo $sHtml;
?>
</body>
</html>