Jump to content

check this function... and help please


watthehell

Recommended Posts

function is_user()

  {

if(isset($_SESSION['ISUSER']))

  {

return $this->check_session($_SESSION['ISUSER']);

  }

  else

  {

  return false;

  }

  }

 

can anyone explain what this function does....  ??? ??? ???

 

 

It is very hard to determine what this function does 'watthehell'.  Though at a guess. I would say it checks to see if the user is logged in.  Perhaps applies the user details to session variables?  It depends what the check_session function does.

 

Also, remember! Code tags.

Link to comment
Share on other sites

check session function is like this ...

 

function check_session($val)

{

  return $val;

 

  $errmsg="Session has been expired.";

  if(isset($val)) return $val;

 

  $this->abort("Session Error ", $errmsg);

//  $this->redirect($this->error_template);

  exit;

}

 

///

i just wanted to ask how to use that function is_user() in php code....  ;D

 

can we use like this

 

<? if is_user()==true { ?>

display message u are logged in

<? } else { ?>

display login box

<? } ?>

Link to comment
Share on other sites

I think your check_session function is messed up a bit.  You pass it the variable $val, and then, before ANY other code executes, you return $val.  So if you do this: $user = is_user();, then $user == $_SESSION['ISUSER'].  I would assume that would return "Admin", "Guest", "Registered", etc.

 

Please post your whole code so we can see more.  Just those two functions aren't enough to say "OK, here's what's wrong".

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.