-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
83 lines (83 loc) · 3.19 KB
/
Copy pathindex.php
File metadata and controls
83 lines (83 loc) · 3.19 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
76
77
78
79
80
81
82
83
<?php
require('control/control.php');
session_start();
try
{
if (isset($_SESSION["id"]))
header("Location: home.php");
else if (isset($_GET["action"]) && $_GET["action"] == "reg")
require("view/register.php");
else if (isset($_GET["action"]) && $_GET["action"] == "reg1")
{
if (!isset($_POST["mail"]) || !isset($_POST["pwd"]) || !isset($_POST["user"]))
throw new Exception("set the Posts values !");
else if (is_array($_POST["mail"]) || is_array($_POST["pwd"]) || is_array($_POST["user"]))
throw new Exception("Do not give me an array !");
else if (empty($_POST["mail"]) || empty($_POST["pwd"]) || empty($_POST["user"]))
throw new Exception("Fields should not be empty !");
else
{
addUser($_POST["user"], $_POST["mail"], $_POST["pwd"]);
}
}
else if (isset($_GET["action"]) && $_GET["action"] == "conx")
{
if (!isset($_POST["pwd"]) || !isset($_POST["user"]))
throw new Exception("set the Posts values !");
else if (is_array($_POST["pwd"]) || is_array($_POST["user"]))
throw new Exception("Do not give me an array !");
else if (empty($_POST["pwd"]) || empty($_POST["user"]))
throw new Exception("Fields should not be empty !");
else
{
conn($_POST["user"], $_POST["pwd"]);
}
}
elseif (isset($_GET["action"]) && $_GET["action"] == "verify")
{
if (!isset($_GET["key"]) || is_array($_GET["key"]) || empty($_GET["key"]))
throw new Exception("Invalide validation !");
else
{
$key = $_GET["key"];
KeyChecker($key);
}
}
elseif (isset($_GET["action"]) && $_GET["action"] == "forget1")
require("view/forget.php");
elseif (isset($_GET["action"]) && $_GET["action"] == "getmail")
{
if (!isset($_POST["mail"]) || is_array($_POST["mail"]) || empty($_POST["mail"]))
throw new Exception("Fields should not be empty !");
else
checkMail($_POST["mail"]);
}
elseif (isset($_GET["action"]) && $_GET["action"] == "forget")
{
if (!isset($_GET["key"]) || is_array($_GET["key"]) || empty($_GET["key"]))
throw new Exception("Invalide validation !");
else
{
$key = $_GET["key"];
KeyChecker2($key);
}
}
elseif (isset($_GET["action"]) && $_GET["action"] == "getpwd")
{
if (!isset($_GET["key"]) || is_array($_GET["key"]) || empty($_GET["key"]))
throw new Exception("Invalide validation !");
else
{
$key = $_GET["key"];
$pwd = $_POST["pwd"];
renewPwd($key, $pwd);
}
}
else
require("view/login.php");
}
catch (Exception $e)
{
$erreur = 'Erreur : ' . $e->getMessage();
require('view/error.php');
}