
<form action=login.php method=post>
Username: <input type=text name=username><br>
Password: <input type=text name=password><br>
<input type=submit value=Login></form><?php
// BASIC LOGIN SCRIPT USING HARDCODED CREDENTIALS
// BY TIM [ [email protected] ]
( !isset( $_POST['username'] ) || !isset( $_POST['password'] ) ) ? die('Insufficient login elements completed') : '';
$auth = array();
// Insert your usernames and passwords like so.....
// $auth['username'] = 'password';
// ie. should your user be tim and your pass be test
// you would do:
// $auth['tim'] = 'test';
$auth['tim'] = 'test';
$auth['idiot'] = 'password';
$auth['example'] = 'example';
// NOTE: ONLY UNCOMMENT ONE OF THE BELOW LINES
// Uncommment the line below if you want to use plaintext passwords
// if ( $auth[$_POST['username']] == $_POST['password'] ) {
// Uncomment the line below if you want to use encrypted passwords
// if ( $auth[$_POST['username']] == sha1($_POST['password']) ) {
header('Redirect: http://my.website.com/secure_page');
} else {
die('Incorrect login details provided');
}
?>

Return to General Webmastering
Users browsing this forum: No registered users and 1 guest