Errica
04-27-2006, 06:03 PM
I'm using this simple php login script and I'd like to have a link that will let you log out. How is it done?
<?php
// Designate your username and password
$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']; ?>">
<p><label for="user">Username:</label><br>
<input type="text" title="Please enter your Username" name="user"></p>
<p><label for="pass">Password:</label><br>
<input type="password" title="Please enter your Password" name="pass"></p>
<p><input type="submit" name="Submit" value="Login"></p>
</form>
<?php
}
else {
?>
<!-- Place your Password Protected content here -->
<p>Content.</p>
<?php
}
?>
<?php
// Designate your username and password
$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']; ?>">
<p><label for="user">Username:</label><br>
<input type="text" title="Please enter your Username" name="user"></p>
<p><label for="pass">Password:</label><br>
<input type="password" title="Please enter your Password" name="pass"></p>
<p><input type="submit" name="Submit" value="Login"></p>
</form>
<?php
}
else {
?>
<!-- Place your Password Protected content here -->
<p>Content.</p>
<?php
}
?>