Results 1 to 5 of 5

Thread: [RESOLVED] ldap + account validation...

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Posts
    431

    Resolved [RESOLVED] ldap + account validation...

    How do I validate accounts using ldap?

    If I try to bind the submited data I get this if the user enters a invalid password:
    Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server: Invalid credentials in
    Last edited by Zeratulsdomain; Jun 3rd, 2008 at 01:59 PM.

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Posts
    431

    Re: ldap + account validation...

    anyone?

    edit: well I give up, I guess its a PHP bug...

    What I ended up doing was reloading the page with php (header) when it detects a bad password then it displays wrong password error on that page... This method works seamlessly (in this case), but it doesnt feel right.
    Last edited by Zeratulsdomain; May 27th, 2008 at 10:22 AM.

  3. #3
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: ldap + account validation...

    If you read the documentation, you will see that the function returns true on success and false on failure. Why not test the result and base your decision of what to do next on the result. Just a thought

    If you do not want the warning to be displayed then you can use the error suppression operator @:
    PHP Code:
    @ldap_bind(); 
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Posts
    431

    Re: ldap + account validation...

    thats what I was doing :\

    Here is my code, I get that error if I do not have that header.

    PHP Code:
    $ldapbind ldap_bind($ldapconn"$username@X.org"$password);

    if (
    $ldapbind
                {
                    
    //this will only EVER be seen if they do not have a samaccountname that matches there credentials
                    
    echo "Error, cannot find proper samaccountname...<br />"
                } 
                else 
                {
                    echo 
    "Invalid Password...<br />";
                    
    $_SESSION['LoginError']=true;
                    
    header("Location: " $_SERVER['PHP_SELF']);                
                } 
    but the error suppression operator was something I did not know about...
    Last edited by Zeratulsdomain; Jun 3rd, 2008 at 02:02 PM.

  5. #5
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: [RESOLVED] ldap + account validation...

    It's useful but use it only when you have no other option. Warnings in PHP usual indicate an abnormal condition in most cases this abnormal condition should never have occurred and may produce unpredictable results or errors further along in the script. In a few cases (only a few), the warnings produced are an indication of an abnormal condition but do not can be deal with, withing your code using error handlers.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width