



<?php
// SquirrelMail Login Block
if (eregi("block-SquirrelMail_Login.php",$PHP_SELF)) {
Header("Location: index.php");
die();
}
?>
<?php
// Get PHP-Nuke Username
global $user;
if(!is_array($user)) {
$user_get = base64_decode($user);
$user_get = explode(":", $user_get);
$username = "$user_get[1]";
} else {
$username = "$user[1]";
}


// Compare PHP-Nuke Username to LDAP Username
$ds = ldap_connect('127.0.0.1', 389)
or die("Could not connect to server.");
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
if ($ds) {
$dn = "uid=" . $username . ",ou=People,dc=example,dc=com";
$value = $username . "@XXXXXX.com";
$attr = "mail";
$r=ldap_compare($ds, $dn, $attr, $value);
if ($r === -1) {


// Optionally show LDAP error on website, good for debugging, not for production
//$content .= "Error: " . ldap_error($ds);
$content .= "<center>Sorry, we were unable to validate your e-mail account.</center>";
} elseif ($r === true) {
$content .= "<form action=\"http://XXXXXXXXX.com/src/redirect.php\" method=\"POST\" target=\"_blank\">";
$content .= "<table align=\"center\" border=\"0\"><tr><td align=\"center\"><a href=\"http://www.squirrelmail.org/\" target=\"_blank\" title=\"[ www.squirrelmail.org ]\"><img src=\"images/squirrelmail_logo_block.png\" width=\"130\" height=\"47\" border=\"0\" /></a></td></tr></table>";
$content .= "<table align=\"center\" border=\"0\"><tr><td align=\"center\">";
$content .= "<tr><td align=\"center\">Password:</td></tr><tr><td align=\"center\"><input type=\"password\" name=\"secretkey\" size=\"10\" />";
$content .= "<input type=\"hidden\" name=\"login_username\" value=\"$username\" />";
$content .= "<input type=\"hidden\" name=\"js_autodetect_results\" value=\"0\" />";
$content .= "<input type=\"hidden\" name=\"just_logged_in\" value=\"1\" /></td></tr>";
$content .= "<tr><td align=\"center\"><input type=\"submit\" value=\"Login\" /></td></tr></table></form>";
} elseif ($r === false) {
$content .= "<center>Sorry, you do not have an e-mail account.</center>";
}
} else {
$content .= "<center>Sorry, we were unable to connect to the server.</center>";
}
?>




Obsah fóra BLASSENweb » Rady a porady - ostatní
|
|