Jump to content

Password'ed page


hungryOrb

Recommended Posts

Well what you can do is you could if the page. You can have two files, one with the ifs and one with the entire page you want to protect. Than if the inputted password matches yours than it includes the file you are protecting.

 

 

if (isset($_GET['password']))

{

echo "You are not able to access this page";

}

elseif ($_GET['password'] != $yourpassword)

{

echo "Incorrect password";

}

else

{

$password = 1;

include_once "filelocation";

}

 

than on that actual page you are protecting you can have

 

if ($password != 1)

{

echo "Please login"; //or whatever

}

else

{

?>

Entire Page Code // Put your Entire Page code here

<?php

}

?>

 

There are many ways to do it better than this... I'm still learning myself as well.

Link to comment
Share on other sites

Thats using a form with an input for the password ye?

Do you know how a prompt box could be used instead? If the value from a prompt box can be inserted onto the end of the link ie: control.php?id=" <| INSERT HERE |> "

That would be cooL! If using an <a> tag, can display a prompt and then, hm , not sure :/

Link to comment
Share on other sites

What I do is have a login page followed by a PHP verify page. On failure go back to logon page.

If Ok set a session variable and redirect to home page. All pages check for session variable. if not there then re-direct to login. nobody can look at any page unless first loged on.

 

Desmond.

 

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.