Guest User

Untitled

a guest
Apr 14th, 2018
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. <?php
  2. $user=$_POST['username'];
  3. $pass=$_POST['password'];
  4. $server=$_POST['server'];
  5.  
  6. $ds=ldap_connect($server);
  7. if($ds){
  8. ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
  9. $r=ldap_bind($ds, $user, $pass);
  10. if($r){
  11. session_start();
  12. $_SESSION["username"]=$user;
  13. $_SESSION["server"]=$server;
  14. $_SESSION["password"]=$pass;
  15. $_SESSION["auth"]="Y";
  16. echo "Login successfully.<br>";
  17. echo "1. <a href='search.php'>search users</a> <br>";
  18. echo "2. <a href='add.html'>add new users</a><br>";
  19. ldap_close($ds);
  20. }else{ echo "can not login"; }
  21. }else{ echo "unable to connect";}
  22. ?>
Add Comment
Please, Sign In to add comment