$Username = ‘demo’; // Set your username here
$Password = ‘demo’; // Set your password here
if (isset($_POST[‘submit_pwd’])){
$pass = isset($_POST[‘usernm’]) ? $_POST[‘usernm’] : ‘’;
$pass = isset($_POST[‘passwd’]) ? $_POST[‘passwd’] : ‘’;
if ($pass != $Password) {
showForm(“Sorry, incorrect password, please try again”);
exit();
}
} else {
showForm();
exit();
}
I would like to also check a username, how can I add this to check password and username please? I guess I need to add both if statements together somehow?
($pass != $Username)
$Username = ‘demo’; // Set your username here
$Password = ‘demo’; // Set your password here
if (isset($_POST[‘submit_pwd’])){
$usernm = isset($_POST[‘usernm’]) ? $_POST[‘usernm’] : ‘’;
$pass = isset($_POST[‘passwd’]) ? $_POST[‘passwd’] : ‘’;
if ($pass != $Password || $usernm != $Username) {
showForm(“Sorry, incorrect username and/or password, please try again”);
exit();
}
} else {
showForm();
exit();
}
How could I go about MD5 incripting my username and passwords? Any help would be cool, cheers in advance 
<?php
$Username = ‘demo’; // Set your username here
$Password = ‘demo’; // Set your password here
if (isset($_POST[‘submit_pwd’])){
$usernm = isset($_POST[‘usernm’]) ? $_POST[‘usernm’] : ‘’;
$pass = isset($_POST[‘passwd’]) ? $_POST[‘passwd’] : ‘’;
if ($pass != $Password || $usernm != $Username) {
showForm(“Sorry, incorrect username and/or password, please try again”);
exit();
}
} else {
showForm();
exit();
}
?>
Don’t md5 the username. Just the password.
$Username = ‘demo’; // Set your username here
$Password = md5(‘demo’); // Set your password here
if (isset($_POST[‘submit_pwd’])){
$usernm = isset($_POST[‘usernm’]) ? $_POST[‘usernm’] : ‘’;
$pass = md5(isset($_POST[‘passwd’]) ? $_POST[‘passwd’] : ‘’);
if ($pass != $Password || $usernm != $Username) {
showForm(“Sorry, incorrect username and/or password, please try again”);
exit();
}
} else {
showForm();
exit();
}
You can also use the crypt() function.
$Username = 'demo'; // Set your username here
$Password = [COLOR=Red]crypt('demo');[/COLOR] // Set your password here
if (isset($_POST['submit_pwd'])){
$usernm = isset($_POST['usernm']) ? $_POST['usernm'] : '';
[COLOR=SeaGreen][/COLOR]$pass = [COLOR=Red]crypt([/COLOR][COLOR=Red]isset($_POST['passwd']) ? [/COLOR][COLOR=Red]$_POST['passwd'] : '');[/COLOR]
if ($pass != $Password || $usernm != $Username) {
showForm("Sorry, incorrect username and/or password, ".
"please try again");
exit();
}
} else {
showForm();
exit();
}
ah ok cool, thanks, I’ve got this running on a page prtotec basis the only issue is, I want to protect a few pages in my structure ( they could all go in one directory ) but have to enter password each time, I assume I can pass the info when logged in with a session can I when logged in? just looking at that now, any advice would be very handy, cheers guys 
