Jump to content

Question about session login


eldan88
Go to solution Solved by 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

Edited by eldan88
Link to comment
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
}

 

Link to comment
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
}

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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