-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
100 lines (85 loc) · 2.65 KB
/
index.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
<?php
@session_start();
include("includes/db.php");
include("functions/functions.php");
cart();
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html"; charset="utf-8">
<title>My Shop</title>
<link rel="stylesheet" href="style/style.css" media="all" />
</head>
<body>
<div class="main_wrapper">
<div class="header_wrapper">
<a href="index.php"><img src="images/header_banner03.png" style="float:left;"></a>
</div>
<div id="navbar">
<ul id="menu">
<li><a href="index.php">Home</a></li>
<li><a href="all_products.php">All Products</a></li>
<li><a href="customer_register.php">Sign Up</a></li>
<li><a href="cart.php">Shopping Cart</a></li>
<li><a href="contactus.php">Contact us</a></li>
</ul>
<div id="form">
<form method="get" action="results.php" enctype="multipart/form-data">
<input type="text" name="user_query" placeholder="Search"/>
<input type="submit" name="search" value="Search"/>
</form>
</div>
</div>
<div class="content_wrapper">
<div id="left_sidebar">
<div id="sidebar_title">Categories</div>
<ul id="cats">
<?php getCategories(); ?>
</ul>
<div id="sidebar_title">Brands</div>
<ul id="brands">
<?php getBrands(); ?>
</ul>
</div>
<div id="right_content">
<div id="headline">
<div id="headline_content">
<?php
/*the following code checks if the user is logged in or not. If the user is not loggin in, the website greets you simply with 'Welcome Guest!'
but if you are logged in it greets you with your email id e.g. 'Welcome [email protected]!'
*/
if(!isset($_SESSION['customer_email'])){
echo "<b>Welcome Guest!</b><b style='color:yellow;'>Shopping Cart</b>";
}
else{
echo "<b>Welcome <span style='color:skyblue;'>". $_SESSION['customer_email'] . "!</span></b><b style='color:yellow;'> Shopping Cart</b>";
}
?>
<span> - Items: <?php items(); ?> - Price: <?php total_price();?> <a href="cart.php" style="color:#ff0;">Go to Cart</a>
<?php
// if the user is logged in it shows the 'Sign out' hyperlink otherwise it shows the 'Sign in' hyperlink
if(!isset($_SESSION['customer_email'])){
echo "<a href='checkout.php' style='color:#f93;'>Sign in</a>";
}
else{
echo "<a href='signout.php' style='color:#f93;'>Sign out</a>";
}
?>
</span>
</div>
</div>
<div id="products_box">
<?php getProduct(); ?>
<?php getCategoriesProduct(); ?>
<?php getBrandsProduct(); ?>
</div>
</div>
</div>
<div class="footer">
<h1>©2019 - By www.myshop.com</h1>
</div>
</div>
</body>
</html>