Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 77806

Re: Recommended solution for password protecting a page for clients only

$
0
0

Nice simple solution for those that require something simple. Only thing I would consider adding is some security on the 'protected page/s'

 

That's simple enough by passing the form field 'view' as a SESSION variable.

 

Not informing you how to do it because you know but for others:

 

Open the session by inserting the line below at  the very top of the page:

 

<?php  session_start() ?>

 

 

Amend this line:

 

<?php if (in_array($_POST['view'], $passwords)){ ?>

 

To:

 

<?php  $_SESSION['view'] = $_POST['view']; ?>

 

<?php if (in_array($_SESSION['view'], $passwords)){ ?>

 

 

Then on ALL protected pages add at the very top the code below: (the protected pages need to have a .php extension....so in the example Rob provided 'page.html' becomes 'page.php' or whatever you want to name it.)

 

<?php  session_start() ?>

<?php

if (!isset($_SESSION['view'])) {

header("Location: access.php");

}

?>


Viewing all articles
Browse latest Browse all 77806

Trending Articles