forked from cisywen/cours-git-a2-exercice-web3
/
register.php
60 lines (49 loc) · 1.19 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
58
59
60
<?php session_start();
require('config/config.php');
require('model/functions.fn.php');
/********************************
PROCESS
********************************/
if(isset($_POST) && !empty($_POST)) {
/* isEmailAvailable
return :
true if available
false if not available
$db -> database object
$email -> field value : email
*/
$email_ok = isEmailAvailable($db, "git@initiation.com");
/* isUsernameAvailable
return :
true if available
false if not available
$db -> database object
$username -> field value : username
*/
$username_ok = isUsernameAvailable($db, "Git");
if ($email_ok && $username_ok) {
/* userRegistration
return :
true for registration OK
false for fail
$db -> database object
$username -> field value : username
$email -> field value : email
$password -> field value : password
*/
userRegistration($db, "Git", "git@initiation.com", "password");
header('Location: login.php');
}
if (!$email_ok) {
//
}
if (!$username_ok) {
//
}
}
/********************************
VIEW
********************************/
include 'view/_header.php';
include 'view/register.php';
include 'view/_footer.php';