-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathHomepage.php
More file actions
executable file
·198 lines (146 loc) · 4.97 KB
/
Homepage.php
File metadata and controls
executable file
·198 lines (146 loc) · 4.97 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
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<?php
session_start();
require 'DBconnect.php';
if(isset($_POST['submit']))
{
$email = mysqli_real_escape_string($connection,$_POST['email']);
$upass = mysqli_real_escape_string($connection,$_POST['pass']);
$res=mysqli_query($connection,"SELECT * FROM users WHERE email='$email'");
$row=mysqli_fetch_array($res);
if($row['password']==md5($upass))
{
$_SESSION['user'] = $row['user_id'];
header("Location: Homepage.php");
}
else
{
?>
<script>
alert('wrong details');
window.location.href = "Homepage.php";
</script>
<?php
}
}
?>
<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>E-Shoping</title>
<link rel="stylesheet" type="text/css" href="style.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="stylecss.css" />
<!--[if lt IE 7]>
<style type="text/css">
.pngfix { behavior: url(pngfix/iepngfix.htc);}
.tooltip{width:200px;};
</style>
<![endif]-->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>
<script type="text/javascript" src="popup_tip/jquery.simpletip-1.3.1.pack.js"></script>
<script type="text/javascript" src="script.js"></script>
<script src="myscript.js"></script>
</head>
<body>
<div id="header">
<div id="left">
<label><a href="Homepage.php">E-Shop</a> </label>
</div>
<div id="right">
<div id="content">
<?php
if(isset($_SESSION['user']))
{
$res=mysqli_query($connection,"SELECT * FROM users WHERE user_id=".$_SESSION['user']);
$userRow=mysqli_fetch_array($res);
echo '<img src="'.$userRow['imgage'].'" align="left" style="margin-top:-15px; margin-right:10px;" >';
echo ' Hi ';
echo $userRow['username'];
echo ' <a href="UserHistory.php">History</a>';
echo ' <a href="EditProfile.php">Edit Profile</a>';
echo ' <a href="Logout.php?logout">Sign Out</a>';
}else {
echo ' Hi ';
echo 'Guest';
echo ' <a class="signInbt href="Login.php?logout">Login</a>';
} ?>
</div>
</div>
</div>
<div id="login-form">
<form class="form" method="post">
<p class="clearfix">
<label for="login">Email</label>
<input type="text2" name="email" placeholder="User Email">
</p>
<p class="clearfix">
<label for="password">Password</label>
<input type="password" name="pass" placeholder="Password">
</p>
<p class="clearfix">
<input type="checkbox" name="remember" id="remember">
<label for="remember">Remember me</label>
</p>
<p class="clearfix">
<input type="submit" name="submit" value="Login">
</p>
<p class="registerbt">
<a href="Register.php">
<button type="button" name="button">Sign Up</button>
</a>
</p>
<p>
<input type="image" class="hide" src="images/up.png" />
</p>
</form>
</div>
<div id="main-container">
<div class="tutorialzine">
<h1>Shopping cart</h1>
</div>
<div class="container">
<span class="top-label">
<span class="label-txt">Products</span>
</span>
<div class="content-area">
<div class="content drag-desired">
<?php
$result = mysqli_query($connection,"SELECT * FROM Shop");
while($row=mysqli_fetch_assoc($result))
{
echo '<div class="product"><img src="images/products/'.$row['imgage'].'" alt="'.htmlspecialchars($row['name']).'" width="128" height="128" class="pngfix" /></div>';
}
?>
<div class="clear"></div>
</div>
</div>
<div class="bottom-container-border">
</div>
</div>
<div class="container">
<span class="top-label">
<span class="label-txt">Shopping Cart</span>
</span>
<div class="content-area">
<div class="content drop-here">
<div id="cart-icon">
<img src="images/Shoppingcart_128x128.png" alt="shopping cart" class="pngfix" width="128" height="128" />
<!-- <img src="img/ajax_load_2.gif" alt="loading.." id="ajax-loader" width="16" height="16" /> -->
<img alt="Out Of Stock!" id="ajax-loader" width="150" height="16" />
</div>
<form name="checkoutForm" method="post" action="Item_ordered.php">
<div id="item-list">
</div>
</form>
<div class="clear"></div>
<div id="total"></div>
<div class="clear"></div>
<a href="" onclick="document.forms.checkoutForm.submit(); return false;" class="button">Buy</a>
</div>
</div>
<div class="bottom-container-border">
</div>
</div>
</body>
</html>