I want to create a simple login with only a few hard-coded username/password combos which gives access to individual private directories with files that I upload. (mysite.com/user1/, mysite.com/anotheruser/...)
Below are the contents of my mylogin.php.
What approaches are there for me to "password protect" files for download only from this page and by their respective users? The information will not be terribly sensitive, but it should be somewhat secure.
<?php //List of users and their passwords
$users = array(
"myusername" => "mYpaSSw0rd2011",
"anothername" => "password2"
);?>
<html>
<head><title>Private Login</title></head>
<body>
<form method="POST" action="mylogin.php">
Username: <input type="text" name="username" size="15" /><br />
Password: <input type="password" name="password" size="15" /><br />
<input type="submit" value="Login" />
</form>
<?php //check username:password combo
if ( isset($_POST["username"]) && $_POST["username"] != "" && ($users[$_POST["username"]] == $_POST["password"])
//*******************************************************
//list (private) files in mysite.com/username's directory
//*******************************************************
}?>
</body></html>