-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstore_details.php
139 lines (102 loc) · 3.24 KB
/
store_details.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
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<?php
require './conn.php';
session_start();
if(isset($_POST['submit']) && $_POST['email'] && $_POST['password']) {
$email = $_POST['email'];
$password = $_POST['password'];
$query = "SELECT * FROM seller WHERE email = '$email' AND password = '$password'";
$result = $con->query($query);
$rowCount = $result->num_rows;
$query2 = "SELECT * FROM buyer WHERE email = '$email' AND password = '$password'";
$result2 = $con->query($query2);
$rowCount2 = $result2->num_rows;
if($rowCount == 1) {
$row = $result->fetch_assoc();
$sellerID = $row['seller_ID'];
$_SESSION['user_role'] = 'seller';
$_SESSION['seller_ID'] = $sellerID;
header("Location: seller_dashboard.php"); // Redirect to seller dashboard page
exit();
} else if($rowCount2 == 1) {
$row = $result2->fetch_assoc();
$buyerID = $row['buyer_ID'];
$_SESSION['user_role'] = 'buyer';
$_SESSION['buyer_ID'] = $buyerID;
header("Location: index.php"); // Redirect to home page
} else {
$error = "invalid email or password!";
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Store page</title>
<link href="./images/ico.png" rel="icon" type="image/png" />
<link rel="stylesheet" href="./css/header.css">
<link rel="stylesheet" href="./css/footer.css">
<link rel="stylesheet" href="./css/style.css">
<link rel="stylesheet" href="./css/store_details.css">
<link rel="stylesheet" href="./css/index.css">
<meta charset="utf-8">
<link href="https://fonts.googleapis.com/css2?family=Fredoka:wght@300;400;500;600;700&family=Oswald:wght@200&family=Rubik:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet">
<!-- store.css doesn't support -->
<style>
.box{
column-count: 4;
display: grid;
}
.button{
background-color: grey;
z-index: 5;
border: none;
outline: 0;
padding: 12px;
color: white;
text-align: center;
cursor: pointer;
width: 100%;
font-size: 18px;
}
.button:hover {
opacity: 0.7;
background-color: #000;
color: orange;
}
</style>
</head>
<body>
<!-- Header -->
<?php include './header.php'; ?>
<header>
<h1>Store Details</h1>
</header>
<nav>
<ul>
<li><a href="store.php">Home</a></li>
<li><a href="#">Store Details</a></li>
</ul>
</nav>
<?php
$query = "SELECT * FROM seller";
$sellerquery = "SELECT product.*, seller.* FROM seller JOIN product ON seller.seller_ID = product.seller_ID ";
$result = $con->query($sellerquery);
while($row = $result->fetch_assoc())
{
?>
<div class="store-container">
<h2><?php echo $row['seller_Name']; ?></h2>
<div class="store-details">
<p><?php echo $row['location']; ?></p>
<p><?php echo $row['email']; ?></p>
</div>
</div>
</body>
<?php } ?>
<!-- Footer -->
<?php include './footer.php' ?>
</body>
</html>
<?php $con->close(); ?>