Page 1 of 1

how to check some one

Posted: Sun Apr 06, 2003 11:17 am
by forgun
i need to know i how can check if some one is login to the system or not
i try this

Code: Select all

function is_login() {
        if (!$_SESSION||$_SESSIONї'passed']=='true'||$_SESSIONї'how']=='') {
            header("Location: HTTP://" .$_SERVERї'HTTP_HOST'] .$_SERVERї'PHP_SELF'] ."?loc=login");
        }
    }
but it's not seen to work

Posted: Sun Apr 06, 2003 3:28 pm
by m3mn0n
shouldn't you be passing some variables through the function?

Code: Select all

<?php
function is_login($_SESSION['username']) { 
        if (!$_SESSION||$_SESSION['passed']=='true'||$_SESSION['how']=='') { 
            header("Location: HTTP://" .$_SERVER['HTTP_HOST'] .$_SERVER['PHP_SELF'] ."?loc=login"); 
        } 
    } 
?>
For example.

Posted: Sun Apr 06, 2003 3:54 pm
by forgun
mm but it's only look if the user is login to the system or not
why this little <span style='color:blue' title='I&#39;m naughty, are you naughty?'>smurf</span> is not working that is what i ask
can u help to understand how i can see if that user is log on the system by pass/user or it's a unknow person
*sry about me bad english

Posted: Sun Apr 06, 2003 4:32 pm
by phice

Code: Select all

<?php
session_start();
function is_login($location) { 
        if ($_SESSION['passed'] != 'true' || empty($_SESSION['how'])) { 
            header("Location: http://{$_SERVER["HTTP_HOST"]}$location?loc=login");
        }
?>
You'll have to put in $PHP_SELF inside the functions brackets whenever you decide to use this function.