-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocess_order.php
More file actions
38 lines (30 loc) · 1.08 KB
/
process_order.php
File metadata and controls
38 lines (30 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
session_start();
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_SESSION['user_id'])) {
// Get form data
$vid = $_POST['vid'];
$days = $_POST['days'];
// Process the data (e.g., insert into the database)
// Modify the database connection code as needed
// Example database connection and query
$servername = "localhost";
$username = "root"; // MySQL User Name
$password = ""; // MySQL Password
$dbname = "user"; // MySQL DB Name
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Example query to insert data into a table
$sql = "INSERT INTO your_table_name (vid, days) VALUES ('$vid', '$days')";
if ($conn->query($sql) === TRUE) {
echo "Form data inserted successfully!";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
} else {
// Handle unauthorized access or missing session
echo "Unauthorized access";
}
?>