Posted by jan metzger on 12/28/05 05:46
this is what you want to do...
read your manual!
http://www.php.net/docs.php
Jan Metzger
<?php
echo '<?xml version="1.0" encoding="utf-9"?>';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/Strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
<head>
<title>Login</title>
</head>
<body>
<?php
if(!isset($_POST['name']) AND !isset($_POST['password'])):
// Visitor needs to enter a name and password
?>
<h1>Please Log In</h1>
This page is secret.
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"
name="login">
<fieldset class="login">
<legend>Login</legend>
<label for="name">Name:</label>
<input type="text" name="name" /><br />
<label for="password">Password:</label>
<input type="password" name="password" /><br />
<input type="submit" value="Log In" /><br />
</fieldset>
</form>
<?php
elseif($_POST['name']=="user" AND $_POST['password']=="pass"):
// visitor's name and password combination are correct
echo " <h1>Here it is!</h1>";
echo " I bet you are glad you can see this secret page.";
else:
// visitor's name and password combination are not correct
echo "<h1>Go Away!</h1>";
echo "You are not authorized to view this resource.";
endif;
?>
</body>
</html>
Navigation:
[Reply to this message]
|