Zend - The PHP Company




Security

Add Code


Simple Yet Effective PHP Log-in Script  

Type: application
Added by: hazephp
Entered: 24/11/2002
Last modified: 01/11/2001
Rating: - (fewer than 3 votes)
Views: 8219
This simple log in script will password protect one or more of your pages. You can allow different users to go to different sites.


<!-- Save this as a simple *.html document with any name -->
<form action="action.php" method="POST">
      <font face="helvetica" color="black" size="3">Password: </font><input type="password" name="password" style="background: #4682B4; color: white" />
      <br><br><input type="submit" value="Enter" style="background: #6495ED">&nbsp&nbsp<input type="reset" value="Reset" style="background: #6495ED">
     </form>


<!-- save this as action.php. change the variables $pass, and both the header("location: ") commands to whatever you would like. -->

<?php

$pass 
"insertpasswordhere";

if (
$_POST["password"] == $pass) {

header ("Location: your/path/to/correctpasswordsite.php");

}


else {

header ("Location: your/path/to/wrongpasswordsite.php");

}



 
?>


Usage Example




Rate This Script





Search



This Category All Categories