<?php
// ============================================================
// PASSWORD
// ============================================================
$PASSWORD = "YOURPASSWORDHERE";

if ($_SERVER["REQUEST_METHOD"] === "POST") {
    if ($_POST["password"] !== $PASSWORD) {
        die("Invalid password");
    }

    // Collect fields
    $name     = trim($_POST["name"]);
    $category = trim($_POST["category"]);
    $count    = trim($_POST["count"]);
    $image    = trim($_POST["image"]);
    $subtitle = trim($_POST["subtitle"]);
    $link     = trim($_POST["link"]);
    $tab      = trim($_POST["tab"]); // NEW FIELD

    // Format block
    $block  = $name . "\n";
    $block .= $category . "\n";
    $block .= $count . "\n";
    $block .= $image . "\n";
    $block .= "Subtitle: " . $subtitle . "\n";
    $block .= $link . "\n";
    $block .= "Tab: " . $tab . "\n\n"; // NEW LINE

    // Append to products.txt
    file_put_contents("products.txt", $block, FILE_APPEND);

    echo "<div style='padding:20px;color:#7aff9c;'>Product added.</div>";
}
?>

<!DOCTYPE html>
<html>
<head>
<title>Add Product</title>
<style>
body {
    background:#0a0a0a;
    color:#e6e2d3;
    font-family:"Cinzel", serif;
    padding:20px;
}
form {
    max-width:420px;
    margin:auto;
    background:#1a1a1a;
    padding:20px;
    border:2px solid #333;
    border-radius:8px;
}
input {
    width:100%;
    padding:10px;
    margin:6px 0;
    background:#222;
    border:2px solid #444;
    border-radius:6px;
    color:#e6e2d3;
}
button {
    width:100%;
    padding:12px;
    background:#333;
    border:2px solid #555;
    border-radius:6px;
    color:#e6e2d3;
    font-weight:bold;
    cursor:pointer;
}
button:hover {
    background:#444;
}
h1 {
    text-align:center;
    color:#7aff9c;
}
</style>
</head>

<body>
<h1>Add Product</h1>

<form method="POST">
    <input type="password" name="password" placeholder="Password">

    <input name="name" placeholder="Product Name">
    <input name="category" placeholder="Category">
    <input name="count" placeholder="Amount Left">
    <input name="image" placeholder="Image URL">
    <input name="subtitle" placeholder="Subtitle">
    <input name="link" placeholder="Product Link">
    <input name="tab" placeholder="Tab (Consumables, Technology, Automotive)"> <!-- NEW -->

    <button type="submit">Add Product</button>
</form>

</body>
</html>