-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnewAccount.php
More file actions
47 lines (38 loc) · 1.1 KB
/
newAccount.php
File metadata and controls
47 lines (38 loc) · 1.1 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
46
47
<?php
require_once 'debugSettings.php';
require_once 'DBSessionHandler.php';
require_once 'CredentialsHandler.php';
require_once '../dbinfo/dbcred.php';
// create a new account
if (isset($_SESSION["loggedin"]) && $_SESSION["loggedin"] === true) {
header("location: index.php");
exit;
}
$email = "";
$name = "";
if (isset($_POST['email']) && isset($_POST['name']) ) {
if (!empty($_POST['email']) && !empty($_POST['name']) ) {
$email = $_POST['email'];
$name = $_POST['name'];
} else {
header("location: login.php?error=true");
exit;
}
}
// Create New Account and log them in...
if ($email != "" && $name != "") {
$credentialsHandler = new CredentialsHandler();
$credentialsHandler->new($email, $name);
if ($credentialsHandler->validate($email)) {
$handler = new DBSessionHandler();
session_set_save_handler($handler);
session_start();
$_SESSION["loggedin"] = true;
$_SESSION['email'] = $email;
header("location: index.php");
exit;
} else {
//header("location: login.php");
}
}
?>