-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
174 lines (169 loc) · 7.61 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
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
<?
/*****************************************************
Developer: macdonaldgeek
Email: [email protected]
Phone: +255-657-567401/+254-717-667201/+44-744-0579061
Twitter: @macdonaldgeek
COPYRIGHT �2014 RESTAURANT SCRIPT. ALL RIGHTS RESERVED
******************************************************/
?>
<?php
require_once('admin/locale.php');
?>
<?php
//checking connection and connecting to a database
require_once('connection/config.php');
//Connect to mysql server
$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
if(!$link) {
die('Failed to connect to server: ' . mysql_error());
}
//Select database
$db = mysql_select_db(DB_DATABASE);
if(!$db) {
die("Unable to select database! You're seeing this message either because you have not yet installed the script or MySql service is offline.");
}
//retrieve questions from the questions table
$questions=mysql_query("SELECT * FROM questions")
or die("Something is wrong ... \n" . mysql_error());
?>
<?php
//setting-up a remember me cookie
if (isset($_POST['Submit'])){
//setting up a remember me cookie
if($_POST['remember']) {
$year = time() + 31536000;
setcookie('remember_me', $_POST['login'], $year);
}
else if(!$_POST['remember']) {
if(isset($_COOKIE['remember_me'])) {
$past = time() - 100;
setcookie(remember_me, gone, $past);
}
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><?php echo $name ?>:Home</title>
<link href="stylesheets/user_styles.php" rel="stylesheet" type="text/css">
<script language="JavaScript" src="validation/user.js">
</script>
</head>
<body>
<div id="page">
<div id="menu"><ul>
<li><a href="index.php">Home</a></li>
<li><a href="foodzone.php">Food Zone</a></li>
<li><a href="specialdeals.php">Special Deals</a></li>
<li><a href="member-index.php">My Account</a></li>
<li><a href="contactus.php">Contact Us</a></li>
</ul>
</div>
<div id="header" class="stretchX">
<div id="logo"> <a href="index.php" class="blockLink"></a></div>
<div id="company_name"><?php echo $name ?></div>
</div>
<div id="center">
<h1><center><?php echo $title ?></center></h1>
<div class="body_text">
<?php echo $subtitle ?>
</div>
<table align="center" border="1" width="100%">
<tr align="center">
<td style="text-align:center;">
<form id="loginForm" name="loginForm" method="post" action="login-exec.php" onsubmit="return loginValidate(this)">
<table width="290" border="1" align="center" cellpadding="2" cellspacing="0">
<CAPTION><h2>ACCESS YOUR ACCOUNT</h2></CAPTION>
<tr>
<td colspan="2" style="text-align:center;"><font color="#FF0000">* </font>Required fields</td>
</tr>
<tr>
<td width="112"><b>Email</b></td>
<td width="188"><font color="#FF0000">* </font><input name="login" type="email" class="textfield" id="login" maxlength="35" placeholder="enter your email" required/></td>
</tr>
<tr>
<td><b>Password</b></td>
<td><font color="#FF0000">* </font><input name="password" type="password" class="textfield" id="password" maxlength="25" placeholder="enter your password" required/></td>
</tr>
<tr>
<td><input name="remember" type="checkbox" class="" id="remember" value="1" onselect="cookie()" <?php if(isset($_COOKIE['remember_me'])) {
echo 'checked="checked"';
}
else {
echo '';
}
?>/>Remember me</td>
<td><a href="JavaScript: resetPassword()">Forgot password?</a></td>
</tr>
<tr>
<td colspan="2"><input type="reset" value="Clear Fields"/>
<input type="submit" name="Submit" value="Login" /></td>
</tr>
</table>
</form>
</td>
<hr>
<td style="text-align:center;">
<form id="loginForm" name="loginForm" method="post" action="register-exec.php" onsubmit="return registerValidate(this)">
<table width="450" border="1" align="center" cellpadding="2" cellspacing="0">
<CAPTION><h2>REGISTER FOR AN ACCOUNT</h2></CAPTION>
<tr>
<td colspan="2" style="text-align:center;"><font color="#FF0000">* </font>Required fields</td>
</tr>
<th>First Name </th>
<td><font color="#FF0000">* </font><input name="fname" type="text" class="textfield" id="fname" maxlength="15" placeholder="provide your first name" required/></td>
</tr>
<tr>
<th>Last Name </th>
<td><font color="#FF0000">* </font><input name="lname" type="text" class="textfield" id="lname" maxlength="15" placeholder="provide your last name" required/></td>
</tr>
<tr>
<th width="124">Email</th>
<td width="168"><font color="#FF0000">* </font><input name="login" type="email" class="textfield" id="login" maxlength="25" placeholder="provide your email" required/></td>
</tr>
<tr>
<th>Password</th>
<td><font color="#FF0000">* </font><input name="password" type="password" class="textfield" id="password" maxlength="25" placeholder="provide your password" required/></td>
</tr>
<tr>
<th>Confirm Password </th>
<td><font color="#FF0000">* </font><input name="cpassword" type="password" class="textfield" id="cpassword" maxlength="25" placeholder="repeat your password" required/></td>
</tr>
<tr>
<th>Security Question </th>
<td><font color="#FF0000">* </font><select name="question" id="question">
<option value="select">- select question -
<?php
//loop through quantities table rows
while ($row=mysql_fetch_array($questions)){
echo "<option value=$row[question_id]>$row[question_text]";
}
?>
</select></td>
</tr>
<tr>
<th>Security Answer</th>
<td><font color="#FF0000">* </font><input name="answer" type="text" class="textfield" id="answer" maxlength="15" placeholder="enter your answer" required/></td>
</tr>
<tr>
<td colspan="2"><input type="reset" value="Clear Fields"/>
<input type="submit" name="Submit" value="Register" /></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<hr>
</div>
<div id="footer">
<div class="bottom_menu"><a href="index.php">Home Page</a> | <a href="aboutus.php">About Us</a> | <a href="specialdeals.php">Special Deals</a> | <a href="foodzone.php">Food Zone</a> | <a href="#">Affiliate Program</a><br>
| <a href="admin/index.php" target="_blank">Administrator</a> |</div>
<div class="bottom_addr">© <?php echo date("Y") . " " . $name ?>. All Rights Reserved</div>
</div>
</div>
</body>
</html>