For Programmers: Free Programming Magazines  


Home > Archive > PHP SQL > August 2004 > Redirection & Sql...









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Redirection & Sql...
gerkintrigg

2004-08-18, 3:57 pm

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


Arenium

2004-08-18, 3:57 pm

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


steve

2004-08-19, 9:12 pm

"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...pict140917.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=473242
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com