-
Notifications
You must be signed in to change notification settings - Fork 0
/
lostpassword2.php
executable file
·39 lines (34 loc) · 1.31 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
39
<?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['lost_user_id']&&($vcode!= $_SESSION["vcode"]||$vcode==""||$vcode==null) ){
echo "<script language='javascript'>\n";
echo "alert('Verify Code Wrong!');\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='".pwGen($lost_key)."'WHERE `user_id`='".mysql_real_escape_string($lost_user_id)."'";
if(
$_SESSION['lost_user_id']==$lost_user_id &&
$_SESSION['lost_key']==$lost_key
){
$result=mysql_query($sql);
$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
?>