Zen Cart Logo
Forums / General Questions / Problem redirecting to another page

Problem redirecting to another page

Locked

Views: 996

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
1 Jun 2008, 4:22 AM
#1
dgsignal avatar

dgsignal

New Zenner

Join Date:
May 2008
Posts:
31
Plugin Contributions:
0

Problem redirecting to another page

I have made modifications to allow php scripts in ezpages. Now I want to create a new page that is only available to members who are signed in. I have put the following code in to see if there is a session variable present. If so, I would like to show the page to the user. If not, I want the user to be redirected to the login page.

Here is the code I have at the very top of the page:

<?php
if (empty($_SESSION['customer_id'])) {
	header("Location: index.php?main_page=login");
	exit;
}
else {

/*here is the stuff that gets shown to the user */

}
?>

The results I'm getting:

When I am logged in, I see all the content -> GREAT!

When I'm not logged in, the page is blank and I don't get redirected.--> BAD!

When I test the header() redirect in a test file in the Catalog directory, it works. Is this a permissions problem?

Any suggestions are appreciated. Thanks, D

1 Jun 2008, 6:11 AM
#3
dgsignal avatar

dgsignal

New Zenner

Join Date:
May 2008
Posts:
31
Plugin Contributions:
0

Re: Problem redirecting to another page

Thanks Misty! I made some similar changes and seem to be making progress.

Dustin

:smile: