-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpayment.php
More file actions
108 lines (86 loc) · 3.19 KB
/
Copy pathpayment.php
File metadata and controls
108 lines (86 loc) · 3.19 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Payment</title>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
background: #f0f0f0;
font-family: Arial, sans-serif;
background: url('img/SignBackGround.jpg') center center / cover;
}
.form-container {
background-color: #fff;
padding: 20px;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
width: 300px;
}
.payment-details label {
display: block;
margin-bottom: 8px;
color: #333;
}
.payment-details input {
width: calc(100% - 12px);
padding: 8px;
margin-bottom: 15px;
border-radius: 3px;
border: 1px solid #4169E1;
}
.payment-details input[type="submit"] {
background-color: #4169E1;
color: white;
cursor: pointer;
}
.payment-details input[type="submit"]:hover {
background-color: purple;
}
</style>
</head>
<body>
<div class="form-container">
<form action="" method="post" enctype="multipart/form-data" class="payment-details">
<h2>Payment Details</h2>
<label for="CardNumber">Card Number:</label>
<input type="text" name="CardNumber">
<label for="Expiremonth">Expire Date:</label>
<input type="date" name="Expiremonth">
<label for="CVV">CVV:</label>
<input type="CVV" name="CVV">
<label for="email">Email:</label>
<input type="text" name="email">
<label for="no_of_days">Number of days:</label>
<input type="text" id="no_of_days" name="no_of_days" required>
<input type="submit" name="submit" value="Pay now">
</form>
</div>
<?php
include 'config.php';
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['submit'])) {
$CardNumber = isset($_POST['CardNumber']) ? $_POST['CardNumber'] : '';
$Expiremonth = isset($_POST['Expiremonth']) ? $_POST['Expiremonth'] : '';
$CVV = isset($_POST['CVV']) ? $_POST['CVV'] : '';
$no_of_days = isset($_POST['no_of_days']) ? $_POST['no_of_days'] : '';
$email = isset($_POST['email']) ? $_POST['email'] : '';
$sql = "INSERT INTO payment (cardnumber, exdate , cvv , no_of_days , email)
VALUES ('$CardNumber', '$Expiremonth', '$CVV', '$no_of_days','$email')";
if ($conn->query($sql) === TRUE) {
echo "Payment has been done successfully";
header("Location: user_page.php");
exit();
} else {
echo "Error making payment: " . $conn->error;
}
$conn->close();
}
?>
</body>
</html>