-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
65 lines (63 loc) · 1.8 KB
/
index.php
File metadata and controls
65 lines (63 loc) · 1.8 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
<!DOCTYPE html>
<html>
<head>
<title> Home </title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="rg" style="float: right;">
<form action="searched.php" method="post">
<input type="text" name="target" placeholder="Serach a Product">
<button class="button">Search</button>
</form>
</div>
<div class="dropdown">
<button class="btn">Category</button>
<div class="dropdown-content" style="left:0;">
<a href="skinCare.php">Skin care</a>
<a href="makeUp.php">Make up</a>
</div>
</div>
<?php session_start();
if(isset($_SESSION["uid"]))
{
echo '<a href="logout.php" class="logout">Log out</a>';
echo '<div class="usr">';
echo '<a href="profile.php" class="btn">User ID: ' .$_SESSION["uid"].'</a></div>';
echo '<a href="viewOrder.php" class="btn">View orders</a>';
}
else
{
echo '<a href="login.php" class="btn">Login</a>';
}
$con=mysqli_connect("us-cdbr-iron-east-04.cleardb.net","b966a2a16a969f","01d02abd","heroku_0b7502a16e114a3");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error(); }
else
{
$sql = "SELECT * FROM product";
$res = mysqli_query($con,$sql);
if (!$res)
{
die('Error: ' . mysqli_error($con)); }
else
{
echo '<br><br><br><div class="row">';
while($row = mysqli_fetch_array($res))
{
echo '<div class = "box">';
echo '<a href="proInfo.php?pName='.$row['name'].'">';
echo '<img src= "data:image/jpeg;base64,' .base64_encode($row['image']).'">';
echo '</a>';
echo '<a href="proInfo.php?pName='.$row["name"].'" style ="text-decoration: none;">';
echo '<div class = "content" style = "color:black;"><p>'.$row['name']. '</p></div></a></div>';
}
echo '</div>';
}
}
mysqli_close($con);
?>
</body>
</html>