Example #1
0
function authState()
{
    if (!isset($_SESSION['username'])) {
        return '/index.php';
    } elseif ($_SESSION['username'] == 'admin') {
        return '/function/admin.php';
    } elseif ($_SESSION['signedOut'] == 'Yes') {
        return '/function/signin.php';
    } elseif (signoutAble() == 1) {
        return '/function/signout.php';
    } elseif (signoutChoice() == 0) {
        return '/function/nosignout.php';
    }
}
Example #2
0
  
  <img class="center-block" src="/img/logo.png" height="125" width="125">
    <div class="container">
      <div class="form-signin">
        <h2 class="form-signin-heading">Sign Out</h2>
		  
		  <form role="form" id="signout_form">
<?php 
include_once 'schoolstate.php';
$button_html = <<<EOD
\t\t\t<select class="form-control" id="type_signout" name="type_signout">
\t\t\t  <option value="prefectNum">Prefect Sign Out</option>
\t\t\t  <option value="cakeNum">Cake Break Sign Out</option>
\t\t\t</select>
EOD;
if (signoutChoice() == 'choice') {
    echo $button_html;
}
?>

			<div class="form-group">
				<label for="comments">Reason for signing out:</label>
				<textarea class="form-control" rows="2" name="comments" id="comments" maxlength="250" placeholder="Short description of why you are leaving school" ></textarea>
			</div>
		  </form>
		  
		<button name="signin" id="signin" class="btn btn-lg btn-primary btn-block" type="submit">Sign Out</button>
        <a href="/logout.php" class="btn btn-default btn-lg btn-block">Logout</a>
      </div>
    </div>
	
Example #3
0
    ob_end_flush();
}
function db_signOut($type_signOut, $comments)
{
    date_default_timezone_set('UTC');
    $value = $_SESSION[$type_signOut] - 1;
    $array = array($type_signOut => $value, 'signedOut' => 'Yes', 'timeOut' => date("h:i"), 'comments' => $comments);
    dbUpdate($array);
}
function db_signIn()
{
    $array = array('signedOut' => 'No', 'timeOut' => 'NULL', 'comments' => 'NULL');
    dbUpdate($array);
}
//db_signOut('cakeNum', 'I want to go home mate...');
if (isset($_POST['signIn']) && $_SESSION['signedOut'] == 'Yes') {
    echo 'true';
    ///	file_put_contents('../log/log.php', date("Y/m/d h:i")." - ".$_SESSION['username']."  signed in\n", FILE_APPEND);
    db_signIn();
} elseif (isset($_POST['comments'])) {
    if (isset($_POST['type_signout'])) {
        $type_signOut = $_POST['type_signout'];
    }
    include_once 'schoolstate.php';
    $signoutChoice = signoutChoice();
    if ($signoutChoice == 'cakeNum' || $signoutChoice == 'prefectNum') {
        $type_signOut = $signoutChoice;
    }
    db_signOut($type_signOut, $_POST['comments']);
    echo 'true';
}