403 Forbidden

"; debugMsg(date("Y-m-d H:i",mktime())."Invalid host (".$_SERVER["REMOTE_ADDR"].")\n"); exit(0); ############################################ ############################################ # Takes the array from a response and prints it out using debugMsg function Debug($data){ debugMsg(date("Y-m-d H:i",mktime())." "); debugMsg("ValidID (".$data["validID"]."), "); debugMsg("ValidPIN (".$data["validPIN"]."), "); debugMsg("defaultPin (".$data["defaultPIN"]."), "); debugMsg("patronGroup (".$data["patronGroup"]."), "); debugMsg("expiryDate (".$data["expiryDate"]."), "); debugMsg("status (".$data["status"]."), "); debugMsg("host (".$data["hostname"].")\n"); } ############################################ ############################################ # Prints a message to the debug file function debugMsg($msg){ global $debugFile; $fp = @fopen($debugFile,"a"); if (!$fp){ print "Error: Can't open debugfile"; } else { fwrite($fp,$msg); fclose($fp); } } ########################################################## ########################################################## function authorize($userid,$passwd){ global $check_hosts; # $auth_hostname = "lrpapp.cc.umanitoba.ca"; // Live # $auth_hostname = "lrtapp.cc.umanitoba.ca"; // Test $auth_port = 20000; $timeout = "15"; # in seconds foreach ($check_hosts as $auth_hostname){ # check all hosts in $check_hosts $sock = fsockopen($auth_hostname, $auth_port, $errno, $errstr, $timeout); if ($sock !== false){ break; } } if (! $sock){ return("ezproxy_deny=system_down.htm"); } fwrite($sock,"$userid|$passwd\n"); while (!feof($sock)) { $result.= fgets($sock, 256); } fclose($sock); $response = split("\|",trim($result)); $data["validID"] = $response[0]; $data["validPIN"] = $response[1]; $data["defaultPIN"] = $response[2]; $data["patronGroup"] = $response[3]; $data["expiryDate"] = $response[4]; $data["status"] = $response[5]; $data["hostname"] = $auth_hostname; preg_match("/^([0-9]{4})([0-9]{2})([0-9]{2})$/",$data["expiryDate"],$match); Debug($data); if ($data["validID"] == "n" || $data["validPIN"] == "n"){ return("+BAD_ID_PIN"); } else if ($data["defaultPIN"] == "y"){ return("ezproxy_deny=default.htm"); } else if (! preg_match("/^(FACULTY|STUDENT|NON-CREDIT|DISTANT_ED)$/",$data["patronGroup"])){ return("ezproxy_deny=type.htm"); } else if (mktime() > mktime(23,59,59,$match[2],$match[3],$match[1])){ return("ezproxy_deny=expired.htm"); } else if (preg_match("/^(BLOCKED|BARRED)$/",$data["status"])){ return("ezproxy_deny=barred.htm"); } else { return("+VALID"); } } ########################################################## ########################################################## ?>