how to check some one

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
forgun
Forum Commoner
Posts: 61
Joined: Wed Jan 29, 2003 6:05 am
Contact:

how to check some one

Post 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
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post 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.
User avatar
forgun
Forum Commoner
Posts: 61
Joined: Wed Jan 29, 2003 6:05 am
Contact:

Post 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
User avatar
phice
Moderator
Posts: 1416
Joined: Sat Apr 20, 2002 3:14 pm
Location: Dallas, TX
Contact:

Post 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.
Image Image
Post Reply