forked from open-austin/council-connect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.php
executable file
·44 lines (25 loc) · 878 Bytes
/
login.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
<?php // login.php
session_start();
$_SESSION ['err'] = '';
require_once 'Util.php';
require_once 'User.php';
require_once 'DatabaseUsPsDb.php';
$atxcc_us = new User ();
if ($_POST) {
$username = $_POST ['username'];
$password = $_POST ['password'];
$err = '';
$server = $_SERVER ['SERVER_NAME'];
$urlRedirect = 'http://' . $server . '/atxcc';
if (! $atxcc_us -> getIdx ($username)) {
$err = "user: '$username' does not exist";
$urlRedirect = $urlRedirect . '/alogin';
} elseif (! $atxcc_us -> doAuth ($username, $password)) {
$err = "password does not match";
$urlRedirect = $urlRedirect . '/alogin';
} else {
$_SESSION ['user'] = $username;
} // end if ($atxcc_us -> getIdx ($username))
$_SESSION ['err'] = $err;
Util::redirect ($urlRedirect);
} // end if ($_POST)