1. Kayako Download customers: we will continue to develop and support Kayako Download beyond July 2017, alongside the new Kayako for existing customers.

    Find out more.

  2. The forum you are viewing relates to Kayako Classic. If you signed up or upgraded to the new Kayako (after the 4th July 2016), the information in this thread may not apply to you. You can visit the forums for the new Kayako here.

Please Help me on Loginshare (AD Sync)

Discussion in 'LoginShare' started by kumar, Jan 6, 2012.

  1. kumar

    kumar Member

    Hi Friends,
    I am new to this forum. I am trying to AD Sync through Loginshare, but not succeed.
    Please help to setup this AD Sync.
    Hi Friends,
    I want sync AD users. I have created loginshare script, but I am unable to sync the AD users.
    Please help on this issue. I tried this script. but don't know where to change...
    please help me........

    <?php

    // Basic Active Directory Authenticator for Kayako LoginShare v4
    // V1.0 / 2010
    // by Corey Koltz
    // Email: corey@koltz.com
    // This is a basic authenticator against Active Directory. This
    // requires the installation of adLDAP.php in the same directory
    // as the ldap.php file. adLDAP.php also needs to be configured
    // with your AD settings.
    //
    // adLDAP can be found at adldap.sourceforge.net

    function getRealIpAddr()
    {
    if (!empty($_SERVER[''])) //check ip from share internet
    {
    $ip=$_SERVER['10.10.1.120'];
    }
    elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy
    {
    $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
    }
    else
    {
    $ip=$_SERVER['REMOTE_ADDR'];
    }
    return $ip;
    }

    include '/adldap.php';
    $adldap = new adLDAP();
    $username=$_POST["username"];
    $password=$_POST["password"];
    $ipaddress=getRealIpAddr();
    $authUser = $adldap->authenticate($username, $password);
    if ($authUser == true) {
    session_start();
    $_SESSION["hkumar"]=$username;
    $userinfo=$adldap->user_info($username, array("displayname","title","mail","telephone"));
    echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
    echo "<loginshare>";
    echo " <result>1</result>";
    echo " <user>";
    echo " <usergroup>Registered</usergroup>";
    echo " <fullname>".$userinfo[0]["displayname"][0]."</fullname>";
    echo " <designation>".$userinfo[0]["title"][0]."</designation>";
    echo " <emails>";
    echo " <email>".$userinfo[0]["mail"][0]."</email>";
    echo " </emails>";
    echo " <phone>".$userinfo[0]["telephone"][0]."</phone>";
    echo " </user>";
    echo "</loginshare>";
    }
    else
    {
    echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
    echo "<loginshare>";
    echo " <result>0</result>";
    echo " <message>Invalid Username or Password</message>";
    echo "</loginshare>";
    }

    ?>
     
  2. ad_amin

    ad_amin Established Member

    what error do you get?
     
  3. kumar

    kumar Member

    Invalid data provided: 2

    please help me on this issue...I don't know how to write/modify the adldap script in php.
     
  4. ad_amin

    ad_amin Established Member

    So it seems like your xml is not valid. Remove all the whitespaces from the content that you are echoing. It would be good if you put it in one echo command like:
    if (authentication is ok) {
    echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?><loginshare>...</loginshare>";
    }
    else {
    echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?><loginshare>...</loginshare>";
    }
     
  5. kumar

    kumar Member





    ok i will try ...thank you so much....
     
  6. kumar

    kumar Member

    Hi,
    Same error
    <?php

    // Basic Active Directory Authenticator for Kayako LoginShare v4
    // V1.0 / 2010
    // by Corey Koltz
    // Email: corey@koltz.com
    // This is a basic authenticator against Active Directory. This
    // requires the installation of adLDAP.php in the same directory
    // as the ldap.php file. adLDAP.php also needs to be configured
    // with your AD settings.
    //
    // adLDAP can be found at adldap.sourceforge.net

    function getRealIpAddr()
    {
    if (!empty($_SERVER['10.10.1.31'])) //check ip from share internet
    {
    $ip=$_SERVER['10.10.1.31'];
    }
    elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy
    {
    $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
    }
    else
    {
    $ip=$_SERVER['REMOTE_ADDR'];
    }
    return $ip;
    }

    include '/adldap.php';
    $adldap = new adLDAP();
    $username=$_POST["hkumar"];
    $password=$_POST["Sai9baba"];
    $ipaddress=getRealIpAddr();
    $authUser = $adldap->authenticate($username, $password);
    if ($authUser == true) {
    session_start();
    $_SESSION["hkumar"]=$username;
    $userinfo=$adldap->user_info($username, array("displayname","title","mail","telephone"));

    echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?><loginshare>...</loginshare>";
    }
    else {
    echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?><loginshare>...</loginshare>";

    }
     
  7. ad_amin

    ad_amin Established Member

    echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
    <loginshare>
    <result>1</result>
    <user>
    <usergroup>Registered</usergroup>
    <fullname>".$userinfo[0]["displayname"][0]."</fullname>
    <designation>".$userinfo[0]["title"][0]."</designation>
    <emails>
    <email>".$userinfo[0]["mail"][0]."</email>
    </emails>
    <phone>".$userinfo[0]["telephone"][0]."</phone>
    </user>
    </loginshare>";

    echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
    <loginshare><result>0</result>
    <message>Invalid Username or Password</message>
    </loginshare>";
     
  8. kumar

    kumar Member

    :( did..same problem....do u have gmail id?
     
  9. Ali Dursun

    Ali Dursun Member

    any new updates on that issue? any solutions?
     
  10. Gary McGrath

    Gary McGrath Staff Member

    check your php error log, is it logging any events relating to this? like ldap not being enabled etc.

    you can find the log location within your php.ini file

    Gary
     

Share This Page