Craft CMS Asked on June 28, 2021
I am developing a plugin. In local environment if works fine. On the real server it fails, returns 0 entries. The method is called from a template:
ret = "{{craft.nastupy.hledanizamestancu('"+retezec+"', 0) }}"//hledanizamestancu
alert("ret " + ret)
It resides in /variables, and goes like so:
public function hledanizamestancu($retezec) {
//error_reporting(0);
$ldap_dn = "intentionally left blank";
$ldap_password = "so is this";
$ldap_conn = ldap_connect("and this", 389);
//print($ldap_conn);
ldap_set_option($ldap_conn, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ldap_conn, LDAP_OPT_DEBUG_LEVEL, 7);
ldap_set_option($ldap_conn, LDAP_OPT_REFERRALS, true);
if (@ldap_bind($ldap_conn, $ldap_dn, $ldap_password)) {
echo ldap_error($ldap_conn);
$dn = "blank once again";
$filter = "(displayName=*".$retezec."*)";
$justthese = array("displayName", "email");
$result = ldap_search($ldap_conn, $dn, $filter, $justthese);
$entries = ldap_get_entries($ldap_conn, $result);
$vystup = "";
foreach ($entries as $e) {
print("e ".$e);
if (isset($e['email'][0]) && isset($e['displayname'][0])) {
$vystup .= $e['displayname'][0].",";
}
}
print("vystup " .$vystup. " konec");
} else {
print("I should never ever see this.");
}
}
I tried both displayname of displayName in the foreach loop, but they fail both. I also tried AJAX directly from JS. Same story. It works in local environment just fine but fails on the server.
Thank you.
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP