How can i implement a cookie to by-pass the login for this script... (im a right beginner so detailed explanation wud b helpful)
<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>look in the php manual or <!-- w --><a class="postlink" href="http://www.php.net">www.php.net</a><!-- w --> for setcookie(). this will tell you how to make a cookie in php.:s
I HAVE NO IDEA... LOLif you're not going to take the time to read then neither do I, LOLi did read it... but i dont understand it all.it gives you examples, how is that hard to understand?ur right...
<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>look in the php manual or <!-- w --><a class="postlink" href="http://www.php.net">www.php.net</a><!-- w --> for setcookie(). this will tell you how to make a cookie in php.:s
I HAVE NO IDEA... LOLif you're not going to take the time to read then neither do I, LOLi did read it... but i dont understand it all.it gives you examples, how is that hard to understand?ur right...