Forum Moderators: open
[edited by: tedster at 11:46 pm (utc) on Dec. 4, 2005]
[edit reason] remove hotlink on the IP example [/edit]
When the page that has the program on it is accessed it prompts for a login.
I don't know how exactly you are working with usernames and passwords but something like this may be what you need.
$username = "admin";
$password = "admin";
if ($_POST['txtUsername']!= $username ¦¦ $_POST['txtPassword']!= $password) {
?>
<p>
<b>Login</b>
</p>
<form name="form" method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
<div align="center">
<center>
<table border="0" cellpadding="5" cellspacing="0">
<tr>
<td><label for="txtUsername">Username</label>
</td>
<td><input type="text" title="Enter your Username" name="txtUsername" /></td>
</tr>
<tr>
<td><label for="txtpassword">Password</label>
</td>
<td><input type="password" title="Enter your password" name="txtPassword" /></td>
</tr>
</table>
</center>
</div>
<p align="center"><input type="submit" name="Submit" value="Login" /></p>
</form>
<?php
}
else {
?>
INSERT BODY OF THE PAGE BELOW THE PHP
If you are using a database to store usernames and password you will have to mod this to check the db for names and passwords.