-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathaction.php
55 lines (44 loc) · 1.19 KB
/
action.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
<?php
session_start();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$name = $_POST['fullname'];
$email = $_POST['email'];
$houseId = $_POST['house_id'];
$password = $_POST['password'];
$errors = [];
$inputs = [
'fullname' => $name,
'email' => $email,
'house_id' => $houseId,
'password' => $password
];
if (empty($name)) {
$errors['fullname'] = [
'message' => 'İsim soyisim girilmesi zorunludur',
'old_input' => $name
];
}
if (empty($email)) {
$errors['email'] = [
'message' => 'Eposta adresi girilmesi zorunludur',
'old_input' => $email
];
}
if (empty($houseId)) {
$errors['house_id'] = [
'message' => 'Bina seçilmesi zorunludur',
'old_input' => $houseId
];
}
if (empty($password)) {
$errors['password'] = [
'message' => 'Parola girilmesi zorunludur',
'old_input' => null
];
}
$_SESSION['inputs'] = $inputs;
}
if (isset($errors)) {
$_SESSION['errors'] = $errors;
}
header("Location: http://potterhead.test/register.php");