0

I know I should know the answer to this, but I'm drawing a blank...

I have a conditional statement that checks for the value of a variable, and if it isn't 'Y', then it does a redirect using the header statement.

apparently something that I did a couple days ago had a negative effect on the redirection, but I don't know what it would have been... I did a lot of minor updates to several scripts that could have an effect, but not sure what would stop the header redirection from working...

<?php
include "all_inc/config_site.php";
include "all_inc/pghead.php";
include "all_inc/pgtop.php";
include "all_inc/logcheck.php";  // include on all member pages
if ($accept != 'Y'){ // variable set in logcheck
header('Location:../memupdate.php');// if haven't acceptes TOS go there
exit;
}

A member just brought it to my attention that something was different, and I can see that it isn't forcing the redirect to the memupdate.php as it should be... But it is hitting the exit; which basically leaves me with the left menu and a blank page other than that.

So, I guess the question is ...
What would prevent the redirection from working?

I know there are certain circumstances where it won't work, but don't remember what exactly it is...

Thanks in advance.

Douglas

3
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by showman13
1

Any output, e.g. echo or error before the header. Also are you sure that the location is correct. The memupdate.php file is a directory above this page?

0

Are you including an html file with the <html><head></head> template?
If so, that could throw it off because you can't release the html header before the header() function in PHP. You should do your PHP at the very top of the page before all those includes (unless it's your database connection one).
I'm assuming logincheck is with the variable you need? You can do that before. But you should always release your html header after using header() functions in php.

0

Any output, e.g. echo or error before the header. Also are you sure that the location is correct. The memupdate.php file is a directory above this page?

Yep. it has been working just fine up until something that I changed in one of the other scripts. Hate it when I do that, and get sidetracked and don't take the time to test things from all angles when I make changes.

And yes, that was the answer I was looking for... I knew it was something simple, but since I hadn't run into it in quite some time, had forgotten...

Thanks, I'm sure I will get it resolved now, based on that answer...

Have a great evening.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.