PhpSnip.com

User Stats

Simple Yet Effective PHP Log-in Script

This simple log in script will password protect one or more of your pages. You can allow different users to go to different sites.

Info

 Download  View Source (print view)
 Rating : 4.7  Views : 596

Source Code ( 29 lines )

<!-- 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");

}



 ?>

Search

Subscribe

  Rss Feeds

Sponsors

Advertise