-
Notifications
You must be signed in to change notification settings - Fork 0
/
doregister.php
29 lines (25 loc) · 854 Bytes
/
doregister.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
<?php
include 'models/expire.php';
include 'models/users.php';
include 'models/database.php';
include 'models/datetime.php';
if ( isset( $_POST[ 'username' ] ) && isset( $_POST[ 'password' ] ) && isset( $_POST[ 'e-mail' ] ) ) {
$username = $_POST[ 'username' ];
$password = $_POST[ 'password' ];
$email = $_POST[ 'e-mail' ];
$now = datetime();
$exists = UserExists( $username );
if ( !$exists ) {
$userid = CreateUser( $username, $password, $email, $now);
setcookie( 'username' , $username , $expire );
setcookie( 'userid' , $userid , $expire );
header( 'Location: index.php' );
}
else {
header( 'Location: register.php?exists=true' );
}
}
else {
header( 'Location: register.php?missing=true' );
}
?>