Skip to content
This repository has been archived by the owner on Oct 7, 2022. It is now read-only.

Commit

Permalink
changed script to detect url rather than have it hardcoded for portab…
Browse files Browse the repository at this point in the history
…ility of code
  • Loading branch information
K-Felk committed May 10, 2012
1 parent 11f12f2 commit 9ec7351
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 7 additions & 2 deletions display.php
@@ -1,13 +1,17 @@
<?
session_start();
if (!isset($_SESSION['username'])) {
header("Location: https://login.ezproxy.gvsu.edu/login?url=https://login.ezproxy.gvsu.edu/userObject?service=getToken&returnURL=http://gvsulib.com/felkerk/360Link_Reset/login.php");

$path_parts = pathinfo($_SERVER['SCRIPT_NAME']);

$header = "Location: https://login.ezproxy.gvsu.edu/login?url=https://login.ezproxy.gvsu.edu/userObject?service=getToken&returnURL=http://" . $_SERVER['SERVER_NAME'] . $path_parts['dirname'] . "/login.php";
header($header);

} else {
$user = trim($_SESSION['username']);

if ($user != 'felkerk' && $user != 'simons') {
echo "You suck";
echo "<P color='red'>You are not authorized, sucka.</P>";
die;
}

Expand Down Expand Up @@ -170,6 +174,7 @@

<h2>Dodgy Link Display</h2>
View Enties From:

<P>
<form action="" method="GET">
<label for="start_date">Start Date</label>
Expand Down
4 changes: 3 additions & 1 deletion login.php
Expand Up @@ -27,7 +27,9 @@

session_write_close(); // Make sure the session variable is written before the redirect

$new_url = "http://gvsulib.com/felkerk/360Link_Reset/display.php"; // URL of the app you are signing into
$path_parts = pathinfo($_SERVER['SCRIPT_NAME']);

$new_url = "http://" . $_SERVER['SERVER_NAME'] . $path_parts['dirname'] . "/display.php"; // URL of the app you are signing into

header('Location: ' . $new_url);

Expand Down

0 comments on commit 9ec7351

Please sign in to comment.