$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'; }