<?php
// http://sudobash.net/?p=736
session_start();
session_destroy();
if(!isset($_POST['user'])){?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
<!-- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>LOGIN TITLE</title>
</head>
<body>
<table align="center" height="200px" id="content">
<tr>
<td valign="middle">
<h2>TITLE Login</h2>
<form action="login.php" method="POST">
<tt>RAC Username:</tt>
<input type="text" name="user" size="30" /><br />
<tt>RAC Password:</tt>
<input type="password" name="password" size="30" />
<input type="submit" value="Login" name="submit" />
</form>
</td>
</tr>
</table>
</body>
</html>
<?}?>
<?if(isset($_POST['user'])){?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
<!-- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> -->
<head>
<title>LOGIN RESULTS TITLE</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
include 'conf.php';
// Don't display the warnings - we are already setup to annoy the user
ini_set( "display_errors", 0);
// No funny stuff!
$user = htmlspecialchars($_POST['user']);
$user = explode(" ", $user);
$user = $user[0];
$user = preg_replace("/[^a-zA-Z0-9_]/", "", $user);
$filter = "admin=" . $user;
// Connect to the LDAP server.
$ldapconn = ldap_connect($server, $port) or
die("Could not connect to " . $server . ":" . $port . ".");
// Bind with rootreader to the LDAP server to search and retrieve DN.
$ldapbind = ldap_bind($ldapconn) or die("Could not bind - contact admin@adamskalicky.com");
$result = ldap_search($ldapconn,$basedn,$filter) or die ("Search error.");
$entries = ldap_get_entries($ldapconn, $result);
$binddn = $entries[0]["dn"];
// Bind again using the DN retrieved. If this bind is successful,
// then the user has managed to authenticate.
$ldapbind = ldap_bind($ldapconn, $binddn, $_POST['password']);
if ($ldapbind) {
echo "<center><h2>Successful authentication for <span style='color: #000;'>" . $user . "</span></center>";
?> <table align="center" height="200px" id="content">
<tr>
<td valign="middle">
<form action="restricted.php" method="post">
<input type="hidden" name='user' value="<?=$user;?>" >
<input type="submit" value="Great, Let's go!" >
</form>
</td>
</tr>
</table>
<?
} else {
echo "<center><h2>Failed authentication for <span style='color: #000;'>" . $user . "</span><br /><br />
<a href='login.php'>Try again</a></center>";
}
ldap_close($ldapconn);
?>
</body>
</html>
<?php
}
?>
- Output for 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
- Parse error: Unclosed '{' on line 6 in /in/GkhqZ on line 98
Process exited with code 255. - Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.10, 7.2.0, 7.3.32 - 7.3.33, 7.4.33, 8.0.13
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
<!-- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>LOGIN TITLE</title>
</head>
<body>
<table align="center" height="200px" id="content">
<tr>
<td valign="middle">
<h2>TITLE Login</h2>
<form action="login.php" method="POST">
<tt>RAC Username:</tt>
<input type="text" name="user" size="30" /><br />
<tt>RAC Password:</tt>
<input type="password" name="password" size="30" />
<input type="submit" value="Login" name="submit" />
</form>
</td>
</tr>
</table>
</body>
</html>
- Output for 7.1.26 - 7.1.33, 7.2.17 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.32
- Parse error: syntax error, unexpected end of file in /in/GkhqZ on line 98
Process exited with code 255. - Output for 4.4.2 - 4.4.9, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29
- Parse error: syntax error, unexpected $end in /in/GkhqZ on line 98
Process exited with code 255. - Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1, 5.0.0 - 5.0.5
- Parse error: parse error, unexpected $ in /in/GkhqZ on line 98
Process exited with code 255. - Output for 4.3.2 - 4.3.4
- Parse error: parse error in /in/GkhqZ on line 98
Process exited with code 255.
preferences:
300.85 ms | 401 KiB | 381 Q