芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/qrafiqxcreativeagency.com/projects/function.php
connect_error) { die("Connection failed: " . $conn->connect_error); } // Variables for messages $budget_warning = ''; $express_warning = ''; $express_charge = 10; // Handle form submission if ($_SERVER["REQUEST_METHOD"] == "POST") { // Get form data $event_name = $_POST['event_name']; $event_date = $_POST['event_date']; $event_time = $_POST['event_time']; $venue = $_POST['venue']; $flyer_type = $_POST['flyer_type']; $flyer_size = $_POST['flyer_size']; $description = $_POST['description']; $additional_info = $_POST['additional_info']; $budget = $_POST['budget']; $deadline = $_POST['deadline']; // If budget is below 50 USD, set warning if ($budget < 50) { $budget_warning = "Warning: The budget is below 50 USD, which might affect the quality of the flyer design."; } // Express charge logic $deadline_date = new DateTime($deadline); $current_date = new DateTime(); $diff = $deadline_date->diff($current_date); // If deadline is in 1 day, apply an express charge of 10% of the budget if ($diff->days <= 1) { $express_charge = $budget * 3; $express_warning = "Since your deadline is in less than 1 day, an express charge of " . number_format($express_charge, 2) . " USD will apply."; } // File upload handling $image_path = ''; if (isset($_FILES['flyer_image']) && $_FILES['flyer_image']['error'] == 0) { $target_dir = "uploads/"; $target_file = $target_dir . basename($_FILES["flyer_image"]["name"]); if (move_uploaded_file($_FILES["flyer_image"]["tmp_name"], $target_file)) { $image_path = $target_file; } else { echo "Sorry, there was an error uploading your file."; } } // Insert form data into the database $sql = "INSERT INTO event_flyer_requests (event_name, event_date, event_time, venue, flyer_type, flyer_size, description, additional_info, budget, deadline, express_charge, image_path) VALUES ('$event_name', '$event_date', '$event_time', '$venue', '$flyer_type', '$flyer_size', '$description', '$additional_info', '$budget', '$deadline', '$express_charge', '$image_path')"; if ($conn->query($sql) === TRUE) { // Redirect or show success message header('Location: submission.php'); // Redirect to confirmation page exit(); } else { echo "Error: " . $sql . "
" . $conn->error; } } $conn->close(); ?>