One Hat Cyber Team
Your IP :
3.139.104.134
Server IP :
50.28.103.30
Server :
Linux host.jcukjv-lwsites.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
Server Software :
nginx/1.24.0
PHP Version :
8.3.12
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
www
/
wwwroot
/
sd.electronharmony.com
/
Edit File:
updatework.php
<?php session_start(); // Check if user is logged in, otherwise redirect to login page if (!isset($_SESSION['user_email'])) { header("Location: login.php"); exit(); } // Check if 'id' parameter is provided if (isset($_GET['id'])) { $id = $_GET['id']; // Database connection configuration $servername = "localhost"; $username = "t001"; $password = "ZRTsRb6Ycp585AEC"; $dbname = "t001"; // Create database connection $conn = new mysqli($servername, $username, $password, $dbname); // Check database connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } // Handle form submission if ($_SERVER['REQUEST_METHOD'] == 'POST') { // Get form data $mname = $_POST['mname']; $rest = $_POST['rest']; $startt = $_POST['startt']; $bs = $_POST['bs']; $cs = $_POST['cs']; $ds = $_POST['ds']; $es = $_POST['es']; $fs = $_POST['fs']; $endt = $_POST['endt']; $accomplish = $_POST['accomplish']; // Prepare update statement $sql = "UPDATE works SET mname=?, rest=?, startt=?, bs=?, cs=?, ds=?, es=?, fs=?, endt=?, accomplish=? WHERE id=?"; $stmt = $conn->prepare($sql); // Check if the statement was prepared successfully if ($stmt === false) { die("Error preparing statement: " . $conn->error); } // Bind parameters to the prepared statement if (!$stmt->bind_param("ssssssssssi", $mname, $rest, $startt, $bs, $cs, $ds, $es, $fs, $endt, $accomplish, $id)) { die("Error binding parameters: " . $stmt->error); } // Execute the update if ($stmt->execute()) { // Redirect to works list page after successful update header("Location: works.php"); exit(); } else { echo "Error updating data: " . $stmt->error; } // Close the statement $stmt->close(); } // Query to get the data of the work entry to be edited $sql = "SELECT * FROM works WHERE id=?"; $stmt = $conn->prepare($sql); // Bind parameters to the query statement if (!$stmt->bind_param("i", $id)) { die("Error binding parameters: " . $stmt->error); } // Execute the query if (!$stmt->execute()) { die("Error executing query: " . $stmt->error); } // Get the query result $result = $stmt->get_result(); // Check if there is a result if ($result->num_rows > 0) { // Get the first row data (should be only one row) $row = $result->fetch_assoc(); } else { die("No data found for id=$id"); } // Close the statement $stmt->close(); // Close the database connection $conn->close(); } else { die("No ID parameter provided."); } ?> <!DOCTYPE html> <html lang="zxx"> <head> <meta charset="utf-8" /> <meta http-equiv="x-ua-compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1.0 user-scalable=no" /> <meta name="description" content="Fully Responsive Admin & Dashboard Template" /> <meta name="keyword" content="" /> <meta name="author" content="WRAPCODERS" /> <!--! The above 6 meta tags *must* come first in the head; any other head content must come *after* these tags !--> <!--! BEGIN: Google Fonts !--> <link rel="preconnect" href="https://fonts.googleapis.com" /> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@100..900&family=Public+Sans:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet" /> <!--! END: Google Fonts !--> <!--! BEGIN: Favicon !--> <link rel="shortcut icon" type="image/x-icon" href="assets/images/favicon.ico" /> <!--! END: Favicon !--> <!--! BEGIN: Apps Title !--> <title>修改数据</title> <!--! END: Apps Title !--> <!--! BEGIN: MatisMenu CSS !--> <link rel="stylesheet" href="assets/vendors/metismenu/metisMenu.min.css"> <!--! END: MatisMenu CSS !--> <!--! BEGIN: Flaticon CSS !--> <link rel="stylesheet" href="assets/vendors/@flaticon/flaticon-uicons/css/all/all.css"> <!--! END: Flaticon CSS !--> <!--! BEGIN: Theme CSS !--> <link rel="stylesheet" type="text/css" href="assets/css/theme.min.css"> <!--! END: Theme CSS !--> <!--! Start:: Color Modes JS !--> <script src="assets/js/color-modes.min.js"></script> <!--! End:: Color Modes JS !--> <!--! HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries !--> <!--! WARNING: Respond.js doesn"t work if you view the page via file: !--> <!--[if lt IE 9]> <script src="https:oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https:oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <!--! ================================================================ !--> <!--! Start:: Main Wrapper !--> <!--! ================================================================ !--> <div class="main-wrapper"> <!--! ================================================================ !--> <!--! Start:: Main Menu !--> <!--! ================================================================ !--> <?php include 'view/aside.php'; ?> <!--! ================================================================ !--> <!--! End:: Main Menu !--> <!--! ================================================================ !--> <!--! ================================================================ !--> <!--! Start:: Main Content !--> <!--! ================================================================ !--> <main id="edash-main"> <!--! ================================================================ !--> <!--! Start:: Header !--> <!--! ================================================================ !--> <?php include 'view/header.php'; ?> <!--! ================================================================ !--> <!--! End:: Header !--> <!--! ================================================================ !--> <!--! ================================================================ !--> <!--! Start:: Page Content !--> <!--! ================================================================ !--> <div class="edash-page-container container-xxl" id="edash-page-container" > <!--! Start:: Breadcumb !--> <div class="edash-content-breadcumb row mb-4 mb-md-6 pt-md-2"> <div class="col-12"> <div class="d-flex align-items-center justify-content-between"> <div> <h2 class="h4 fw-semibold text-dark">排班表</h2> <nav aria-label="breadcrumb"> <ol class="breadcrumb mb-0"> <li class="breadcrumb-item"> <a href="index,php">首页</a> </li> <li class="breadcrumb-item"> <a href="works.php">排班表</a> </li> <li class="breadcrumb-item active" aria-current="page"> 修改数据 </li> </ol> </nav> </div> <div class="d-flex align-items-center gap-2"> <a href="deletework.php?id=<?php echo $id; ?>" class="btn btn-md btn-soft-danger" onclick="return confirm('确定要删除吗?')" target="_blank">删除</a> </div> </div> </div> </div> <!--! End:: Breadcumb !--> <!--! Start:: Content Section !--> <div class="edash-content-section row g-3 g-md-4"> <!-- Start:: Elements --> <div class="col-12"> <div class="card"> <div class="card-header"> <h4 class="card-title">修改数据</h4> </div> <div class="card-body"> <form class="was-validated" action="" method="post"> <div class="mb-3"> <label class="form-label">姓名</label> <input class="form-control" type="hidden" name="id" value="<?php echo htmlspecialchars($row['id']); ?>"/> <input type="text" class="form-control" id="mname" name="mname" value="<?php echo htmlspecialchars($row['mname']); ?>" required/> </div> <div class="mb-3"> <label for="validationCustom04" class="form-label">休息日</label> <select class="form-select" id="rest" name="rest"> <option value="上班" <?php echo ($row['rest'] === '上班') ? 'selected' : ''; ?>>上班</option> <option value="休息" <?php echo ($row['rest'] === '休息') ? 'selected' : ''; ?>>休息</option> <option value="请假" <?php echo ($row['rest'] === '请假') ? 'selected' : ''; ?>>请假</option> <option value="旷工" <?php echo ($row['rest'] === '旷工') ? 'selected' : ''; ?>>旷工</option> </select> </div> <div class="mb-3"> <label class="form-label">上班</label> <input type="text" class="form-control" id="startt" name="startt" value="<?php echo htmlspecialchars($row['startt']); ?>" required/> </div> <div class="mb-3"> <label class="form-label">任务1</label> <input type="text" class="form-control" id="bs" name="bs" value="<?php echo htmlspecialchars($row['bs']); ?>" required/> </div> <div class="mb-3"> <label class="form-label">任务2</label> <input type="text" class="form-control" id="cs" name="cs" value="<?php echo htmlspecialchars($row['cs']); ?>" required/> </div> <div class="mb-3"> <label class="form-label">任务3</label> <input type="text" class="form-control" id="ds" name="ds" value="<?php echo htmlspecialchars($row['es']); ?>" required/> </div> <div class="mb-3"> <label class="form-label">任务3</label> <input type="text" class="form-control" id="es" name="es" value="<?php echo htmlspecialchars($row['ds']); ?>" required/> </div> <div class="mb-3"> <label class="form-label">任务4</label> <input type="text" class="form-control" id="fs" name="fs" value="<?php echo htmlspecialchars($row['fs']); ?>" required/> </div> <div class="mb-3"> <label class="form-label">下班</label> <input type="text" class="form-control" id="endt" name="endt" value="<?php echo htmlspecialchars($row['endt']); ?>" required/> </div> <div class="mb-3"> <label for="validationCustom04" class="form-label">是否完成任务</label> <select class="form-select" id="accomplish" name="accomplish"> <option value="No" <?php echo ($row['accomplish'] === 'No') ? 'selected' : ''; ?>>No</option> <option value="Yes" <?php echo ($row['accomplish'] === 'Yes') ? 'selected' : ''; ?>>Yes</option> </select> </div> <div class="mb-3"> <button class="btn btn-primary" type="submit">提交修改</button> </div> </form> </div> </div> </div> <!-- End:: Elements --> </div> <!--! End:: Content Section !--> </div> <!--! ================================================================ !--> <!--! End:: Page Content !--> <!--! ================================================================ !--> <!--! ================================================================ !--> <!--! Start:: Footer !--> <!--! ================================================================ !--> <footer class="edash-footer-container container-xxl d-flex align-items-center justify-content-between rounded-3 p-4 mx-auto mb-3 ht-64 bg-body-tertiary" id="edash-footer-container" > <div class="hstack"> <span class="text-muted"> <script> document.write(new Date().getFullYear()); </script> © </span> <span class="vr mx-2 bg-body-secondary"></span> <a>Expodash</a> </div> <!--! ======================= <div class="d-flex align-items-center gap-3"> <a href="./../../docs/documentation.html" target="_blank" class="d-none d-sm-block" >Docs</a > <a href="wrapcoders@gmail.com" target="_blank" class="d-none d-sm-block" >About</a > <a href="wrapcoders@gmail.com" target="_blank">Support</a> <a href="https://codecanyon.net/item/expodash-bootstrap-5-admin-dashboard-template/52160996" target="_blank" >Purchase</a > </div> ========= !--> </footer> <!--! ================================================================ !--> <!--! End:: Footer !--> <!--! ================================================================ !--> </main> <!--! ================================================================ !--> <!--! End:: Main Content !--> <!--! ================================================================ !--> <div class="edash-menu-backdrop" id="edash-menu-hide"></div> </div> <!--! ================================================================ !--> <!--! End:: Main Wrapper !--> <!--! ================================================================ !--> <!--! ================================================================ !--> <!--! Footer Script !--> <!--! ================================================================ !--> <!--! BEGIN: Common Vendors !--> <script src="./../assets/js/vendors.min.js"></script> <!--! END: Common Vendors !--> <!--! BEGIN: Apps Common Init !--> <script src="./../assets/js/common-init.min.js"></script> <!--! END: Apps Common Init !--> <!--! BEGIN: Page Vendors -!--> <!--! END: Page Vendors -!--> <script> // Example starter JavaScript for disabling form submissions if there are invalid fields (() => { "use strict"; // Fetch all the forms we want to apply custom Bootstrap validation styles to const forms = document.querySelectorAll(".needs-validation"); // Loop over them and prevent submission Array.from(forms).forEach((form) => { form.addEventListener( "submit", (event) => { if (!form.checkValidity()) { event.preventDefault(); event.stopPropagation(); } form.classList.add("was-validated"); }, false ); }); })(); </script> </body> </html>
Simpan