-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathrequest_password.php
More file actions
75 lines (64 loc) · 1.98 KB
/
request_password.php
File metadata and controls
75 lines (64 loc) · 1.98 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
<?php
include 'init.php';
$pf = $_REQUEST['pf'];
function ShowFormRequestPassword() {
global $tpl, $error_list, $success;
$email = $_REQUEST['email'];
$process = $_REQUEST['process'];
$success = $_REQUEST['success'];
$tpl->assign('email',$email);
$tpl->assign('error',$error_list);
$tpl->assign('pf',$_REQUEST['pf']);
$tpl->display('request_password.html');
}
function ProcessRequestPassword() {
global $tpl, $user, $error_list, $mail, $success;
$success = $_REQUEST['success'];
$email = $_REQUEST['email'];
$process = $_REQUEST['process'];
$check_email = $user->CheckEmailExist($email);
$i = 0;
if ($process == '1') {
if ($email == '') {
$error_list[$i] = _("Please enter your email address.");
$i++;
}
elseif(!IsEmailAddress($email)) {
$error_list[$i] = _("Email is not valid.");
$i++;
}
elseif (!$check_email) {
$error_list[$i] = _("Email doesnt exist.");
$i++;
}
else {
$username = $check_email['username'];
$password = $user->RandomPassword($check_email['user_id']);
$firstname = $check_email['firstname'];
$lastname = $check_email['lastname'];
$from_email = CFG_NOTIFY_EMAIL;
$from_name = CFG_NOTIFY_FROM;
$mail->RequestPasswordEmail(CFG_SITE_NAME,$username,$password,$firstname,$from_email,$from_name,$email);
header("Location: request_password.php?pf=success");
}
}
}
function ShowFormSuccess() {
global $tpl, $succces;
$tpl->assign('success',$_REQUEST['success']);
$tpl->assign('pf',$_REQUEST['pf']);
$tpl->display('request_password.html');
}
//show page
if (empty($pf)) {
ProcessRequestPassword();
ShowFormRequestPassword();
}
elseif ($pf == 'browse') {
ProcessRequestPassword();
ShowFormRequestPassword();
}
elseif ($pf == 'success') {
ShowFormSuccess();
ProcessRequestPassword();
}