/
forgetpass.php
99 lines (88 loc) · 2.71 KB
/
forgetpass.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
<?php
/**
* Created by PhpStorm.
* User: Shanika-Edirisinghe
* Date: 12/08/15
* Time: 11:47
*/
require_once 'core/init.php';
require 'SMS/sms.php';
require 'Files/accessFile.php';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Forgot password | page</title>
<?php include 'headerScript.php'?>
</head>
<body>
<div>
<?php
include "header.php";
?>
</div>
<div id="mainWrapper" class="backgroundImg container-fluid">
<br>
<div id="ForgotPassword" class="jumbotron col-sm-6 col-sm-offset-3">
<?php
if(Input::exists()){
if(Token::check(Input::get('token'))) {
$validate = new Validate();
$validation = $validate->check($_POST, array(
'name' => array(
'required' => true
)
));
$uname = Input::get('name');
if($validation->passed()){
$user1 = new User();
if($user1->find($uname)){
// echo "User exist";
echo "<div class='text text-info'><strong>User Found. Click on your username to continue.</strong></div>";
?>
<p> <a href="forgetpassCheckPoint.php" onclick="return confirm('Are you sure?')"> <?php echo escape($user1->data()->username); ?> </a> </p>
<?php
$_SESSION['phone'] = $user1->data()->phone;
$_SESSION['id'] = $user1->data()->id;
$_SESSION['flag'] = 1;
} else {
echo "<script>alert('User Not Found');</script>";
// echo "User Not Found";
}
} else {
$str = "";
foreach ($validation->errors() as $error) {
$str .= $error;
$str .= '\n';
}
echo '<script type="text/javascript">alert("' . $str . '")</script>';
}
}
}
?>
<!--<form action="" method="post">-->
<!-- <div class="field">-->
<!-- <label for="name">Enter your username </label>-->
<!-- <input type="text" name="name" id="name">-->
<!-- </div>-->
<!-- <input type="submit" value="Search">-->
<!-- <input type="hidden" name="token" value="--><?php //echo Token::generate(); ?><!--">-->
<!--</form>-->
<h3><strong>Recover Password</strong></h3>
<form action="" method="POST" class="form-horizontal">
<label>Enter Your Username</label>
<div class="gap ">
<input class="form-control " required id="verification" type="text" name="name" autocomplete="off" placeholder="Username" size="25" maxlength="20"/>
</div>
<input type="hidden" name="token" value="<?php echo Token::generate(); ?>">
<input class="btn btn-default" type="submit" value="Next">
</form>
<div id="names">
</div>
</div>
</div>
<?php
include "footer.php";
?>
</body>
</html>