-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.php
92 lines (75 loc) · 5.11 KB
/
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
/* ===============================================================================
TO INVOKE MAINTENANCE MODE, GO TO iEMSLoader.php
=============================================================================== */
/* ===============================================================================
------------------------------------login.php----------------------------------
v 1.0
Pre-loader for the login process.
Created by: Marian C. Buford
Conservation Resource Solutions, Inc. (CRS)
Created on: 06.16.2010
License: Proprietary
Copyright: 2010 Conservation Resource Solutions, Inc. All rights reserved.
-------------------------------------Notes-------------------------------------
This page doesn't make sense, until you need you get into a situation where
you need to generate some php variables to be passed into the html file, or if
the result of php calculations determines which html file will be called.
=============================================================================== */
define('APPLICATION', TRUE); // legacy
define('GROK', TRUE); // iEMS 3.0 'cause we spliced some of that work in for 2.2
define('iEMS_PATH', ''); // this is where the root of the site is; defined in all php pages.
require_once iEMS_PATH.'Connections/crsolutions.php'; // in iEMS 3.0, connections get loaded by iEMSLoader
require_once iEMS_PATH.'iEMSLoader.php'; // go here to set maintenance mode
// this contains some tidbits like preDebugger() which will
// <pre> wrap and print_r out any data or variable passed in.
// In iEMS 3.0 Loader also takes care of lazy-loading in php
// objects asthey are needed so we don't need to load everything
// all at once so that we can maintain sub-second logins no matter
// how big the client.
$Loader = new iEMSLoader(false); // true|false indicates whether we will send troubleshooting
// output to iEMS' log/
$User = new User(); // instantiate the iEMS User object. Capital camel case naming for
// objects, lower camel case for functions & variables.
$responseString = '';
if(!empty($_SESSION['iemsID']))
{
//header('location: legal.php');
header('location: index.php');
}
else
{
if(isset($_POST['username']) && isset($_POST['password']))
{
if($User->Login($_POST['username'], $_POST['password']))
{
//$responseString = '<strong>Welcome. You have successfully authenticated.</strong><br />If you are not redirected in a few seconds, please <a href="legal.php">click here to proceed.</a>';
$responseString = '<strong>Welcome. You have successfully authenticated.</strong><br />If you are not redirected in a few seconds, please <a href="index.php">click here to proceed.</a>';
$_SESSION['UserObject'] = $User;
$_SESSION['iemsName'] = $_POST['username'];
$_SESSION['iemsID'] = $User->id();
$_SESSION['iemsDID'] = $User->Domains(0)->id();
$_SESSION['iemsPW'] = $_POST['password'];
//header('location: legal.php');
header('location: index.php');
}
else
{
$responseString = '<div style="color: #2B2B47;">
<p>There was a problem with login.</p>
<p>Please retype your username and password and try again.</p>
<p>If the problem persists contact your Demand Response Provider.</p>
</div>';
}
}
$server = ' :: '.strtoupper(php_uname('n')).' | '.strtoupper(DSN);
$server = null;
require_once('login.html');
}
/* ===============================================================================
TROUBLESHOOTING HELPERS
=============================================================================== */
//$Loader->preDebugger($_POST);
//$Loader->preDebugger($_SESSION);
/* ------------------------------------login.php---------------------------------- */
?>