Page 1 of 1

[SOLVED] Getting a completely unexpected redirect

Posted: Sat Apr 16, 2011 10:13 am
by vaughtg
I have the following code at the top of a page:

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();
?>
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

Re: Getting a completely unexpected redirect

Posted: Sat Apr 16, 2011 10:30 am
by vaughtg
Okay, issue resolved. Serious case of DA in not paying attention to my file names. Or not paying attention to my pathing (still gotta work that detail out).

I have a class file in /classes/Application.php and /web/application.php and somewhere in the chain a require_once 'Application.php'; redirects to /web/application.php rather than /classes/Application.php - soooo, replacing that require_once 'Application.php'; with require_once '../classes/Application.php'; and moving on.