forked from MakaRax/HabboPHP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmot_de_passe_oublier.php
68 lines (49 loc) · 2.3 KB
/
mot_de_passe_oublier.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
<?php
#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|
#| #|
#| HABBOPHP - http://habbophp.com #|
#| Copyright © 2012 Valentin & Robin. All rights reserved. #|
#| #|
#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|#|
define('CORE','CORE');
require 'includes/core.php';
if(!isset($_GET['key']) OR !Validate::ValideInput(array('key' => 'isClean'))) redirection ($config->url_site.'/');
$key = safe($_GET['key'],'SQL');
$req = $db->query('SELECT pf.* , us.mail FROM habbophp_password_forgotten pf LEFT JOIN users us ON pf.uid = us.id WHERE pf.keysecret="'.$key.'"');
if ($db->NumRowsC() == 0) redirection($config->url_site);
$data = $db->getQuery(true);
if(time() > $data['expire']){
$db->query('DELETE FROM habbophp_password_forgotten WHERE id="'.$data['id'].'"');
redirection($config->url_site.'/');
}
if(isset($_POST['password'])){
$Error = new error();
$s = true ;
if(isset($_POST['password']) && empty($_POST['password'])){
$Error->set('password',$tpl->assign('error_password_empty','true'));
$tpl->assign('error','true');
$s = false ;
}
elseif(strlen($_POST['password']) <= 5)
$Error->set('password',$tpl->assign('error_strlen','true'));
if(isset($_POST['retypedPassword']) && empty($_POST['retypedPassword'])){
$Error->set('retypedPassword',$tpl->assign('error_empty_retypedPassword','true'));
$tpl->assign('error','true');
$s = false ;
}
if(isset($_POST['password']) && isset($_POST['retypedPassword']) && $s == true){
if(trim($_POST['password']) != trim($_POST['retypedPassword'])){
$Error->set('passwordNot',$tpl->assign('error_password_not_egal','true'));
$tpl->assign('error','true');
}
}
if(!$Error->ErrorPresent()){
$password = hashMe($_POST['password']);
$req = $db->query('UPDATE users SET password="'.safe($password,'HTML').'" WHERE id="'.safe($data['uid'],'HTML').'"');
$db->query('DELETE FROM habbophp_password_forgotten WHERE id="'.safe($data['id'],'HTML').'"');
redirection($config->url_site.'/');
}
}
$tpl->assign('email',$data['mail']);
$tpl->display('password_forgotten.tpl');
?>