lhaluska
asked on
Problem with ldap query to set my cookie variable.
I am trying to set my cookie variable after my ldap query to get the info but it's not working can someone help please? Here is my code..
$ds=ldap_connect("ldap.cce .cup.com:3 89");
$r=ldap_bind($ds);
$sr=ldap_search($ds, "o=cup.com", 'ntUserDomainId='.$ntUserD omainId , explode(',', 'sn,givenname,telephonenum ber,manage r,ntUserDo mainId,Job Title,ou,u id,EMPLOYE ENUMBER,ma nagerEMPLO YEENUMBER, cn,mailRou tingAddres s'));
$info = ldap_get_entries($ds, $sr);
setcookie("EMAIL", $info['uid'], $life, "/", "webres.qweb.cpqcorp.net") ;
setcookie("PHONE", $info['telephonenumber'],$ life, "/", "webres.qweb.cpqcorp.net") ;
$ds=ldap_connect("ldap.cce
$r=ldap_bind($ds);
$sr=ldap_search($ds, "o=cup.com", 'ntUserDomainId='.$ntUserD
$info = ldap_get_entries($ds, $sr);
setcookie("EMAIL", $info['uid'], $life, "/", "webres.qweb.cpqcorp.net")
setcookie("PHONE", $info['telephonenumber'],$
ASKER
I am confused how do I make a var dump? Sorry for the stupid questions but I am a newbie..
var_dump is a function of php http://www.php.net/var_dump
ASKER
This is what I am getting...
array(1) { ["count"]=> int(0) }
Notice: Undefined variable: info in C:\Inetpub\wwwroot\Service Request\al lpage.php on line 31
Notice: Undefined variable: info in C:\Inetpub\wwwroot\Service Request\al lpage.php on line 32
array(1) { ["count"]=> int(0) }
Notice: Undefined variable: info in C:\Inetpub\wwwroot\Service
Notice: Undefined variable: info in C:\Inetpub\wwwroot\Service
In this case your ldap query didn't found a matching value. Check your ldap query
ASKER
great thanks I am looking in to it...
ASKER
I fixxed the ldap query here is my dump but still having problem with my cookie set can you help please. Here is my var dump with the errors for the cookie sets.
array(2) { ["count"]=> int(1) [0]=> array(24) { ["ntuserdomainid"]=> array(2) { ["count"]=> int(1) [0]=> string(17) "AMER:lhaluska" } [0]=> string(14) "ntuserdomainid" ["givenname"]=> array(2) { ["count"]=> int(1) [0]=> string(5) "Louis" } [1]=> string(9) "givenname" ["sn"]=> array(2) { ["count"]=> int(1) [0]=> string(7) "Haluska" } [2]=> string(2) "sn" ["cn"]=> array(2) { ["count"]=> int(1) [0]=> string(13) "LHaluska" } [3]=> string(2) "cn" ["employeenumber"]=> array(2) { ["count"]=> int(1) [0]=> string(8) "111111" } [4]=> string(14) "employeenumber" ["manager"]=> array(2) { ["count"]=> int(1) [0]=> string(45) "uid=bingh@cup.com,ou=Peop le,o=cup.c om" } [5]=> string(7) "manager" ["manageremployeenumber"]= > array(2) { ["count"]=> int(1) [0]=> string(8) "07724438" } [6]=> string(21) "manageremployeenumber" ["uid"]=> array(2) { ["count"]=> int(1) [0]=> string(20) "lhaluska@cup.com" } [7]=> string(3) "uid" ["mailroutingaddress"]=> array(2) { ["count"]=> int(1) [0]=> string(32) "lha58825.routing@am2.exch .cup.com" } [8]=> string(18) "mailroutingaddress" ["ou"]=> array(2) { ["count"]=> int(1) [0]=> string(28) "SND Softw&Sols" } [9]=> string(2) "ou" ["telephonenumber"]=> array(2) { ["count"]=> int(1) [0]=> string(15) "+1 888 555 1234" } [10]=> string(15) "telephonenumber" ["count"]=> int(11) ["dn"]=> string(43) "uid=lhaluska@cup.com,ou=P eople,o=cu p.com" } }
Warning: setcookie() expects parameter 2 to be string, array given in C:\Inetpub\wwwroot\Service Request\al lpage.php on line 31
Warning: setcookie() expects parameter 2 to be string, array given in C:\Inetpub\wwwroot\Service Request\al lpage.php on line 32
array(2) { ["count"]=> int(1) [0]=> array(24) { ["ntuserdomainid"]=> array(2) { ["count"]=> int(1) [0]=> string(17) "AMER:lhaluska" } [0]=> string(14) "ntuserdomainid" ["givenname"]=> array(2) { ["count"]=> int(1) [0]=> string(5) "Louis" } [1]=> string(9) "givenname" ["sn"]=> array(2) { ["count"]=> int(1) [0]=> string(7) "Haluska" } [2]=> string(2) "sn" ["cn"]=> array(2) { ["count"]=> int(1) [0]=> string(13) "LHaluska" } [3]=> string(2) "cn" ["employeenumber"]=> array(2) { ["count"]=> int(1) [0]=> string(8) "111111" } [4]=> string(14) "employeenumber" ["manager"]=> array(2) { ["count"]=> int(1) [0]=> string(45) "uid=bingh@cup.com,ou=Peop
Warning: setcookie() expects parameter 2 to be string, array given in C:\Inetpub\wwwroot\Service
Warning: setcookie() expects parameter 2 to be string, array given in C:\Inetpub\wwwroot\Service
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you very much it works great...
setcookie("EMAIL", $info[0]['uid'], $life, "/", "webres.qweb.cpqcorp.net")
setcookie("PHONE", $info[0]['telephonenumber'
Make a var_dump($info) and check the structure of the result.