Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(file_exists("install/index.php")){
- //perform redirect if installer files exist
- //this if{} block may be deleted once installed
- header("Location: install/index.php");
- }
- require_once 'users/init.php';
- require_once $abs_us_root.$us_url_root.'users/includes/template/prep.php';
- if(isset($user) && $user->isLoggedIn()){
- }
- ?>
- <div id="page-wrapper">
- <div class="container">
- <div class="jumbotron">
- <h1 align="center"><?=lang("JOIN_SUC");?> <?php echo $settings->site_name;?></h1>
- <p align="center" class="text-muted"><?=lang("MAINT_OPEN")?></p>
- <p>This is just a proof of concept LDAP implementation. You will need to edit this file.</p>
- <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>
- <p>if you are on windows make sure you server has the ssleay32.dll and libeay32.dll files in your php directory.</p>
- <?php
- if(!extension_loaded('ldap')){
- ?>
- <p align="center">
- <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>
- </p>
- <?php } ?>
- <p>The code below will attempt to do an LDAP login and log you in as user2. Feel free to edit the credentials.</p>
- <?php
- $ldap_dn = "uid=guest1,ou=users,ou=guests,dc=zflexsoftware,dc=com";
- $ldap_password = "guest1password";
- $ldap_con = ldap_connect("www.zflexldap.com");
- ldap_set_option($ldap_con, LDAP_OPT_PROTOCOL_VERSION, 3);
- if(ldap_bind($ldap_con, $ldap_dn, $ldap_password)) {
- echo "Bind successful!";
- $user = new User(2);
- $user->login();
- dump($user);
- if($user->isLoggedIn()){
- dump("Logged In");
- }
- Redirect::to($us_url_root."users/account.php?err=+You+have+been+logged+in+with+LDAP");
- } else {
- echo "Invalid user/pass or other errors!";
- }
- ?>
- </div>
- <?php languageSwitcher();?>
- </div>
- </div>
- <!-- Place any per-page javascript here -->
- <?php require_once $abs_us_root . $us_url_root . 'users/includes/html_footer.php'; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement