-
Notifications
You must be signed in to change notification settings - Fork 1
/
register.php
57 lines (42 loc) · 1.32 KB
/
register.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
<?php
require './includes/init.php';
$msg = "";
if (isPost()) {
$email = escapeString($_POST['email']);
$password = escapeString($_POST['password']);
$cpassword = escapeString($_POST['cpassword']);
$firstname = escapeString($_POST['firstname']);
$lastname = escapeString($_POST['lastname']);
$noError = true;
if ($password != $cpassword) {
addFlashMessage("رمز و تاییدیه برابر نیست");
$noError = false;
}
if (empty($password)) {
addFlashMessage("رمز وارد نشده");
$noError = false;
}
if (empty($firstname)) {
addFlashMessage("نام وارد نشده");
$noError = false;
}
if (empty($lastname)) {
addFlashMessage("نام خانوادگی وارد نشده");
$noError = false;
}
if (empty($email)) {
addFlashMessage("ایمیل وارد نشده");
$noError = false;
}
if ($noError == false) {
redirect($_SERVER['PHP_SELF']);
}
$register = new Register();
if ($register->create($email, $password, $firstname, $lastname)) {
redirect("login.php");
} else {
addFlashMessage("خطایی رخداده");
redirect($_SERVER['PHP_SELF']);
}
}
echo $twig->render('register.html.twig', array("message" => $msg));