-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalid.php
More file actions
35 lines (32 loc) · 1.12 KB
/
Copy pathvalid.php
File metadata and controls
35 lines (32 loc) · 1.12 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
<?php
// new user
if (isset($_POST["newUser"])) {
require_once "./DatabaseAdapter.php";
session_start();
$_SESSION['firstName'] = $_POST['firstName'];
$_SESSION['lastName'] = $_POST['lastName'];
$_SESSION['username'] = $_POST['username'];
$theDBA->addUser($_POST['firstName'], $_POST['lastName'], $_POST['username'], $_POST['password']);
header("Location: ./valid.php");
} // login
else if (isset($_POST["login"])) {
require_once './DatabaseAdapter.php';
$member = $theDBA->logIn($_POST['username'], $_POST['password']);
if ($member == true) {
session_start();
$_SESSION['firstName'] = $theDBA->firstName($_POST['username']);
$_SESSION['lastName'] = $theDBA->lastName($_POST['username']);
$_SESSION['username'] = $_POST['username'];
// if they have an account!!!!
if ($_SESSION['username'] == "admin") {
header("Location: ./form.html");
}
} else {
session_start();
$_SESSION['error'] = - 1;
header("Location: ./login.php");
}
} else {
require_once ("./index.html");
}
?>