Boa noite Pessoal!
Estou criando uma tela de login, e passando os dados para uma pagina que vai se conectar ao AD, mas mesmo eu colocando os campos em branco a conexão esta passando como ok, segue os códigos se puderem me ajudar agradeço muito!
Tela conexao:
<?php
$adServer = "ldap://xxx.xxxx.xx.xx";
$ldap = ldap_connect($adServer);
$username = $_POST['user'];
$password = $_POST['pass'];
$ldaprdn = 'XXX' . "\\" . $username;
ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0);
$bind = @ldap_bind($ldap, $ldaprdn, $password);
if($bind=true)
{
echo "conexão ok";
}
else
{
echo "erro";
}
Tela Login:
<!DOCTYPE html>
<html lang="pt-br">
<link href='css/login.css' rel='stylesheet' />
<head>
<meta charset="UTF-8">
<title>Tela de Login e Senha</title>
</head>
<body>
<div name="login" id="login">
<div name="box" id="box">
<form method="POST" action="ad.php" name="form">
Login : <input type="text" name="user" id="user"><br><br>
Senha : <input type="password" name="pass" id="pass"><br><br>
<input type="submit" value="Login" id="button">
</form>
</div>
</div>
</body>
</html>