-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrejestracja_potwierdzenie.php
52 lines (39 loc) · 1.7 KB
/
rejestracja_potwierdzenie.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
<?php
@include_once(__DIR__.'/modules/start.php');
?>
<?php
@include_once(__DIR__.'/classes/User.php');
$_SESSION['register'] = TRUE;
if(isset($_POST['first']) && isset($_POST['last']) && !empty($_POST['first']) && !empty($_POST['last'])) {
if(isset($_POST['email']) && !empty($_POST['email'])) {
if(isset($_POST['password1']) && isset($_POST['password2']) && !empty($_POST['password1']) && !empty($_POST['password2'])) {
$result = User::registerUser($_POST['first'], $_POST['last'], $_POST['email'], $_POST['password1'], $_POST['password2']);
if($result[0] === "success") {
echo "Success";
unset($_SESSION['register']);
} else {
$_SESSION['register_error'] = $result[1];
$_SESSION['register_name_1'] = $_POST['first'];
$_SESSION['register_name_2'] = $_POST['last'];
$_SESSION['register_email'] = $_POST['email'];
header("Location: rejestracja.php");
}
} else {
$_SESSION['register_error'] = "Brak hasła!";
$_SESSION['register_name_1'] = $_POST['first'];
$_SESSION['register_name_2'] = $_POST['last'];
$_SESSION['register_email'] = $_POST['email'];
header("Location: rejestracja.php");
}
} else {
$_SESSION['register_error'] = "Brak emaila!";
$_SESSION['register_name_1'] = $_POST['first'];
$_SESSION['register_name_2'] = $_POST['last'];
header("Location: rejestracja.php");
}
} else {
$_SESSION['register_error'] = 'Brak imienia lub nazwiska!';
header("Location: rejestracja.php");
}
@include_once(__DIR__.'/modules/end.php');
?>