BLACKSITE
:
216.73.217.4
:
104.37.75.190 / alpenpass.ca
:
Linux server3.pointsplan.com 5.14.0-503.38.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Apr 18 08:52:10 EDT 2025 x86_64
:
/
home
/
apca
/
www
/
admin
/
Upload File:
files >> /home/apca/www/admin/admin_add_coupon.php
<?php session_start(); include('../includes/config.php'); // Database connection $coupon = [ 'id' => '', 'coupon_code' => '', 'name' => '', 'description' => '', 'terms' => '', 'categories' => [], 'discount_type' => 'fixed', 'discount_value' => '', 'start_date' => '', 'end_date' => '', 'status' => 'draft' ]; // Categories list $allCategories = ['Product', 'Rental', 'Tour', 'ALL']; // Check if editing an existing coupon if (isset($_GET['id']) && is_numeric($_GET['id'])) { $stmt = $dbh->prepare("SELECT * FROM coupons WHERE id = ?"); $stmt->execute([$_GET['id']]); $coupon = $stmt->fetch(PDO::FETCH_ASSOC); $coupon['categories'] = explode(',', $coupon['categories']); // Convert to array } ?> <!doctype html> <html lang="en" class="no-js"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1"> <meta name="description" content=""> <meta name="author" content=""> <meta name="theme-color" content="#3e454c"> <title>Alpenpass Motorcycle Rental Portal | Admin Gallery List</title> <!-- Font awesome --> <link rel="stylesheet" href="css/font-awesome.min.css"> <!-- Sandstone Bootstrap CSS --> <link rel="stylesheet" href="css/bootstrap.min.css"> <!-- Bootstrap Datatables --> <link rel="stylesheet" href="css/dataTables.bootstrap.min.css"> <!-- Bootstrap social button library --> <link rel="stylesheet" href="css/bootstrap-social.css"> <!-- Bootstrap select --> <link rel="stylesheet" href="css/bootstrap-select.css"> <!-- Bootstrap file input --> <link rel="stylesheet" href="css/fileinput.min.css"> <!-- Awesome Bootstrap checkbox --> <link rel="stylesheet" href="css/awesome-bootstrap-checkbox.css"> <!-- Admin Stye --> <link rel="stylesheet" href="css/style.css"> <style> .errorWrap { padding: 10px; margin: 0 0 20px 0; background: #fff; border-left: 4px solid #dd3d36; -webkit-box-shadow: 0 1px 1px 0 rgba(0,0,0,.1); box-shadow: 0 1px 1px 0 rgba(0,0,0,.1); } .succWrap{ padding: 10px; margin: 0 0 20px 0; background: #fff; border-left: 4px solid #5cb85c; -webkit-box-shadow: 0 1px 1px 0 rgba(0,0,0,.1); box-shadow: 0 1px 1px 0 rgba(0,0,0,.1); } .tdDate{ width: 500px; display: inline; } </style> </head> <body> <?php include('includes/header.php');?> <div class="ts-main-content"> <?php include('includes/leftbar.php');?> <div class="content-wrapper"> <div class="container-fluid"> <div class="row"> <div class="col-md-12"> <h2 class="page-title">Coupons</h2> <div class="row"> <div class="col-md-10"> <div class="panel panel-default"> <div class="panel-heading">Coupons</div> <div class="panel-body"> <form action="process_coupon.php" method="post"> <input type="hidden" name="id" value="<?php echo htmlentities($coupon['id']); ?>"> <label>Coupon Code:</label> <input type="text" name="coupon_code" class="form-control" required value="<?php echo htmlentities($coupon['coupon_code']); ?>"> <label>Name:</label> <input type="text" name="name" class="form-control" required value="<?php echo htmlentities($coupon['name']); ?>"> <label>Description:</label> <textarea name="description" class="form-control"><?php echo htmlentities($coupon['description']); ?></textarea> <label>Terms & Conditions:</label> <textarea name="terms" class="form-control"><?php echo htmlentities($coupon['terms']); ?></textarea> <label>Categories:</label><br> <?php foreach ($allCategories as $cat) : ?> <input type="checkbox" name="categories[]" value="<?php echo $cat; ?>" <?php echo in_array($cat, $coupon['categories']) ? 'checked' : ''; ?>> <?php echo $cat; ?> <?php endforeach; ?> <label>Discount Type:</label> <select name="discount_type" class="form-control"> <option value="fixed" <?php echo ($coupon['discount_type'] == 'fixed') ? 'selected' : ''; ?>>Fixed ($)</option> <option value="percentage" <?php echo ($coupon['discount_type'] == 'percentage') ? 'selected' : ''; ?>>Percentage (%)</option> </select> <label>Discount Value:</label> <input type="number" step="0.01" name="discount_value" class="form-control" required value="<?php echo htmlentities($coupon['discount_value']); ?>"><br /> <label>Start Date:</label> <label style="margin-left: 465px;">End Date:</label> <div> <input type="date" name="start_date" class="form-control tdDate" required value="<?php echo htmlentities($coupon['start_date']); ?>"> <input type="date" name="end_date" class="form-control tdDate" required value="<?php echo htmlentities($coupon['end_date']); ?>"> </div> <label>Status:</label> <select name="status" class="form-control" style="width: 300px;"> <option value="draft" <?php echo ($coupon['status'] == 'draft') ? 'selected' : ''; ?>>Draft</option> <option value="active" <?php echo ($coupon['status'] == 'active') ? 'selected' : ''; ?>>Active</option> </select> <br> <button type="submit" class="btn btn-primary">Save Coupon</button> <a href="admin_coupons.php" class="btn btn-secondary">Back</a> </form> </div> </div> </div> </div> </div> </div> </div> </div> <!-- jQuery & DataTables --> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script> <script src="https://cdn.datatables.net/buttons/2.3.6/js/dataTables.buttons.min.js"></script> <script src="https://cdn.datatables.net/buttons/2.3.6/js/buttons.html5.min.js"></script> <script src="js/main.js"></script> <script> $(document).ready(function() { $('#galleryTable').DataTable({ responsive: true, lengthMenu: [[10, 25, 50, -1], [10, 25, 50, "All"]], columnDefs: [{ orderable: false, targets: [0, 7] }], order: [[6, 'asc']] }); }); </script> </body> </html>