[SOLVED] Getting a completely unexpected redirect
Posted: Sat Apr 16, 2011 10:13 am
I have the following code at the top of a page:
The purpose of this is to check and see if the profile is being updated OR created.
If it's being updated, then the currently logged in user has their profile updated with the POSTed data.
If it's being created, then the database record is created AND the user is AUTHENTICATED.
In either case, $_SESSION['user'] is set by the time the script gets to the check for authentication.
All of that is explanation of intended functionality. What's really happening is the first line (require_once '../classes/Applicant.php';) is hit and the page redirects (even with the redirect on THIS page commented out) as if the authentication check has occurred and failed.
My initial thought was that Applicant::_construct had some authentication check that was failing - but it's empty.
Next I thought it might be my IDE - but browser functionality echoes the exact same behavior.
So, now I'm at a complete loss as to what this could be.
Any constructive suggestions will be greatly appreciated.
Regards,
- G
Code: Select all
<?php
require_once '../classes/Applicant.php';
$applicant = new Applicant();
if(isset($_POST['updateProfile'])){
if("yes" == $_POST['updateProfile']){
$applicant->saveEdits();
}elseif ("new" == $_POST['updateProfile']){
$applicant->createProfile();
}
}
if(!isset($_SESSION['user'])){
$_SESSION['srcPage'] = "profile";
//header('Location: main.php?page=login');
}
require '../classes/Input.php';
$inpt = new Input();
?>
If it's being updated, then the currently logged in user has their profile updated with the POSTed data.
If it's being created, then the database record is created AND the user is AUTHENTICATED.
In either case, $_SESSION['user'] is set by the time the script gets to the check for authentication.
All of that is explanation of intended functionality. What's really happening is the first line (require_once '../classes/Applicant.php';) is hit and the page redirects (even with the redirect on THIS page commented out) as if the authentication check has occurred and failed.
My initial thought was that Applicant::_construct had some authentication check that was failing - but it's empty.
Next I thought it might be my IDE - but browser functionality echoes the exact same behavior.
So, now I'm at a complete loss as to what this could be.
Any constructive suggestions will be greatly appreciated.
Regards,
- G