watthehell Posted August 27, 2007 Share Posted August 27, 2007 function is_user() { if(isset($_SESSION['ISUSER'])) { return $this->check_session($_SESSION['ISUSER']); } else { return false; } } can anyone explain what this function does.... ??? ??? ??? Link to comment https://forums.phpfreaks.com/topic/66854-check-this-function-and-help-please/ Share on other sites More sharing options...
matthewhaworth Posted August 27, 2007 Share Posted August 27, 2007 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 https://forums.phpfreaks.com/topic/66854-check-this-function-and-help-please/#findComment-335120 Share on other sites More sharing options...
watthehell Posted August 27, 2007 Author Share Posted August 27, 2007 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.... can we use like this <? if is_user()==true { ?> display message u are logged in <? } else { ?> display login box <? } ?> Link to comment https://forums.phpfreaks.com/topic/66854-check-this-function-and-help-please/#findComment-335129 Share on other sites More sharing options...
matthewhaworth Posted August 27, 2007 Share Posted August 27, 2007 <?php $login = is_user(); if($login != false) { ?> You are logged in. <?php } else { ?> You are not logged in <?php> } ?> Link to comment https://forums.phpfreaks.com/topic/66854-check-this-function-and-help-please/#findComment-335131 Share on other sites More sharing options...
watthehell Posted August 27, 2007 Author Share Posted August 27, 2007 sorry to say.... it didnt work, it gets logged in but does not show "You are now logged in", it shows the textbox to enter username and password........ :( :( Link to comment https://forums.phpfreaks.com/topic/66854-check-this-function-and-help-please/#findComment-335141 Share on other sites More sharing options...
matthewhaworth Posted August 27, 2007 Share Posted August 27, 2007 sorry to say.... it didnt work, it gets logged in but does not show "You are now logged in", it shows the textbox to enter username and password........ :( :( Well it will do if the login form isn't in the if statement.. Link to comment https://forums.phpfreaks.com/topic/66854-check-this-function-and-help-please/#findComment-335144 Share on other sites More sharing options...
watthehell Posted August 27, 2007 Author Share Posted August 27, 2007 the login form is in login.php file and this code i kept on header.php file <?php if ($is_logged==true) { i need logout here <? } else { ?> <? include("login.php");?> <? } ?> Link to comment https://forums.phpfreaks.com/topic/66854-check-this-function-and-help-please/#findComment-335149 Share on other sites More sharing options...
nloding Posted August 27, 2007 Share Posted August 27, 2007 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 https://forums.phpfreaks.com/topic/66854-check-this-function-and-help-please/#findComment-335160 Share on other sites More sharing options...
watthehell Posted August 27, 2007 Author Share Posted August 27, 2007 thnks for the reply man.... i will post my code here.... later Link to comment https://forums.phpfreaks.com/topic/66854-check-this-function-and-help-please/#findComment-335335 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.