Solved

Redirct With Server Global Variable

Posted on 2014-10-06
3
104 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 110

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 110

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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…

685 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