|
|
Password Protection
|
|

Password Protection
Save this script as login.php.
Replace http://www.secreturl with url where you want to sand visitors that logged in.
<?php
$status="Login :";
$username = "user";
$password = "pass";
$url = "http://www.secreturl";
$errorurl = "user";
$test=$HTTP_POST_VARS["ftest"];
$user=$HTTP_POST_VARS["fuser"];
$pass=$HTTP_POST_VARS["fpass"];
if($test=="1"){
if($user==$username){
if($pass==$password){
header( "Location: $url" );}
else{
$status="Wrong password !";}}
else{
$status="Wrong username !";}}
?>
<html><head>
<title>Login</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head><body>
<form name="form1" method="post" action="login.php">
<table width="75%" border="0" cellpadding="4" cellspacing="0" bgcolor="#EEEEEE">
<tr>
<td width="30%"> </td>
<td width="70%"><?php print $status; ?></td>
</tr><tr>
<td width="30%"><div align="right">Username : </div></td>
<td width="70%"><input name="fuser" type="text" id="fuser"></td>
</tr><tr>
<td width="30%"><div align="right">Password : </div></td>
<td width="70%"><input name="fpass" type="password" id="fpass"></td>
</tr><tr>
<td width="30%"> </td>
<td width="70%"><input type="submit" name="Submit" value="Submit"> <input name="ftest"
type="hidden" id="ftest" value="1"></td>
</tr></table>
</form>
</body></html>
|
|
|