Solved

Redirct With Server Global Variable

Posted on 2014-10-06
3
101 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 109

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 109

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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.

773 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