Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6688109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:21:58+00:00 2026-05-26T05:21:58+00:00

Need your help with authenticating an active directory user ID against LDAP. My problem

  • 0

Need your help with authenticating an active directory user ID against LDAP. My problem is unique. Let me explain here. Before posting this question, I’ve googled it and also searched in this forum and did not get any matching posts.

Here is the issue
I have a windows 2003 domain controller. My company policy is to create the user IDs in the domain as below

First Name = John
Last Name = Wagner
User ID = jwagner@company.com (domain controller is company.com)

When I update the user properties in Active Directory Users and Computers, I have to update the full first and full last name – John Wagner

When I try to authenticate a html web form in php using the User ID, it doesnt work.
However, when I authenticate with the first name and last name, it works.

//username is given as jwagner in the html form in this case. Authentication Fails.
//username is given as "john wagner" (without the quotes). Authentication Success.

if ((isset($_POST['username'])) && (isset($_POST['password'])))
{
$username=$_POST['username'];
$password=$_POST['password'];

$adServer = "10.23.1.1";
$ldapconn = ldap_connect($adServer)
    or die("Could not connect to LDAP server.");

$ldaprdn = $username;
$ldapbind = ldap_bind($ldapconn, $ldaprdn, $password);

if ($ldapbind)
{
    $_SESSION['username'] = $username;
    $_SESSION['password'] = $password;
    header("Location: http://company.com/website1");
}
else
{
    //if authentication fails, redirect back to the login page
    header("Location: http://company.com/index.php");
}
}

I’m not sure where am I going wrong. Is it not possible to authenticate active directory account using php if the user id is not equal to the first name and last name of the active directory account?

Thanks for all your advise and help in advance.

Regards,
Vinay

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T05:21:59+00:00Added an answer on May 26, 2026 at 5:21 am

    If you enter you user like this :

    enter image description here

    have you simply test :

    $ldap_domain = 'company.com';
    $ldapbind = ldap_bind($ldapconn, "$ldaprdn@$ldap_domain", $password);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

ive being trying to cope with this problem but still. I need your help.
I need your help in my code I have problem when new div inserted
I need your help, For example I have a decimal type variable and I
I need your help to define a special case in XML schema: A sequence
I really need your help in my issue very quickly and it's too close
I really need your help for this. I am relatively new to programming and
I'm completely stuck and need your help... I've created a webservice stub with jaxb
Dear friends, I need your help. I need to send .bmp file to another
I've some questions .. and I really need your help. I have an application.
Need your help with my PHP/MYSQL array. I have a php script that selects

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.