duanlvji4780 2019-08-07 12:00
浏览 65

我的登录表单在身份验证后返回相同的表单,我的LDAP连接不起作用

I need to create a login page with login form with LDAP connection. After correct authentication user should be redirect to another profile page. For this purposes I have created two files.First one with the form and LDAP connection, the second one is re-directive page. In practice I feel the blanks and the same empty contact form appears. When I take a part of my code connected with LDAP on the after <?php get_header(); ?> the login form is not visible on the page.

<?php get_header(); ?>

<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>

<div class="container">
    <div class="row">
        <div class="col-sm-6 col-md-4 col-md-offset-4">
            <h1 class="text-center login-title">Sign in to continue to Bootsnipp</h1>
            <div class="account-wall">
                <img class="profile-img" src="https://lh5.googleusercontent.com/-b0-k99FZlyE/AAAAAAAAAAI/AAAAAAAAAAA/eu7opA4byxI/photo.jpg?sz=120"
                    alt="">
                <form class="form-signin" method="post">
                <input type="text" class="form-control" placeholder="Email" required autofocus>
                <input type="password" class="form-control" placeholder="Password" required>
                <button class="btn btn-lg btn-primary btn-block" type="submit">
                    Sign in</button>
                <label class="checkbox pull-left">
                    <input type="checkbox" value="remember-me">
                    Remember me
                </label>
                <a href="#" class="pull-right need-help">Need help? </a><span class="clearfix"></span>
                </form>
            </div>
            <a href="#" class="text-center new-account">Create an account </a>
        </div>
    </div>
</div>


<?php
// active directory server
    $ldap = ldap_connect("ldap://44.44.444");


//active directory DN (base location of ldap search)
$ldap = 'dc=itit,dc=local';


// configure ldap params
    ldap_set_option($ldap,LDAP_OPT_PROTOCOL_VERSION,3);
    ldap_set_option($ldap,LDAP_OPT_REFERRALS,0);

// user prefix
        $ldap_usr_dom = "@itit.local";


    // verify user and password
    if($bind = @ldap_bind($ldap, $user.$ldap_usr_dom, $password)) {

echo success;
}else{
return false;
}

?>

<?php get_footer(); ?>

</div>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 解决一个加好友限制问题 或者有好的方案
    • ¥15 关于#java#的问题,请各位专家解答!
    • ¥15 急matlab编程仿真二阶震荡系统
    • ¥20 TEC-9的数据通路实验
    • ¥15 ue5 .3之前好好的现在只要是激活关卡就会崩溃
    • ¥50 MATLAB实现圆柱体容器内球形颗粒堆积
    • ¥15 python如何将动态的多个子列表,拼接后进行集合的交集
    • ¥20 vitis-ai量化基于pytorch框架下的yolov5模型
    • ¥15 如何实现H5在QQ平台上的二次分享卡片效果?
    • ¥30 求解达问题(有红包)