Page 1 of 1
Posted: Thu Jun 24, 2004 2:10 am
by feyd
For whatever reason, girth you decided to reply to a thread which had little to do with your issue, so I split the topic.
If anyone cares to know the thread this was split from:
Help Grouping Results of Array
Posted: Thu Jun 24, 2004 2:25 am
by Illusionist
well, you might want to have a login screen, and if they can't login they can't get through...
Posted: Thu Jun 24, 2004 4:03 am
by Grim...
Why not use a cookie?
When a user is logged in, use [php_man]setcookie[/php_man]().
Then on the chat page, if the cookie variable doesn't exist, use
Code: Select all
<?php
header("location: login.php");
exit;
?>
to send them to the login page.
Posted: Thu Jun 24, 2004 4:04 am
by Grim...
Argh!
Don't click on that link if you are at work!
/edit: As feyd has just pointed out

Posted: Thu Jun 24, 2004 4:06 am
by feyd
girth, before a LOT of people get in trouble, mark your Sig link NWS.. and might want to think about removing the WWW in your profile.. just to be safe..
Posted: Thu Jun 24, 2004 7:45 am
by tim
your better bet would be to use sessions.
As some people disable cookies
Ok so now Im getting un confused.
Posted: Thu Jun 24, 2004 12:59 pm
by girth Brooks
so now that I've got that code how would I apply it? do I add it to my index page? or do I put it on a seperate page, and then have my index page link or call that page? I am so confused, could you please show me an example, or expalin it as if I were a baby?

Posted: Thu Jun 24, 2004 1:05 pm
by tim
Code: Select all
<?php
if (isset($_COOKIE['whatever'])) {
// display page
} else {
// refer to log-in page
}
?>
as said, when the user logs-in, set the cookie, in my above example I called it 'whatever'
for info on setcookie(), check out php.net
Ok thank you
Posted: Thu Jun 24, 2004 1:26 pm
by girth Brooks
so that tag I am going to add to what page? My index page on the chat room?
Posted: Thu Jun 24, 2004 1:31 pm
by tim
uhh, whatever page you wish to make sure the user is logged in.
