HEX
Server: nginx/1.28.1
System: Linux 10-41-63-61 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 x86_64
User: www (1001)
PHP: 7.4.33
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: //www/wwwroot/www.linghdl.com/admin_game_edit.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;


$sAction = trim($_REQUEST["action"]);

if ( $sAction == "save" ) {

    $aInfo = $_REQUEST["info"];

    #判断是否新增
    if ( $aInfo["game_id"] <= 0 ) {

        #新增活动信息
        $sSql = "INSERT INTO gift_game(game_name,game_bgimg,status) VALUES('".$aInfo["game_name"]."','".$aInfo["game_bgimg"]."','".$aInfo["status"]."')";
        if ( $db->query($sSql) ) {
            exit("success");
        }

    #修改活动内容
    } else {

        $sSql = "UPDATE gift_game SET game_name = '".$aInfo["game_name"]."',game_bgimg = '".$aInfo["game_bgimg"]."',status = '".$aInfo["status"]."' WHERE game_id = ".$aInfo["game_id"];
        if ( $db->query($sSql) ) {
            exit("success");
        }

    }


    exit("failed");

}


?>

<!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;
}

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_game_save").click(function(data){

        //console.log($("#admin_game_edit").serialize());

        $.ajax({
            type: "post",
            url:  "admin_game_edit.php?action=save",
            data: $("#admin_game_edit").serialize(),
            //dataType: "json",
            success: function(data) {
                alert("保存成功");
            },
            error: function(err) {
                alert("保存失败");
            }
        });

    });

    $("button#admin_game_add").click(function(data){
        window.location.href = "./admin_game_edit.php";
    });

    $("button#admin_game_edit").click(function(data){
        window.location.href = "./admin_game_edit.php?game_id=" + data.currentTarget.name;
    });

    $("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_game WHERE game_id = ".$nGameId;
    $db->query( $sSql );
    $aGameInfo = $db->next_row();

    $sHtml  = "<form id=admin_game_edit>";
    $sHtml .= "<table align=center><tr><td colspan=2 style='font-size:30px;color:white;font-weight:bold;padding:10px;background-color:#4CAF50;'>抽獎活動內容</td></tr>";
    $sHtml .= "<tr style='font-size:25px;font-weight:bold;'><td width=120>活動主題</td><td align=left>&nbsp;<input type=text name=info[game_name] value=".$aGameInfo[game_name]."></td></tr>";
    $sHtml .= "<tr style='font-size:25px;font-weight:bold;'><td>活動狀態</td><td align=left>&nbsp;<select name=info[status]><option value=1 ".($aGameInfo[status]?"selected":"").">進行</option><option value=0 ".(!$aGameInfo[status]&&$nGameId?"selected":"").">結束</option></select></td></tr>";
    $sHtml .= "<tr style='font-size:25px;font-weight:bold;'><td>背景圖片</td><td align=left style='font-size:22px;font-weight:normal;'>&nbsp;<input type=text name=info[game_bgimg] value=".$aGameInfo[game_bgimg]."><br>&nbsp;注:請手動將背景圖片上傳到服務器的【".$g_full_path."/img/】目錄下。</td></tr>";
    $sHtml .= "<tr style='font-size:25px;font-weight:bold;'><td>&nbsp;</td><td><button type=button class='button btn2' id=admin_game_save>保存</button> <button type=button class='button btn2' id=back>返回</button></td></tr>";
    $sHtml .= "</table><input type=hidden name=info[game_id] value=".$nGameId."></form>";

    echo $sHtml;

?>

</body>
</html>