Simple Session Login
Okay this is really basic if you ask me...heh..
Okay just make a file named index.php or what ever you would like really.
In it type something like:
Code
<?php
session_start(); //allow sessions
$username = "user"; //username variable change with the username you wish to use
$password = "pass"; //password variable, change this to what you wish it to be
if(!isset($_SESSION[user]) && !isset($_SESSION[pass]) && !$_POST[login]){ //checks login and that the form was not submitted
?>
<form method="post">
<b>Username</b>:<br />
<input type="text" name="user" size="15"><Br />
<b>Password</b>:<br />
<input type="password" name="pass" size="15"><br />
<input type="submit" name="login" value="Login"><br />
</form><!-- this is the form area and such things-->
<?
}elseif(!isset($_SESSION[user]) && !isset($_SESSION[pass]) && $_POST[login]){ //check if form was submitted and the sessions are not set
if($_POST[user] !== $username || $_POST[pass] !== $password){ //check if user or password were wrong
echo "<b>Error</b>: Invalid Username/Password"; //the error
}else{ //or go on
$u = md5(sha1($_POST[user])); //secure username
$p = md5(sha1($_POST[pass])); //secure password
$_SESSION[user] = $u; //set session
$_SESSION[pass] = $p; //set session
echo "You Have Been Logged In Please Wait While You Are Redirected."; //success and redirect
} //end post checking
}elseif(isset($_SESSION[user]) && isset($_SESSION[pass])){ //sessions are set check
?>
<!--this is where the hidden content goes-->
<h4>Welcome</h4>
<p>Hidden Content Here</p>
<?
} //end the session check and the post check thing...
?>
That should be it and yes this does work i have tried it on my localhost.