403Webshell
Server IP : 173.209.174.21  /  Your IP : 216.73.216.89
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux wcfs-server 6.8.0-124-generic #124-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 13:00:45 UTC 2026 x86_64
User : nodor ( 1000)
PHP Version : 8.3.6
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/thelittlebigshow/vendor-reg/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/thelittlebigshow/vendor-reg/edit_vendor.php
<?php
// Start the session
session_start();

// Check if the user is logged in as an admin
if (!isset($_SESSION['admin_logged_in']) || $_SESSION['admin_logged_in'] !== true) {
    header("Location: admin_login.php"); // Redirect to login page if not logged in
    exit();
}

// Include the database configuration
include 'config.php';

// Establish a database connection
$conn = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

// Fetch vendor details by ID
if (isset($_GET['id'])) {
    $vendor_id = $_GET['id'];
    $sql = "SELECT * FROM vendors WHERE id = ?";
    $stmt = $conn->prepare($sql);
    $stmt->bind_param("i", $vendor_id);
    $stmt->execute();
    $result = $stmt->get_result();
    $vendor = $result->fetch_assoc();
    $stmt->close();
}

// Update vendor details if form is submitted
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $name = $_POST['name'];
    $email = $_POST['email'];
    $phone = $_POST['phone'];
    $address = $_POST['address'];
    $city = $_POST['city'];
    $state = $_POST['state'];
    $zip = $_POST['zip'];
    $website = $_POST['website'];
    $description = $_POST['description'];
    $category = $_POST['category'];
    $spots = $_POST['spots'];
    $payment_status = $_POST['payment_status']; // Ensure this is not an empty field

    // Update the vendor in the database
    $update_sql = "UPDATE vendors SET name = ?, email = ?, phone = ?, address = ?, city = ?, state = ?, zip = ?, website = ?, description = ?, category = ?, spots = ?, payment_status = ? WHERE id = ?";
    $stmt = $conn->prepare($update_sql);
    $stmt->bind_param("ssssssssssisi", $name, $email, $phone, $address, $city, $state, $zip, $website, $description, $category, $spots, $payment_status, $vendor_id);
    $stmt->execute();
    $stmt->close();

    header("Location: admin_dashboard.php"); // Redirect to the admin dashboard after the update
    exit();
}

?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Edit Vendor</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #F5F5F5;
            color: #333333;
            margin: 0;
            padding: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            flex-direction: column;
        }
        .main-container {
            background-color: #FFFFFF;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            width: 80%;
            max-width: 600px;
        }
        h2 {
            text-align: center;
            color: #1E90FF;
        }
        form {
            display: flex;
            flex-direction: column;
            text-align: left;
        }
        label {
            margin-top: 10px;
            font-weight: bold;
        }
        input, textarea, select {
            padding: 10px;
            margin-top: 5px;
            border: 1px solid #CCCCCC;
            border-radius: 4px;
            font-size: 16px;
        }
        input:focus, textarea:focus, select:focus {
            border-color: #1E90FF;
            outline: none;
        }
        button {
            background-color: #1E90FF;
            color: #FFFFFF;
            padding: 10px;
            margin-top: 20px;
            border: none;
            border-radius: 4px;
            font-size: 18px;
            cursor: pointer;
        }
        button:hover {
            background-color: #1C86EE;
        }
    </style>
</head>
<body>

    <div class="main-container">
        <h2>Edit Vendor Information</h2>

        <form action="edit_vendor.php?id=<?php echo $vendor['id']; ?>" method="POST">
            <label for="name">Full Name:</label>
            <input type="text" id="name" name="name" value="<?php echo htmlspecialchars($vendor['name']); ?>" required>

            <label for="email">Email Address:</label>
            <input type="email" id="email" name="email" value="<?php echo htmlspecialchars($vendor['email']); ?>" required>

            <label for="phone">Phone Number:</label>
            <input type="tel" id="phone" name="phone" value="<?php echo htmlspecialchars($vendor['phone']); ?>" required>

            <label for="address">Address:</label>
            <input type="text" id="address" name="address" value="<?php echo htmlspecialchars($vendor['address']); ?>" required>

            <label for="city">City:</label>
            <input type="text" id="city" name="city" value="<?php echo htmlspecialchars($vendor['city']); ?>" required>

            <label for="state">State:</label>
            <input type="text" id="state" name="state" value="<?php echo htmlspecialchars($vendor['state']); ?>" required>

            <label for="zip">Zip Code:</label>
            <input type="text" id="zip" name="zip" value="<?php echo htmlspecialchars($vendor['zip']); ?>" required>

            <label for="website">Website (if any):</label>
            <input type="text" id="website" name="website" value="<?php echo htmlspecialchars($vendor['website']); ?>">

            <label for="description">Description of What You Sell:</label>
            <textarea id="description" name="description" rows="4" required><?php echo htmlspecialchars($vendor['description']); ?></textarea>

            <label for="category">Category:</label>
            <select id="category" name="category" required>
                <option value="Food & Beverages" <?php echo ($vendor['category'] == 'Food & Beverages') ? 'selected' : ''; ?>>Food & Beverages</option>
                <option value="Handmade Crafts" <?php echo ($vendor['category'] == 'Handmade Crafts') ? 'selected' : ''; ?>>Handmade Crafts</option>
                <option value="Clothing & Apparel" <?php echo ($vendor['category'] == 'Clothing & Apparel') ? 'selected' : ''; ?>>Clothing & Apparel</option>
                <option value="Art & Prints" <?php echo ($vendor['category'] == 'Art & Prints') ? 'selected' : ''; ?>>Art & Prints</option>
                <option value="Electronics" <?php echo ($vendor['category'] == 'Electronics') ? 'selected' : ''; ?>>Electronics</option>
                <option value="Jewelry" <?php echo ($vendor['category'] == 'Jewelry') ? 'selected' : ''; ?>>Jewelry</option>
                <option value="Books & Literature" <?php echo ($vendor['category'] == 'Books & Literature') ? 'selected' : ''; ?>>Books & Literature</option>
                <option value="Toys & Games" <?php echo ($vendor['category'] == 'Toys & Games') ? 'selected' : ''; ?>>Toys & Games</option>
                <option value="Furniture" <?php echo ($vendor['category'] == 'Furniture') ? 'selected' : ''; ?>>Furniture</option>
                <option value="Beauty & Personal Care" <?php echo ($vendor['category'] == 'Beauty & Personal Care') ? 'selected' : ''; ?>>Beauty & Personal Care</option>
                <option value="Sports Equipment" <?php echo ($vendor['category'] == 'Sports Equipment') ? 'selected' : ''; ?>>Sports Equipment</option>
                <option value="Home Goods & Decor" <?php echo ($vendor['category'] == 'Home Goods & Decor') ? 'selected' : ''; ?>>Home Goods & Decor</option>
                <option value="Pet Supplies" <?php echo ($vendor['category'] == 'Pet Supplies') ? 'selected' : ''; ?>>Pet Supplies</option>
                <option value="Other" <?php echo ($vendor['category'] == 'Other') ? 'selected' : ''; ?>>Other</option>
            </select>

            <label for="spots">Number of Spots:</label>
            <select id="spots" name="spots" required>
                <option value="1" <?php echo ($vendor['spots'] == 1) ? 'selected' : ''; ?>>1 Spot</option>
                <option value="2" <?php echo ($vendor['spots'] == 2) ? 'selected' : ''; ?>>2 Spots</option>
                <option value="3" <?php echo ($vendor['spots'] == 3) ? 'selected' : ''; ?>>3 Spots</option>
            </select>

            <label for="payment_status">Payment Status:</label>
            <select id="payment_status" name="payment_status" required>
                <option value="0" <?php echo ($vendor['payment_status'] == 0) ? 'selected' : ''; ?>>Unpaid</option>
                <option value="1" <?php echo ($vendor['payment_status'] == 1) ? 'selected' : ''; ?>>Paid</option>
                <option value="2" <?php echo ($vendor['payment_status'] == 2) ? 'selected' : ''; ?>>Pending</option>
            </select>

            <button type="submit">Update Vendor</button>
        </form>
    </div>

</body>
</html>

Youez - 2016 - github.com/yon3zu
LinuXploit