5
Contributors
4
Replies
41
Views
3 Years
Discussion Span
Last Post by redalert8
0

there are many tutorials and readily available scripts out there.

There is one here. It is an old one, but it should be able to do the job. I was planning to make an update, but the original owner won't repond to my requests.

Edited by veedeoo: info added.

0

Controlling access to pages requires sessions and access control. php sessions are used to store data per user. Access control is how php uses session to access data.. so..

Here is how a simple login controlled page would be.

Content Protected Page(this is placed in the header of the files needed to be protected.)

<?php 


    session_start();

    if($_SESSION['access_granted'] == 'no'){
        session_destroy();
        header("Location: " . $_SERVER['HTTP_REFERER']);
        exit;
    }else{

    //Show all content that is protected 

    }

?>

This checks if a session is started with the var access_granted not equal to no. If the access_granted var is set to no the session will be destroyed and the user will be redirected to where they came from. if the access_granted var is set to anything else, the page will load.

0

The OP has been banned and has a history of asking daft, flowery questions. I doubt very much whether she(he?) needed this in any case. However, if you think others may benefit from your advice, please carry on. Be aware that this topic has been discussed to death, so more likely your finely crafted solution may already be present in different forms a hundred times over. Vague posts will draw downvotes.

Edited by diafol

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.