-
Notifications
You must be signed in to change notification settings - Fork 2
/
performlogin.php
49 lines (29 loc) · 1003 Bytes
/
performlogin.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
<?php
require('app.php');
if(
array_key_exists('recordnumber', $_GET) &&
array_key_exists('dobdd', $_GET) &&
array_key_exists('dobmm', $_GET) &&
array_key_exists('dobyy', $_GET)
) {
$recordnumber = $_GET['recordnumber'];
$dobstr = $_GET['dobdd'] . "/" . $_GET['dobmm'] . "/" . $_GET['dobyy'];
$authResult = PupilAuth::performLogin($recordnumber, $dobstr);
if($authResult[0] == "success") {
//Redirect to homepage
header( 'Location: home.php' ) ;
exit;
}else {
//Login failed
if($authResult[1] == "User already logged in") {
//Redirect to homepage
header( 'Location: home.php' ) ;
}
header( 'Location: index.php?failure=1' ) ;
exit;
}
}else {
// Login submission was incorrect
header( 'Location: index.php?failure=1' ) ;
exit;
}