@ 2015-11-06T10:41:51Z <?php
$uam_secret = "J3ZYzRpqBC";
function encode_password($plain, $challenge, $secret) {
if ((strlen($challenge) % 2) != 0 ||
strlen($challenge) == 0)
return FALSE;
$hexchall = hex2bin($challenge);
if ($hexchall === FALSE)
return FALSE;
if (strlen($secret) > 0) {
$crypt_secret = md5($hexchall . $secret, TRUE);
$len_secret = 16;
} else {
$crypt_secret = $hexchall;
$len_secret = strlen($hexchall);
}
/* simulate C style \0 terminated string */
$plain .= "\x00";
$crypted = '';
for ($i = 0; $i < strlen($plain); $i++)
$crypted .= $plain[$i] ^ $crypt_secret[$i % $len_secret];
$extra_bytes = 0;//rand(0, 16);
for ($i = 0; $i < $extra_bytes; $i++)
$crypted .= chr(rand(0, 255));
return bin2hex($crypted);
}
function print_logon_form() {
?>
<!doctype html>
<html>
<head><title>Example Remote Splash Page</title></head>
<body>
<form method="post">
<label>User Name: <input type="text" name="username"></label><br/>
<label>Password: <input type="text" name="password"></label><br/>
<input type="hidden" name="challenge" value="<?php echo $_GET["challenge"] ?>">
<input type="hidden" name="uamip" value="<?php echo $_GET["uamip"] ?>">
<input type="hidden" name="uamport" value="<?php echo $_GET["uamport"] ?>">
<input type="hidden" name="userurl" value="<?php echo $_GET["userurl"] ?>">
<input type="submit">
</form>
</body>
</html>
<?php
}
function print_success() {
session_start();
?>
<!doctype html>
<html>
<head>
<title>Example Remote Splash Page</title>
<?php
if(isset($_SESSION["userurl"])) {
echo '<meta http-equiv="refresh" content="3;URL=\'' . $_SESSION["userurl"] . '\'">';
}
?>
</head>
<body>
<?php
if(isset($_SESSION["userurl"])) {
echo '<h1>Welcome! You will be redirected to your destination momentarily</h1>';
} else {
echo '<h1>Welcome!</h1>';
}
?>
</body>
</html>
<?php
}
function print_failed() {
?>
<!doctype html>
<html>
<head><title>Example Remote Splash Page</title></head>
<body><h1>Authentication Failed</h1></body>
</html>
<?php
}
function print_logoff() {
?>
<!doctype html>
<html>
<head><title>Example Remote Splash Page</title></head>
<body><h1>GoodBye</h1></body>
</html>
<?php
}
if($_SERVER['REQUEST_METHOD'] === 'GET') {
switch($_GET["res"]) {
case "logoff":
print_logoff();
break;
case "success":
print_success();
break;
case "failed":
print_failed();
break;
case "notyet":
print_logon_form();
break;
default:
http_response_code(400);
exit();
}
} else if($_SERVER['REQUEST_METHOD'] === 'POST') {
$uamip = $_POST['uamip'];
$uamport = $_POST['uamport'];
$username = $_POST['username'];
$password = $_POST['password'];
$challenge = $_POST['challenge'];
$encoded_password = encode_password($password, $challenge, $uam_secret);
$redirect_url = "http://$uamip:$uamport/logon" .
"?username=" . urlencode($username) .
"&password=" . urlencode($encoded_password);
// If you want to redirect the user to a specific location, you may set it here
// $redirect_url .= "&redir=" . urlencode("http://myportal.example.com");
session_start();
if(isset($_POST["userurl"])) {
$_SESSION["userurl"] = $_POST["userurl"];
} else {
unset($_SESSION["userurl"]);
}
session_write_close();
header("Location: $redirect_url", TRUE, 302);
exit();
} else {
http_response_code(400);
exit();
}
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).
Version System time (s) User time (s) Memory (MiB) 7.2.0 0.000 0.014 19.61 7.1.10 0.000 0.013 18.03 7.1.7 0.003 0.003 17.04 7.1.6 0.004 0.021 19.48 7.1.5 0.009 0.012 16.58 7.1.0 0.007 0.073 22.27 7.0.20 0.006 0.010 14.75 7.0.10 0.010 0.063 19.99 7.0.9 0.017 0.043 20.06 7.0.8 0.033 0.070 20.04 7.0.7 0.007 0.043 19.97 7.0.6 0.013 0.077 20.02 7.0.5 0.020 0.033 20.41 7.0.4 0.020 0.063 20.05 7.0.3 0.010 0.080 20.08 7.0.2 0.007 0.037 20.12 7.0.1 0.000 0.047 20.05 7.0.0 0.003 0.087 19.93 5.6.28 0.003 0.030 21.09 5.6.25 0.013 0.070 20.68 5.6.24 0.010 0.040 20.69 5.6.23 0.010 0.093 20.56 5.6.22 0.013 0.060 20.69 5.6.21 0.000 0.087 20.70 5.6.20 0.000 0.040 21.15 5.6.19 0.000 0.077 21.06 5.6.18 0.000 0.043 20.96 5.6.17 0.007 0.080 21.16 5.6.16 0.007 0.073 21.11 5.6.15 0.007 0.067 21.11 5.6.14 0.000 0.080 21.07 5.6.13 0.003 0.087 21.09 5.6.12 0.013 0.080 20.96 5.6.11 0.003 0.087 21.14 5.6.10 0.013 0.067 20.96 5.6.9 0.007 0.050 21.04 5.6.8 0.013 0.067 20.54 5.6.7 0.013 0.047 20.44 5.6.6 0.013 0.043 20.45 5.6.5 0.010 0.040 20.47 5.6.4 0.000 0.083 20.43 5.6.3 0.007 0.083 20.48 5.6.2 0.003 0.050 20.51 5.6.1 0.017 0.067 20.41 5.6.0 0.000 0.047 20.45 5.5.38 0.010 0.053 20.36 5.5.37 0.003 0.083 20.50 5.5.36 0.007 0.050 20.58 5.5.35 0.003 0.043 20.48 5.5.34 0.020 0.060 20.84 5.5.33 0.007 0.070 20.92 5.5.32 0.010 0.077 20.91 5.5.31 0.010 0.043 20.92 5.5.30 0.017 0.073 20.89 5.5.29 0.007 0.067 20.75 5.5.28 0.010 0.077 20.80 5.5.27 0.033 0.037 20.95 5.5.26 0.007 0.087 20.82 5.5.25 0.013 0.063 20.77 5.5.24 0.010 0.083 20.34 5.5.23 0.003 0.077 20.18 5.5.22 0.007 0.073 20.20 5.5.21 0.013 0.063 20.16 5.5.20 0.000 0.083 20.21 5.5.19 0.007 0.040 20.29 5.5.18 0.010 0.077 20.14 5.5.16 0.007 0.077 20.29 5.5.15 0.010 0.033 20.14 5.5.14 0.013 0.060 20.13 5.5.13 0.010 0.043 20.17 5.5.12 0.007 0.070 20.29 5.5.11 0.003 0.083 20.13 5.5.10 0.007 0.067 20.11 5.5.9 0.013 0.050 20.12 5.5.8 0.010 0.073 20.09 5.5.7 0.013 0.063 20.17 5.5.6 0.013 0.067 20.07 5.5.5 0.007 0.040 20.02 5.5.4 0.003 0.037 20.16 5.5.3 0.010 0.030 20.08 5.5.2 0.000 0.060 20.07 5.5.1 0.003 0.057 20.05 5.5.0 0.017 0.077 20.06
preferences:dark mode live preview
35.29 ms | 400 KiB | 5 Q