Skip to content
Browse files

changed script to detect url rather than have it hardcoded for portab…

…ility of code
  • Loading branch information...
1 parent 11f12f2 commit 9ec73518adcc86b0565aee1a364babe0e21e5bf1 @K-Felk K-Felk committed
Showing with 10 additions and 3 deletions.
  1. +7 −2 display.php
  2. +3 −1 login.php
View
9 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;
}
@@ -170,6 +174,7 @@
<h2>Dodgy Link Display</h2>
View Enties From:
+
<P>
<form action="" method="GET">
<label for="start_date">Start Date</label>
View
4 login.php
@@ -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);

0 comments on commit 9ec7351

Please sign in to comment.
Something went wrong with that request. Please try again.