Cookie Implementation
Posted: Wed May 19, 2004 9:25 am
How can i implement a cookie to by-pass the login for this script... (im a right beginner so detailed explanation wud b helpful)
Code: Select all
<html>
<head>
<title>password protection test</title>
</head>
<body>
<?php
// Define your username and password
$username = "user";
$password = "password";
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 {
?>
<p>This is the protected page. Place your content here.</p>
<?php
}
?>
</body>
</html>