?
Solved

Redirct With Server Global Variable

Posted on 2014-10-06
3
Medium Priority
?
108 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 2000 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 111

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

WordPress Tutorial 4: Recommended Plugins

Now that you have WordPress installed, understand the interface, and know how to install new parts, let’s take a look at our recommended plugins.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

743 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