Solved

Redirct With Server Global Variable

Posted on 2014-10-06
3
94 Views
Last Modified: 2014-10-18
Here is what I'm using to 1) redirect users to Hallways' Welcome.html page.

2) They can only come via Hallway's navtest page.

The issue I'm having is once the user is on Navigator, clicking on any link seems to start the redirect again, and they're being sent to Hallways yet again.  Best way to resolve?

// rev. 10-06-2014, 10AM
// This code redirects Visitor to Hallways' Welcome page.
// Visitor will authenticate into OMB MAX via Hallways, then get a pass-thru to Navigator site.
// Navigator, because of the CAS Module, will accept the incoming authentication, 
// so the User will already be signed in to OMB MAX when they land on Navigator home page.

<?php
$ref = $_SERVER["HTTP_REFERER"];
if ( $ref == 'https://hallways-dev.fas.gsa.gov/hallways/navtest' )
{
		if (isset($_SESSION['phpCAS']['attributes']['samlAuthenticationStatementAuthMethod'])) {
		 echo "you came from hallways -- defined - you are authenticated in cas - stay here";
		} else {
		echo "you came from hallways -- but -- not defined in cas";
		//header("Location:https://hallways-dev.fas.gsa.gov/hallways/homepage/welcome.html");
		//exit;
		}
}
else
{
header("Location:https://hallways-dev.fas.gsa.gov/hallways/homepage/welcome.html");

}
?>

Open in new window

0
Comment
Question by:sandshakimi
  • 2
3 Comments
 
LVL 108

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 40363759
Can you please rephrase the question?  Some of those links seem to require a CAC card and that's not something many people would have.
0
 

Author Comment

by:sandshakimi
ID: 40363895
Sure, the intent with sharing the code was not for you all to try the links. It does require CAC.

I'm sharing it to demonstrate the code I'm using to redirect Visitors away from Navigator, send them through Hallways, and allow a pass-thru to Navigator.

Overall, the code works. The issue is that once the visitor finally reaches Navigator and start clicking on anything with "<a href" the redirect is kicking in, sending them back to Hallways.
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 40364107
It looks to me like the redirect will occur if the HTTP_REFERER is anything other than https://hallways-dev.fas.gsa.gov/hallways/navtest.  Of course this will happen very fast, so your echo statements will probably not produce visible output if you're testing in a conventional browser.  I didn't see any <a href in the code snippet.  What do those links say?
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now