-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlostpassword2.php
38 lines (33 loc) · 1.25 KB
/
lostpassword2.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
<?php
require_once('./include/db_info.inc.php');
require_once('./include/setlang.php');
$view_title = "Welcome To Online Judge";
require_once("./include/const.inc.php");
require_once("./include/my_func.inc.php");
$lost_user_id = $_POST['user_id'];
$lost_key = $_POST['lost_key'];
$vcode = trim($_POST['vcode']);
if ($lost_user_id == $_SESSION[$OJ_NAME . '_' . 'lost_user_id'] && ($vcode != $_SESSION[$OJ_NAME . '_' . "vcode"] || $vcode == "" || $vcode == null)) {
echo "<script language='javascript'>\n";
echo "alert('验证码错误!');\n";
echo "history.go(-1);\n";
echo "</script>";
exit(0);
}
if (get_magic_quotes_gpc()) {
$lost_user_id = stripslashes($lost_user_id);
$lost_key = stripslashes($lost_key);
}
$sql = " update `users` set password=? WHERE `user_id`=?";
if (
$_SESSION[$OJ_NAME . '_' . 'lost_user_id'] == $lost_user_id &&
$_SESSION[$OJ_NAME . '_' . 'lost_key'] == $lost_key
) {
$result = pdo_query($sql, pwGen($lost_key), $lost_user_id);
$view_errors = "Password Reseted to the key you've just inputed.Click <a href=index.php>Here</a> to login!";
} else {
$view_errors = "Password Reset Fail";
}
require "template/$OJ_TEMPLATE/error.php";
/////////////////////////Template
/////////////////////////Common foot