simplest way to protect your php page with short php code

if you want to restrict unwanted users to access your page in this tutorial we will show you how to protect PHP pages using short lines of php code

$password = "pass";
// If password matchs let the user get access
if (isset($_POST["password"]) && ($_POST["password"]=="$password")) {
//Display message if wrong password or no password entered.
if (isset($_POST['password']) || $password == "") {
  echo "<p align=\"center\"><font color=\"red\"><b>Incorrect Password</b><br>Please enter the correct password</font></p>";}
  echo "<form method=\"post\"><p align=\"center\">Please enter password : <br>";
  echo "<input name=\"password\" type=\"password\" size=\"25\"><input value=\"Login\" type=\"submit\"></p></form>";

One comment

  1. Seth says:

    hello there, superior website, and a really good understand! at least one for my favorites.

Leave a Reply

Your email address will not be published. Required fields are marked *