Jump to content

Question about session login


eldan88

Recommended Posts

Hey,

 

 I am trying to create a function that will only let users with an access level of 1 or 0 to be able to view a certain page. I have created a function, but I can't seem to get it work. Below is my code. Any help would be really appreciated!

function confirmed_logged_in() {
return isset($_SESSION['user_id']) && ($_SESSION['access'] == 1) || ($_SESSION['access'] == 0);
}


 function store_logged_in() {
if(!confirmed_logged_in() ()) {
		goto_page("www.urlgoeshere.com");
	}
}

I then put the store_logged_in() function on the pages that I want users with a level access of 1 or 0 to view the page

Link to comment
https://forums.phpfreaks.com/topic/280630-question-about-session-login/
Share on other sites


<?php
function confirmed_logged_in( ) {
$returned = isset($_SESSION['user_id']) && $_SESSION['access'] == 1 ? true : false;
return $returned;
}


function store_logged_in( ) {
if(!confirmed_logged_in( )){
goto_page('urlgoeshere.com');
}
//other code here
}

 

  On 7/30/2013 at 10:38 AM, chriscloyd said:
<?php
function confirmed_logged_in( ) {
     $returned = isset($_SESSION['user_id']) && $_SESSION['access'] == 1 ? true : false;
     return $returned;
}


function store_logged_in( ) {
     if(!confirmed_logged_in( )){
          goto_page('urlgoeshere.com');
     }
     //other code here
}

Hey. I actually need to it to validate the session for user access lvl 0 and 1 not just 1

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.