-
Notifications
You must be signed in to change notification settings - Fork 0
/
BankAccount.php
334 lines (257 loc) · 11.2 KB
/
BankAccount.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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
<?php
session_start();
$title = 'Research Project'; //define page title
require('static/layout/header.html'); //include header template
$string1="http://oblogin.com/static/images/";
$account = $_GET['account'];
$image=$string1.$account;
$_SESSION['eshime']= $image;
$_SESSION['type']= 1;
$today = date("Y-m-d H:i:s");
$_SESSION['start']= $today;
?>
<link rel="stylesheet" href="static/css/username_style.css">
<script type="text/javascript" src="static/script/register.js"></script>
<script type="text/javascript" src="static/script/login.js"></script>
<div class="container">
<center><div class="img1"> <img class="img-responsive" id="image_account" src="<?php echo $image?>"></div></center>
<div class="container">
<div class="container">
<form class="form" method="post" id="mainform" name="mainform">
<ul class="tab-group">
<li class="tab active">
<a href="#login">Log In</a>
</li>
<li class="tab">
<a href="#signup">Register</a>
</li>
</ul>
<div class="tab-content">
<!-- ***************Present the login tab******************* -->
<div id="login" style="display: block;">
<div class="wrapper">
<div id="username-not-loged" style="display: block;">
<form id="form-usernmae_signin" >
<center> <h2 class="form-signin-heading">Log In Phase</h2></center> <hr> <br>
<h2 class="form-signin-heading">Give your username in order to login</h2>
<br>
<div class="inner-addon left-addon">
<i class="glyphicon glyphicon-user"></i>
<input type="text" class="form-control" name="username1" id="username1" placeholder="Username" autofocus autocomplete="off"/>
</div>
<div id="user-name-error-msg" class="validation" style="display: none;"></div>
<div id="user-name-notexist-msg" class="error" style="display: none;"></div>
<br>
<center><div id="login_next_loding" style="display: none;"></div> </center>
<button id="login_btn" type="submit" class="btn btn-lg btn-primary btn-block">Login</button>
</form>
</div>
<div id="username-loged" style="display: none;">
<center>
<h2 class="form-signin-heading">Log In-Step 2</h2>
</center> <hr> <br>
<h2 class="form-signin-heading">Please give the following characters of the memorable word</h2>
<?php
require_once("database.php"); // require the db connection
$username=$_SESSION['username'];
$type=$_SESSION['type'];
$result= mysql_query("SELECT `word_size` FROM `credentials` WHERE `username` = '$username' AND `type` = '$type'");
if (mysql_num_rows($result)) {
$max= mysql_result($result,0) or die(mysql_error());
if (isset($max)) {
$max=$max-1;
$tmp = UniqueRandomNumbersWithinRange(0,$max,3);
}else{ $tmp = UniqueRandomNumbersWithinRange(0,9,3); }
}else{ $tmp = UniqueRandomNumbersWithinRange(0,9,3); }
$_SESSION['pos1']=$tmp[0];
$_SESSION['pos2']=$tmp[1];
$_SESSION['pos3']=$tmp[2];
//function that finds 3 random number between a specific range
function UniqueRandomNumbersWithinRange($min, $max, $quantity) {
$numbers = range($min, $max);
shuffle($numbers);
return array_slice($numbers, 0, $quantity);
}
?>
<div class="panel panel-default">
<div class="panel-heading">Please give the following characters of the memorable word </div>
<div class="panel-body">
<div class="flex">
<p style="width: 1000px;">Please give the <?$temp=$tmp[0]+1 ; if($temp>3){echo "$temp <sup>th</sup>";}else if ($temp==3){ echo "$temp <sup>rd</sup>";}else if ($temp==2){ echo "$temp <sup>nd</sup>";}else if($temp==1){echo "$temp <sup>st</sup>";} else{echo $temp;}?> character: </p>
<input autofocus type="password" class="form-control" name="memorable_word1" id="memorable_word1" size="1" maxlength="1" style="width: 80px;" autocomplete="off"/>
</div>
</div>
<div class="panel-body">
<div class="flex">
<p style="width: 1000px;">Please give the <? $temp=$tmp[1]+1 ; if($temp>3){echo "$temp <sup>th</sup>";}else if ($temp==3){ echo "$temp <sup>rd</sup>";}else if ($temp==2){ echo "$temp <sup>nd</sup>";}else if($temp==1){echo "$temp <sup>st</sup>";} else{echo $temp;}?> character: </p>
<input type="password" class="form-control" name="memorable_word2" id="memorable_word2" size="1" maxlength="1" style="width: 80px;" autocomplete="off"/>
</div>
</div>
<div class="panel-body">
<div class="flex">
<p style="width: 1000px;">Please give the <? $temp=$tmp[2]+1 ; if($temp>3){echo "$temp <sup>th</sup>";}else if ($temp==3){ echo "$temp <sup>rd</sup>";}else if ($temp==2){ echo "$temp <sup>nd</sup>";}else if($temp==1){echo "$temp <sup>st</sup>";} else{echo $temp;}?> character: </p>
<input type="password" class="form-control" name="memorable_word3" id="memorable_word3" size="1" maxlength="1" style="width: 80px;" autocomplete="off"/>
</div>
</div>
</div>
<hr class="style-five">
<br>
<h2 class="form-signin-heading">Please Answer the following question(s):</h2>
<div class="panel panel-default">
<div class="panel-heading" id="question"></div>
<div class="panel-body">
<div class="inner-addon left-addon">
<i class="glyphicon glyphicon-question-sign"></i>
<input type="text" class="form-control" name="answer1" id="answer_1" placeholder="Please answer the question" />
</div>
</div>
</div>
<div class="panel panel-default" style="display: none;" id="panel_2">
<div class="panel-heading" id="question2"></div>
<div class="panel-body">
<div class="inner-addon left-addon">
<i class="glyphicon glyphicon-question-sign"></i>
<input type="text" class="form-control" name="answer_2" id="answer_2" placeholder="Please answer the question" />
</div>
</div>
</div>
<div id="phase2-error-msg" class="validation" style="display: none;"></div>
<center><div id="loading_next"></div></center>
<button id="goToPhase2_btn" class="btn btn-lg btn-primary btn-block" type="submit" >Next sign-in phase</button>
</div>
</div>
</div>
<!-- ***************Present the Register tab******************* -->
<div id="signup" style="display: none;">
<div class="wrapper">
<form class="form-signup" method="post">
<center>
<h2 class="form-signup-heading">Registration phase</h2>
</center>
<hr> <br>
<h3 class="form-signup-heading">Username</h3>
<div class="inner-addon left-addon">
<i class="glyphicon glyphicon-user"></i>
<input name="username2" type="text" class="form-control" id="username2" placeholder="Username" autocomplete="off" />
</div>
<span id="user-result2"></span>
<div id="error_msg_username" class="validation" style="display: none;"></div>
<h3 class="form-signup-heading">Email</h3>
<div class="inner-addon left-addon">
<i class="glyphicon glyphicon-envelope"></i>
<input name="email" type="email" class="form-control" id="email" placeholder="email@example.com" required >
</div>
<div id="error_msg_email" class="validation" style="display: none;"></div>
<hr class="style-five">
<br>
<h3 class="form-signup-heading">Memorable word</h3>
<div class="inner-addon left-addon">
<i class="glyphicon glyphicon-lock"></i>
<input name="memorable" type="text" class="form-control" id="memorable" placeholder="More than 10 characters" pattern=".{10,36}" maxlength="36"/>
</div>
<div id="error_msg_mem" class="validation" style="display: none;"></div>
<hr class="style-five">
<br>
<?php
//Retrives and displays challenge questions
require_once("database.php");
$sql = "SELECT * FROM questions where `type` <> 'User defined'";
for($i=1; $i<3; $i++){
echo "<h3 class=form-signup-heading>Question ($i)</h3>";
$result = mysql_query($sql);
// creates drop down menus---------------------------
$name1="cq".$i;
echo "<select class='form-control' name='".$name1."' id='".$name1."'>";
$blank=" ------------------";
echo "<option value='" .$blank . "'>" . $blank. "</option>";
while ($row = mysql_fetch_array($result)){
echo "<option value='" . $row['qno'] . "'>" . $row['question'] . "</option>";
}
$val="Enter own question";
echo "<option value='".$val."'> ".$val."</option>";
echo "</select>";
echo " <div class='inner-addon left-addon'>";
echo " <i class='glyphicon glyphicon-plus-sign'></i> ";
echo "<input name=user_question$i type=text class=form-control id=user_question$i placeholder='Please insert your own question' style='display: none;'/>";
echo " </div> ";
echo " <div class='inner-addon left-addon'>";
echo " <i class='glyphicon glyphicon-question-sign'></i> ";
echo "<input name=answer$i type=text class=form-control id=answer$i placeholder='Please answer the question' />";
echo " </div> ";
}
?>
<br>
<div id="error_msg_ans" class="validation" style="display: none;"></div>
<center> <div id="loading_msg" style="display: none;"></div></center>
<button id="register" class="btn btn-lg btn-primary btn-block" type="submit" >Next step</button>
</form>
</div> </div>
<!-- ******************************************************** -->
</div> </div>
</div> <!-- close the <div class="tab-content"> -->
</form> <!-- close the <form class="form" method="post" id="mainform" name="mainform"> -->
</div>
</div>
<style type="text/css">
.flex {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
}
.flex-child {
-webkit-box-flex: 1 1 auto;
-moz-box-flex: 1 1 auto;
-webkit-flex: 1 1 auto;
-ms-flex: 1 1 auto;
flex: 1 1 auto;
}
hr.style-five {
border: 0 none;
box-shadow: 0 0 10px 1px black;
height: 0;
}
body{
font-family:Arial, Helvetica, sans-serif;
font-size:13px;
}
.info, .success, .warning, .error, .validation {
border: 1px solid;
margin: 8px 0px;
padding:11px 10px 11px 50px;
background-repeat: no-repeat;
background-position: 10px center;
}
.info {
color: #00529B;
background-color: #BDE5F8;
background-image: url('info.png');
}
.success {
color: #4F8A10;
background-color: #DFF2BF;
background-image:url('success.png');
}
.warning {
color: #9F6000;
background-color: #FEEFB3;
background-image: url('warning.png');
}
.error {
color: #D8000C;
background-color: #FFBABA;
background-image: url('static/images/error.gif');
}
.validation {
color: #D63301;
background-color: #FFCCBA;
background-image: url('static/images/validation.png');
}
</style>
<script src="http://codepen.io/assets/libs/fullpage/jquery.js"></script>
<script src="/static/script/account.js"></script>
<?php
//include header template
require('static/layout/footer.php');
?>