This repository has been archived by the owner on May 27, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pay.php
71 lines (64 loc) · 1.92 KB
/
pay.php
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
<?php
/**
* Created by PhpStorm.
* User: barto
* Date: 23.01.18
* Time: 02:39
*/
session_start();
if (!isset($_SESSION['username']) || !isset($_GET['id'])) {
echo '
<script type="text/javascript">
window.location = "index.php"
</script>
';
die();
}
if (isset($_POST['payed'])) {
$username = $_SESSION['username'];
$orderId = $_GET['id'];
include('db-connection.php');
$sql1 = "SELECT Id FROM `user` WHERE Username = '$username';";
if ($result = $dbconnection->query($sql1)) {
$row = $result->fetch_assoc();
$sellerId = $row['Id'];
}
$sql2 = "UPDATE `orderedProduct` SET `isPaid` = '1' WHERE `orderedProduct`.`Id` = '$orderId' AND `orderedProduct`.`UserId` = '$sellerId';";
if ($result = $dbconnection->query($sql2)) {
echo '
<script type="text/javascript">
location.href = "user.php"
</script>
';
die();
}
}
?>
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="UTF-8">
<link href="imports/bootstrap.min.css" rel="stylesheet">
<link href="css/main.css" rel="stylesheet">
<link href="css/register.css" rel="stylesheet">
<title>Oplac zamowienie <?php echo $_GET['id'] ?> - UbijOkazje.pl</title>
<script src="imports/jquery-3.1.1.slim.min.js"></script>
<script src="imports/tether.min.js"></script>
<script src="imports/bootstrap.min.js"></script>
</head>
<body>
<div id="searchHeader">
<div style="float: left"><a href="index.php"><img src="img/logo.png" alt="logo" id="logoHeader"></a></div>
<div style="float: right; padding-top: 50px">
<form method="get" action="search.php">
<input name="query" id="searchBarHeader" type="text" style="width: 500px;">
<button id="searchButtonHeader">Szukaj</button>
</form>
</div>
<div style="clear: both;"></div>
</div>
<div id="registerDiv">
<form method="post" style="text-align: center; margin-top: 200px">
<p><input name="payed" type="hidden" value="y"></p>
<button id="registerButton" style="float: none;">Oplac zamowienie</button>
</form>