示例#1
0
<?php

include 'config.php';
include 'functions.php';
session_start();
// how would you go about logging someone in?
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    // 1) get their values
    $username = $_POST['username'];
    $password = $_POST['password'];
    if (validate_user_creds($username, $password)) {
        $_SESSION['username'] = $username;
        header("Location: admin.php");
    } else {
        $status = "incorrect login credentials.";
    }
}
//
//if ( isset($_POST['loginForm'])) {
//	echo 'posted';
//}
?>


<!doctype html>
<html>
	<head>
		<title></title>
	</head>
	<body>
示例#2
0
<?php

include 'config.php';
include 'functions.php';
session_start();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    // get their values
    $username = $_POST['username'];
    $password = $_POST['password'];
    $token = $_POST['token'];
    if (validate_user_creds($username, $password, $token)) {
        $_SESSION['username'] = $username;
        header("Location: admin.php");
    } else {
        $status = "Incorrect login credentials.";
    }
}
// Detect whether a specific form was submitted
// if ( isset($_POST['loginForm'])) {
// 	echo 'posted';
// }
?>

<!doctype html>
<html>
<head>
	<title>Login</title>
</head>
<style>
	form li {
		list-style: none;