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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.