I am fairly a newbie to PHP and i am starting experimenting, how to implement a password protection to access a page. I have tried the following script, and it seems to work fine, however, i would like to ask, if this script is simple to break through to get the user/pass.
<?php
$username = "user";
$password = "pass";
if ($_POST["user"] != $username || $_POST["pass"] != $password)
{
?>
<h1>Login</h1>
<form name="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
UserName:<br /><input type="text" name="user" /><br />
Password:<br /><input type="password" name="pass" />
<input type="submit" name="Submit" value="Login" />
</form>
<?php
}
else {
?>
<p>Access to Page</p>
<?php
}
?>
Thank you for any feedback