-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvalidation.php
45 lines (37 loc) · 1.11 KB
/
validation.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
<?php
function check_dir($login){
if (is_dir("users/".$login) == false){
mkdir("users/".$login);
}
}
session_start();
require 'sql.php';
header('Content-Type: application/json');
$login = $_GET['p1'];
$hash = $_GET['p2'];
$select = select("SELECT * FROM user WHERE login = '$login'")[0];
if ($login == $select['login']){
if ($select['validated'] == 1)
{
header('Content-Type: text/html');
?>
<div class="text-center">
<h3 style="color:red;">Your account is allready active !</h3>
<a href="index.php">Go take pictures ?</a>
</div>
<?php
require 'footer.php';
exit ;
}
$hmail = hash('whirlpool', $select['mail']);
if ($hmail == $hash){
$sql = "UPDATE user SET validated = 1 WHERE login = '$login'";
insert($sql);
check_dir($login);
// $_SESSION['loggued_on_user'] = $select['pseudo'];
$folder = substr_replace ($_SERVER['REQUEST_URI'], '', strrpos($_SERVER['REQUEST_URI'],'/'));
$home = "http://".$_SERVER['HTTP_HOST'].$folder;
header("Location: $home");
}
}
?>