ticketid= ".$_GET["ticketid"]."
"; // If they have a ticket, validate it against the wind server. $wget_args = $wget_args . $_GET["ticketid"]; list($firstline , $secondline) = wrap_wget($wget_args); if($firstline == "no"){ $authenticated=FALSE; } else if($firstline=="yes"){ $authenticated=TRUE; $UNI = $secondline; } } else { die("
Wind Authentication Failed, Please try again later.
\n"); } // At this point, if authentication was successful, $authenticated and $UNI are set // If unsuccessful, $authenticated is false. if ($authenticated == TRUE) { /* These per user stanzas are hokey, but this is version .1 format as follows: if($UNI == "some_uni_here"){ $kitten_loggedin = TRUE; $kitten_email = "$UNI" . "@columbia.edu"; $kitten_userlevel = numerical_user_permission_level; } else if($UNI == "some_other_uni"){ // Stanza 2, repeat as necessary. $kitten_loggedin = TRUE; $kitten_email = "$UNI" . "@columbia.edu"; $kitten_userlevel = another_permission_level; } else die("Only authorized users may use this service. \n"); */ if($UNI == "ed2019"){ $kitten_loggedin = TRUE; $kitten_email = "$UNI" . "@columbia.edu"; $kitten_userlevel = 10; } else if($UNI == "gfg1"){ $kitten_loggedin = TRUE; $kitten_email = "$UNI" . "@columbia.edu"; $kitten_userlevel = 10; } else if($UNI == "andrew0"){ $kitten_loggedin = TRUE; $kitten_email = "$UNI" . "@columbia.edu"; $kitten_userlevel = 10; } else if($UNI == "benno0"){ $kitten_loggedin = TRUE; $kitten_email = "$UNI" . "@columbia.edu"; $kitten_userlevel = 10; } else { die("Only authorized users may use this service. \n"); } $_SESSION["UNI"] = $UNI; $_SESSION["kitten_email"] = $kitten_email; $_SESSION["kitten_userlevel"] = $kitten_userlevel; $_SESSION["kitten_loggedin"] = $kitten_loggedin; } } // At this point, if the user had a valid ticket and was authorized, the session variables are set and he is // logged in. // END LOGIN PROCESSING // BEGIN LOGOUT PROCESSING elseif ($user_action == "logout") { session_destroy(); $kitten_loggedin = false; $kitten_uid = 0; $kitten_email = ""; $kitten_userlevel = 0; } // END LOGOUT PROCESSING // Simple login form function login_form($target){ $wind_server = "www1.columbia.edu"; $wind_login_uri = "/sec-cgi-bin/wind/login"; $wind_validate_uri = "/sec-cgi-bin/wind/validate"; // Change this line to reflect your particular realm. $wind_realm = "sysmanual"; if($_SERVER["SERVER_PORT"] == 443) { $server_protocol = "https"; } else { $server_protocol = "http"; } $destination = $server_protocol . "://" . $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["PHP_SELF"] . "?user_action=login"; $login_link = "https://$wind_server$wind_login_uri?service=$wind_realm&destination=" . urlencode($destination); global $kitten_loggedin; global $kitten_email; global $login_error; if ($kitten_loggedin) { echo "You are currently logged in as $kitten_email " ."
" ."" ."
"; } else { echo "You must login to use this page.Click here to login."; } } // End login form // Refresh the session variables into the current scope. function refresh_session_variables(){ if(!isset($_SESSION["kitten_email"])) { $_SESSION["kitten_email"] = ""; } if(!isset($_SESSION["UNI"])) { $_SESSION["UNI"] = 0; } if(!isset($_SESSION["kitten_userlevel"])){ $_SESSION["kitten_userlevel"] = 0; } $UNI = $_SESSION["UNI"]; $kitten_email = $_SESSION["kitten_email"]; $kitten_userlevel = $_SESSION["kitten_userlevel"]; if($kitten_userlevel > 0){ $kitten_loggedin = TRUE; } return array($UNI, $kitten_email, $kitten_userlevel, $kitten_loggedin); } function wrap_wget($args){ exec("wget $args", $output_array, $x); if($x != 0) { echo("
wget returned $x, args = $args
"); print_r($output_array); return(0); } return( array($output_array[0], $output_array[1], $output_array[2])); } // End refresh ?>