Example #1
0
</script>

<?php 
$php_phase = $_REQUEST['phase'];
if (strcasecmp($php_phase, "initial") == 0) {
    $msg = "<div class=bodytext>Please enter your username and password to login.</div>";
    initial($msg);
} else {
    if (strcasecmp($php_phase, "existing_login") == 0) {
        $connection_id = pre_work();
        existing_login($connection_id);
        post_work($connection_id);
    } else {
        if (strcasecmp($php_phase, "new_login") == 0) {
            $connection_id = pre_work();
            new_login($connection_id);
            post_work($connection_id);
        } else {
            if (strcasecmp($php_phase, "logout") == 0) {
                $msg = "<div class=message>You have been logged out. Enter your password to login again.</div>";
                initial($msg);
            } else {
                if (strcasecmp($php_phase, "login") == 0) {
                    $msg = "<div class=help>You have to be logged in to access VigilerPro features. Enter your password to login below.</div>";
                    initial($msg);
                }
            }
        }
    }
}
?>
Example #2
0
require 'values.php';
require 'functions.php';
html_header("TA Signup");
session_start();
if (!isset($_SESSION['noob'])) {
    //you should only come here from login page.
    session_regenerate_id(true);
    session_write_close();
    header("Location:login.php");
}
if (isset($_POST['signup'])) {
    //check that passwords match.
    if ($_POST['p1'] != $_POST['p2']) {
        $status = array("error-message", "Passwords do not match.");
    } else {
        $status = new_login($_SESSION['ta_id'], $_POST['p1'], $_POST['username']);
        if ($status[0] == "success-message") {
            session_regenerate_id(true);
            session_write_close();
            header("Location:info.php");
        }
    }
}
?>
  <DIV class=header>
    <A HREF="#"><IMG src="https://www.math.ucdavis.edu/themes/math2012/images/math_logo-sub_page.png"></A>
  </DIV>
  <h1> <center>Welcome, 
    <?php 
print $_SESSION['ta_name'];
?>