Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Redirection & Sql...
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



Report this thread to moderator Post Follow-up to this message
Old Post
gerkintrigg
08-18-04 08:57 PM


Re: Redirection & Sql...
If 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 ...

PHP:
<?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(); ?>
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/forums

Report this thread to moderator Post Follow-up to this message
Old Post
Arenium
08-18-04 08:57 PM


Re: Redirection &amp; Sql...
"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

Report this thread to moderator Post Follow-up to this message
Old Post
steve
08-20-04 02:12 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP SQL archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Forum Jump:
All times are GMT. The time now is 04:42 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.