I want to password protect a page. Thats why I have created this script. The only problem is that after login I have to reftesh the window one time to hide the login window and see the contents of the page.
Here is the script
[code]
<?php
session_start();
if($_SESSION[‘logedin’] == ‘vmesid’)
{
echo “This is the content”;
}
?>
<?php
session_start();
if($_SESSION[‘logedin’] != ‘vmesid’)
{
echo “<html>”;
echo “<body>”;
echo “<form method=post>”;
echo “<center><table>”;
echo “<tr><td>Enter Password Protected Area</td>”;
echo “</tr><tr><td>Username: <input type=text name=username size=15></td>”;
echo “</tr><tr><td>Password: <input type=password name=password size=15></td>”;
echo “</tr><tr><td><input name=Submit type=submit value=Login></td></tr></table>”;
echo “</form>”;
echo “</body>”;
echo “</html>”;
}
if ($_POST[‘Submit’]) {
if($_POST[‘username’] == ‘123’ && $_POST[‘password’] == ‘123’ )
{
session_start();
$_SESSION[‘logedin’] = ‘vmesid’;
}
}
}
?>
What could be wrong with script ???
Any suggestion !