-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathadd-payment.php
More file actions
41 lines (33 loc) · 1.07 KB
/
add-payment.php
File metadata and controls
41 lines (33 loc) · 1.07 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
<?php
session_start();
$productid = $_POST['productid'];
$productprice = $_POST['productprice'];
$selleremail = $_POST['selleremail'];
$buyerpaypalusername = $_SESSION['buyerpaypalusername'];
if (empty($_POST['productid']) || empty($_COOKIE['email'])) {
header('location:payments.php');
} else {
$email = $_COOKIE['email'];
$servername = "localhost";
$username = "root";
$password = "PASSWORD";
$dbname = "fullcashback";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
echo "Connected successfully" . "<br>";
$sql = "INSERT INTO payments (payment, useremail, selleremail, productid, buyerpaypalusername)
VALUES ('$productprice', '$email', '$selleremail', '$productid', '$buyerpaypalusername')";
if (mysqli_query($conn, $sql)) {
echo "New payment created successfully" . "<br>";
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
//Close the connection
mysqli_close($conn);
header('location:payments.php');
}
?>