} // Get IP address from the server - which means they must have excluded proxy for local access // can't neccessarily trust user provided ip address, although perhaps in future may need to add option to get address from user in case they can't exclude proxy (eg. Midori) $ipaddress = $_SERVER['REMOTE_ADDR']; // check this isn't the local ip address on the if ($ipaddress == $_SERVER['SERVER_ADDR']) { if ($nolocal == True) { // shouldn't get here as blocked.php will have provided the reconfigure proxy message print "You must configure bypass proxy for local networks in your web-browser\n"; exit(0); } // even if local is allowed we still provide a warning in case it's a misconfigured client. $message .= "<p>WARNING: If you are not on the proxy computer please set your browser to bypass proxy for local network to allow login. </p>\n"; } // save session $session_file->addEntry($ipaddress, $permission_req, $user->getUsername() . "-" . $permission_req, $loginexpirytime); // username is set to adminuser followed by - and permission level eg. admin-4 $username = $user->getUsername() . "-" . $permission_req; // If we get here we are logged in so can add entry if ($debug) { print "Login successful {$username} \n"; } if ($parms->getParm('url') != '') { $urllink = "<p>Follow the link below to go to the webpage, or back if no link shown.</p>\n<p><a href=\"" . $parms->getParm('url') . "\">" . $parms->getParm('url') . "</a></p>\n"; } else { $urllink = ''; } // setup and load headers $title = "Kidsafe logged in as {$username}"; include "inc/headers.php"; print <<<EOT
if ($ipaddress == $_SERVER['SERVER_ADDR']) { if ($nolocal == True) { // shouldn't get here as blocked.php will have provided the reconfigure proxy message print "You must configure bypass proxy for local networks in your web-browser\n"; exit(0); } // even if local is allowed we still provide a warning in case it's a misconfigured client. $message .= "<p>WARNING: If you are not on the proxy computer please set your browser to bypass proxy for local network to allow login. </p>\n"; } // get client information // this is stored for the benefit of the dashboard - ignored by the proxy app helper $client_browser = get_browser($_SERVER['HTTP_USER_AGENT'], true); $browser_string = $client_browser['platform'] . ' - ' . $client_browser['parent']; $login_time = time(); // save session $session_file->addEntry($ipaddress, $user->getAccess(), $user->getUsername(), $loginexpirytime, $login_time, $browser_string); $username = $user->getUsername(); // If we get here we are logged in so can add entry if ($debug) { print "Login successful " . $user->getUsername() . "\n"; } if ($parms->getParm('url') != '') { $urllink = "<p>Follow the link below to go to the webpage, or back if no link shown.</p>\n<p><a href=\"" . $parms->getParm('url') . "\">" . $parms->getParm('url') . "</a></p>\n"; } else { $urllink = ''; } //localtime($loginexpirytime) $expiry_time = strftime('%T %e %b %G', $loginexpirytime); //$login_localtime = strftime ('%T %e %b %G', $login_time); // setup and load headers $title = "Logged in as {$username}";