SHARE
TWEET

Untitled

a guest Apr 13th, 2019 93 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. if(file_exists("install/index.php")){
  3.     //perform redirect if installer files exist
  4.     //this if{} block may be deleted once installed
  5.     header("Location: install/index.php");
  6. }
  7.  
  8. require_once 'users/init.php';
  9. require_once $abs_us_root.$us_url_root.'users/includes/template/prep.php';
  10. if(isset($user) && $user->isLoggedIn()){
  11. }
  12. ?>
  13. <div id="page-wrapper">
  14.     <div class="container">
  15.         <div class="jumbotron">
  16.             <h1 align="center"><?=lang("JOIN_SUC");?> <?php echo $settings->site_name;?></h1>
  17.             <p align="center" class="text-muted"><?=lang("MAINT_OPEN")?></p>
  18.                     <p>This is just a proof of concept LDAP implementation.  You will need to edit this file.</p>
  19.                     <p>You have automatically been logged out even if you don't see it at the top of the page. <?php session_destroy();session_start();?></p>
  20.                     <p>if you are on windows make sure you server has the ssleay32.dll and libeay32.dll files in your php directory.</p>
  21.                 <?php
  22.                 if(!extension_loaded('ldap')){
  23.                     ?>
  24.  
  25.                     <p align="center">
  26.                     <strong>You need to install the php LDAP extension by uncommenting out the line that says extension=ldap in your php.ini file located in<br> <?=php_ini_loaded_file();?><br> and restarting your server</strong>
  27.                     </p>
  28.                     <?php   } ?>
  29.  
  30.                     <p>The code below will attempt to do an LDAP login and log you in as user2.  Feel free to edit the credentials.</p>
  31.                     <?php
  32.                         $ldap_dn = "uid=guest1,ou=users,ou=guests,dc=zflexsoftware,dc=com";
  33.                         $ldap_password = "guest1password";
  34.                         $ldap_con = ldap_connect("www.zflexldap.com");
  35.                         ldap_set_option($ldap_con, LDAP_OPT_PROTOCOL_VERSION, 3);
  36.                         if(ldap_bind($ldap_con, $ldap_dn, $ldap_password)) {
  37.                           echo "Bind successful!";
  38.                             $user = new User(2);
  39.                             $user->login();
  40.                             dump($user);
  41.                             if($user->isLoggedIn()){
  42.                                 dump("Logged In");
  43.                             }
  44.                             Redirect::to($us_url_root."users/account.php?err=+You+have+been+logged+in+with+LDAP");
  45.  
  46.                         } else {
  47.                             echo "Invalid user/pass or other errors!";
  48.                         }
  49.  
  50.  
  51.                     ?>
  52.  
  53.         </div>
  54. <?php languageSwitcher();?>
  55.     </div>
  56. </div>
  57. <!-- Place any per-page javascript here -->
  58.  
  59.  
  60. <?php require_once $abs_us_root . $us_url_root . 'users/includes/html_footer.php'; ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top