Jump to content

Registration


mancombe

Recommended Posts

Firstly, only show "logged in" links to people who are logged in. I usually create a navigation bar for "logged out" users and a different navigation bar for people who are logged in.

 

Like so:

 

if($_SESSION['logged_in']){
     require("logged_in_nav.php");
}
else{
     require("logged_out_nav.php");
}

 

Secondly, you'll need to stop people who are not logged in from viewing pages that are only meant to be viewed by logged in users. Here's an example for that:

 

if(!isset($_SESSION['logged_in'])){
     header('Location: login.php'); //redirect back to login.php
     exit; //just to be sure that they still dont see the page if a redirect doesn't happen
}

Link to comment
https://forums.phpfreaks.com/topic/178030-registration/#findComment-938712
Share on other sites

Firstly, only show "logged in" links to people who are logged in. I usually create a navigation bar for "logged out" users and a different navigation bar for people who are logged in.

 

Like so:

 

if($_SESSION['logged_in']){
     require("logged_in_nav.php");
}
else{
     require("logged_out_nav.php");
}

 

Secondly, you'll need to stop people who are not logged in from viewing pages that are only meant to be viewed by logged in users. Here's an example for that:

 

if(!isset($_SESSION['logged_in'])){
     header('Location: login.php'); //redirect back to login.php
     exit; //just to be sure that they still dont see the page if a redirect doesn't happen
}

That was a big help, thank you very much  :D
Link to comment
https://forums.phpfreaks.com/topic/178030-registration/#findComment-938888
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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