コード例 #1
0
<?php

require_once 'functions.php';
require_once 'output_fns.php';
$db = db_connect();
// Start a secure session
sec_session_start();
do_header('Power Manager');
// Make a header with the title in quote marks.
if (login_check($db) == false) {
    // User is not logged in.
    do_login_page('Please login to use this site.');
    exit;
}
do_nav_bar();
start_content();
?>
<script type="text/javascript">
    $(document).ready(function() {
        // Set up AJAX requests
        $.ajaxSetup({
            cache: false,
            beforeSend: function() {
                // Dim ajax_content div while content loads
                $("#ajax_content").fadeTo('fast', 0.25);
                // Fade overlay div in
                $('#overlay').fadeIn('fast')
            },
            complete: function() {
                // Fade ajax_content div when content loads
                $("#ajax_content").fadeTo('fast', 1);
コード例 #2
0
require_once 'functions.php';
require_once 'output_fns.php';
$db = db_connect();
// Start a secure session
sec_session_start();
$redirect_url = '/';
if (isset($_POST['username'], $_POST['p'])) {
    // Try to log in user if all necessary POST data was sent
    $username = $_POST['username'];
    $password = $_POST['p'];
    // The hashed password.
    if (login($username, $password, $db) == true) {
        // Login success
        do_header('Logged In');
        start_content();
        echo '<h2 align="center"><img src="ajax-loader.gif" style="vertical-align: middle "/>&nbsp;Loading...</h2>';
        echo '<meta http-equiv="refresh" content="0;URL=' . $redirect_url . '">';
        echo '<p align="center"><a href="' . $redirect_url . '">Click here if you are not redirected within 5 seconds.</a></p>';
        do_footer();
    } else {
        // Login failed
        do_header('Login Failed');
        $GLOBALS['username'] = $username;
        do_login_page('Incorrect username or password. Please try again.');
        echo "<script type=\"text/javascript\">document.forms['login_form'].elements['password'].focus();</script>";
    }
} else {
    // The correct POST variables were not sent to this page.
    do_header('Login Failed');
    do_login_page('Invalid request. Please try again.');
}
コード例 #3
0
<?php

require_once 'functions.php';
require_once 'output_fns.php';
sec_session_start();
// Unset all session values
$_SESSION = array();
// get session parameters
$params = session_get_cookie_params();
// Delete the actual cookie.
setcookie(session_name(), '', time() - 42000, $params["path"], $params["domain"], $params["secure"], $params["httponly"]);
// Destroy session
session_destroy();
do_header('Log Off');
do_login_page('Logout successful.');
コード例 #4
0
ファイル: login.php プロジェクト: vstorm83/ausport
	login script
*/
if (isset($_POST['username']) && isset($_POST['password'])) {
    // we have a login request
    if ($userinfo['username'] == $_POST['username'] && $userinfo['password'] == $_POST['password']) {
        $_SESSION['username'] = $userinfo['username'];
        //echo "howdy!";
    } else {
        $error_message = '<div class="messages"><span><span style="font-weight:bold; color:#C31F2A;">Oh Snap!</span> Your login details are incorrect.</span></div>';
        do_login_page($error_message);
        exit;
    }
} else {
    if (isset($_SESSION['username']) && trim($_SESSION['username']) != "") {
    } else {
        do_login_page($error_message);
        exit;
    }
}
/*
if( 
	( isset( $_POST['username'] ) && isset( $_POST['password'] ) ) ||
	(  )
	
) {
    if( $userinfo['username'] == $_POST['username'] && $userinfo['password'] == $_POST['password']) {
        $_SESSION['username'] = $_POST['username'];
		
		
    } else {