Hi,,,guys today i'm gonna give you a simple login authentication system using php. I'll post after this simple user-auth-2 and so on. comments and share highly appreciate
you have to do is copy and paste this code in your xampp or wamp htdocs folder and run it using browser.
<?php $password = "123456"; ?> <html> <head> <title>Simple Password Protect - PHP PasswordProtect</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> P { FONT-SIZE: 8pt; COLOR: #000000; FONT-FAMILY: Verdana, Tahoma, Arial} TD { FONT-SIZE: 8pt; COLOR: #000000; FONT-FAMILY: Verdana, Tahoma, Arial} </style> </head> <body> <?php print "<h2 align=\"center\">PHP Simple Password Protect</h2>"; // If password is valid let the user get access if (isset($_POST["password"]) && ($_POST["password"]=="$password")) { ?> <p align="center"><br><br><br> <b>Congratulations</b><br>you have gained access to the Protected and Secret Area!</p> <br> <center><a href="index.php">Log Out</a></center> <?php } else { // Wrong password or no password entered display this message if (isset($_POST['password']) || $password == "") { print "<p align=\"center\"><font color=\"red\"><b>Incorrect Password</b><br>Please enter the correct password</font></p>";} print "<form method=\"post\"><p align=\"center\">Please enter your password for access<br>"; print "<input name=\"password\" type=\"password\" size=\"25\" maxlength=\"10\"><input value=\"Login\" type=\"submit\"></p></form>"; } ?> <BR> </body> </html>
No comments:
Post a Comment