Code Comments
Programming Forum and web based access to our favorite programming groups.I dunno if this is the right place to post this:
I've created a membership system and a large member list which i
use for lotsa things. i can do the login and stuff but i have a small
problem.
I'm trying to find or write a code that checks:
--------
if (!_SESSION['Logged_In'] ==
'Logged In') {
--------
and then re-directs the page to another url such as:
--------
root.'/errorpages/not_logged_in.php';
--------
Problem is that I don't know how to do a header re-direct AFTER
the session start tag and I really DON'T wanna use JavaScript.
I've done it before a while back but I can't for the life of
me remember how!
Please help.
Thanks.
Neil Trigger
http://www.magic2k.com - The ultimate magic resource
http://www.oddmap.com - Strange holiday destinations
----------------------------------------
The post originated from PHP Freaks:
----------------------------------------
http://www.phpfreaks.com
http://www.phpfreaks.com/forums
Post Follow-up to this messageIf the session start is a must, then use http://php.net/manual/en/ref.outcontrol.php to control what data gets sent to the browser the way you want. It's simple, beginning with http://php.net/manual/en/function.ob-start.php ...There's also an Introductory Output Buffering Tutorial by Derek, check it out. "Tell a man there are 300 billion stars in the universe and he'll believe you. Tell him a bench has wet paint on it and he'll have to touch to be sure." --- http://php.net/manual | http://dev.mysql.com/doc/mysql/ | http://httpd.apache.org/docs-2.0/ | http://gentoo.org --- http://php.net/manual/en/security.index.php | http://forums.devshed.com/t165947/s.html | http://www.asleep.net/hacking/php/style/ --- http://www.phpfreaks.com/forums/index.php?showtopic=31047 | http://www.phpfreaks.com/forums/ind...?showtopic=6264 | http://www.phpfreaks.com/tutorial_index.php --- Official Linux registered user http://counter.li.org/ ---------------------------------------- The post originated from PHP Freaks: ---------------------------------------- http://www.phpfreaks.com http://www.phpfreaks.com/forumsPHP:<?php // Turn on OB ob_start(); // Start the Session immediately session_start(); root = '/home/kevinm/public_html/'; if(_SESSION['foo'] != 'bar') { header("root.errorpages/whatever/"); } // Flush OB and turn it off ob_end_flush(); ?>
Post Follow-up to this message"gerkintrigg" wrote:
> I dunno if this is the right place to post this:
>
> I’ve created a membership system and a large member list which i
> use for lotsa things. i can do the login and stuff but i have a
small
> problem.
>
> I’m trying to find or write a code that checks:
> --------
> if (!_SESSION[’Logged_In’] ==
> ’Logged In’) {
>
> --------
> and then re-directs the page to another url such as:
> --------
> root.’/errorpages/not_logged_in.php’;
> --------
> Problem is that I don’t know how to do a header re-direct AFTER
> the session start tag and I really DON’T wanna use JavaScript.
>
> I’ve done it before a while back but I can’t for the life
> of
> me remember how!
>
> Please help.
> Thanks.
>
> Neil Trigger
> http://www.magic2k.com - The ultimate magic resource
> http://www.oddmap.com - Strange holiday destinations
>
> ----------------------------------------
> The post originated from PHP Freaks:
> ----------------------------------------
> http://www.phpfreaks.com
> http://www.phpfreaks.com/forums
I don’t know what session start tag has to do with it, but you can
generally buffer your ouput. This avoids problems with header
redirection. Look at ob_start in the docs.
--
http://www.dbForumz.com/ This article was posted by author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbForumz.com/PHP-SQL-Red...rm.php?p=473242
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.