-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauth.php
More file actions
45 lines (38 loc) · 1.31 KB
/
auth.php
File metadata and controls
45 lines (38 loc) · 1.31 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
<?php
include 'bootstrap/init.php';
if($_SERVER['REQUEST_METHOD'] == 'POST') {
if($_GET['action'] == 'signup') {
if(isset($_POST['user-up']) && isset($_POST['email-up']) && isset($_POST['pass-up'])) {
if(strlen($_POST['user-up']) < 4) {
massage_error('Please enter more than 4 characters for username');
}
else if(strlen($_POST['pass-up']) < 8){
massage_error('Please enter more than 8 characters for PassWord');
}
else {
if(signUpUser($_POST)) {
massage_success('Registration was successful ... UPDATE');
header('Location:'.site_url('index.php'));
}
}
}
else {
massage_error('FILL THE INPUT');
}
}
if($_GET['action'] == 'login') {
if(isset($_POST['email-in']) && isset($_POST['pass-in'])) {
if(signInUser($_POST)) {
massage_success('Registration was successful');
header('Location:'.site_url('index.php'));
}
else {
massage_error('Your password or email is not correct !');
}
}
else {
massage_error('FILL THE INPUT');
}
}
}
include 'views/tpl-auth.php';