Jump to content

Making a page only visible after logon

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
Alex_j

Alex_j

    Newbie

  • Members
  • PipPip
  • 29 posts
Hi, I would like to make one of my pages in my site only visible after the user has logged on, as at the minute you could just go to the URL and the page would be displayed, how can I stop this and only make it visible after logon?

#2
Guest_Jaan_*

Guest_Jaan_*
  • Guests
http://forum.codecal...off-system.html

Use this tutorial to create a registration / login forms.. then user can log in to view the content.

#3
Flezria

Flezria

    Learning Programmer

  • Members
  • PipPipPip
  • 55 posts
You just have to simple, set a Session variable.
like this:
when u login set this variable:
$_SESSION['login'] = "yes";
'

then test on the others sites like this:

if($_SESSION['login'] == yes) {
           include "Yoursite.php";
}else {
           echo "You arent logged in!!";
}

remember to set the session_start();
before using session variables

Good luck, Flezria