Jump to content

Easy Password login


math

Recommended Posts

heya all, ive searched the whole internet for days....

It's this easy that they don't create it annymore or something,

 

What i need is a page, that ask's only 1 password and u click on ok/send it directs to a other page. (Iff password's corroct ofcourse)

 

Ive seen 37 scripts... they are more like member/register and so on... and all the scripts dont send you to a webpage directly.. they send you to the same page (other area) with a link to the desired page..

 

Can someone help me?

 

I will be very happy to have  a link/script ;D

Link to comment
https://forums.phpfreaks.com/topic/133183-easy-password-login/
Share on other sites

login page

<?php
$PASSWORD = "secret password here";

if (isset($_POST['pass'])) {
   if ($_POST['pass']) == $PASSWORD) {
       session_start();
       $_SESSION['pass'] = true;
       header("Location: other_page_path_here.php");
       exit();
   } else {
       echo <<<ABC
<strong style="color:red;">Looks like you entered the wrong password</strong>
<form method="post">
    <input type="password" name="pass" />
    <input type="submit" value="Login" />
</form>
ABC;
   }
} else {
   echo <<<ABC
<form method="post">
    <input type="password" name="pass" />
    <input type="submit" value="Login" />
</form>
ABC;
}
?>

 

other page

<?php 
session_start();

if (!isset($_SESSION['pass'])) { //Without a password, redirect to login script
    header("Location: login_script_path_here.php");
    exit();
}
?>

//HTML And rest of page here

Link to comment
https://forums.phpfreaks.com/topic/133183-easy-password-login/#findComment-692734
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.