From: Manolis Vlachakis on 30 Apr 2010 07:34 Hallo there everyone although i have built my code correctly according to the examples i found on the net.. i get Invalid DN syntax error when i try to insert some attributes with ldap add.. i get and read a csv file where i get the data correctly as i can see on the echos that follow: *$data=split("[;\r]",$data);* * * * **$info["cn"]= $data[$c];* * **echo "|onoma-->";* * **echo $info["cn"] ;//* * ** ** $c++;* * **$info["sn"]= $data[$c];* * **echo "|epwnimo-->";* * **echo $info["sn"] ;* * * * **$info["objectclass"][0] = "top";* * ** ** $info["objectclass"][1] = "organizationalPerson";* * * * ** * * ** $r = ldap_add($ldapconn, "cn=".$info['cn'].",cn=*****,ou=@@@,ou=****.,ou=****,dc=.....dc=....", $info);* funny thing is that when i put them absolute like *$info["sn"]= "bla bla";* it works fine... any ideas?
From: Ashley Sheridan on 30 Apr 2010 09:53 On Fri, 2010-04-30 at 14:34 +0300, Manolis Vlachakis wrote: > Hallo there everyone > although i have built my code correctly according to the examples i found on > the net.. > i get Invalid DN syntax error when i try to insert some attributes with ldap > add.. > > i get and read a csv file where i get the data correctly as i can see on the > echos that follow: > > *$data=split("[;\r]",$data);* > * > * > * **$info["cn"]= $data[$c];* > * **echo "|onoma-->";* > * **echo $info["cn"] ;//* > * ** ** $c++;* > * **$info["sn"]= $data[$c];* > * **echo "|epwnimo-->";* > * **echo $info["sn"] ;* > * * > * **$info["objectclass"][0] = "top";* > * ** ** $info["objectclass"][1] = "organizationalPerson";* > * * > * ** * > * ** $r = ldap_add($ldapconn, > "cn=".$info['cn'].",cn=*****,ou=@@@,ou=****.,ou=****,dc=.....dc=....", > $info);* > > funny thing is that when i put them absolute like *$info["sn"]= "bla > bla";* it works fine... > any ideas? Are you using the correct split() delimiter? What happens if you just output that array with print_r() or var_dump()? I see the delimiter as: [; ] Because the \r is recognised as a carriage return because your string is in double quotes. Thanks, Ash http://www.ashleysheridan.co.uk
From: Manolis Vlachakis on 30 Apr 2010 10:22 on the array and on the server side i can see the names are added normally and with the correct encode(despite what i show you ) and the only thing is tha i get that DN not valid... i used the \r cause i use it on my csv file at least one... but i am sure (i used a counter for the letters + i compered the name they are the same) so it is pretty strange why is not working... 1.trust me after many times faced problems with delimiters i can tell you the correct is with [ ] and your delimiter in between 2.print_r seems good exactly what i have in csv file.. 3.var_dump works fine counts everything and stuff but even though i get the right attributes ... i still have the same error....(see below) it's made me crazy.... onoma-->�������|epwnimo-->�������������� *Warning*: ldap_add() [function.ldap-add<https://195.251.90.188:65007/~voiko/admin/function.ldap-add>]: Add: Invalid DN syntax Thank you for your answer On 30 April 2010 16:53, Ashley Sheridan <ash(a)ashleysheridan.co.uk> wrote: > On Fri, 2010-04-30 at 14:34 +0300, Manolis Vlachakis wrote: > > Hallo there everyone > although i have built my code correctly according to the examples i found on > the net.. > i get Invalid DN syntax error when i try to insert some attributes with ldap > add.. > > i get and read a csv file where i get the data correctly as i can see on the > echos that follow: > > *$data=split("[;\r]",$data);* > * > * > * **$info["cn"]= $data[$c];* > * **echo "|onoma-->";* > * **echo $info["cn"] ;//* > * ** ** $c++;* > * **$info["sn"]= $data[$c];* > * **echo "|epwnimo-->";* > * **echo $info["sn"] ;* > * * > * **$info["objectclass"][0] = "top";* > * ** ** $info["objectclass"][1] = "organizationalPerson";* > * * > * ** * > * ** $r = ldap_add($ldapconn, > "cn=".$info['cn'].",cn=*****,ou=@@@,ou=****.,ou=****,dc=.....dc=....", > $info);* > > funny thing is that when i put them absolute like *$info["sn"]= "bla > bla";* it works fine... > any ideas? > > > Are you using the correct split() delimiter? What happens if you just > output that array with print_r() or var_dump()? I see the delimiter as: > > [; > ] > > Because the \r is recognised as a carriage return because your string is in > double quotes. > > Thanks, > Ash > http://www.ashleysheridan.co.uk > > > -- Manolis Vlachakis Nelly's Family Hotel Visit : www.nellys-hotel.gr www.nellys.gr Skype : manolis.vlachakis
From: Manolis Vlachakis on 3 May 2010 05:37 and my code begins like this... $uploaddir = $_SERVER['DOCUMENT_ROOT'].'/webteam/voiko/public_html/uploads/'; $file = $uploaddir . basename($_FILES['uploadfile']['name']); $data = file_get_contents($uploaddir . $_FILES["uploadfile"]["name"]); $data=split("[;\r]",$data); ; $num = count($data); var_dump($data); ............. and goes on as i show you on the last mails.. On 30 April 2010 17:22, Manolis Vlachakis <vlachakis.manolis(a)gmail.com>wrote: > on the array and on the server side i can see the names are added normally > and with the correct encode(despite what i show you ) > and the only thing is tha i get that DN not valid... > i used the \r cause i use it on my csv file at least one... > but i am sure (i used a counter for the letters + i compered the name they > are the same) > > so it is pretty strange why is not working... > > > 1.trust me after many times faced problems with delimiters i can tell you > the correct is with [ ] and your delimiter in between > 2.print_r seems good exactly what i have in csv file.. > 3.var_dump works fine counts everything and stuff but even though i get the > right attributes ... > i still have the same error....(see below) > it's made me crazy.... > > > > onoma-->�������|epwnimo-->�������������� > *Warning*: ldap_add() [function.ldap-add<https://195.251.90.188:65007/~voiko/admin/function.ldap-add>]: > Add: Invalid DN syntax > > Thank you for your answer > > > On 30 April 2010 16:53, Ashley Sheridan <ash(a)ashleysheridan.co.uk> wrote: > >> On Fri, 2010-04-30 at 14:34 +0300, Manolis Vlachakis wrote: >> >> Hallo there everyone >> although i have built my code correctly according to the examples i found on >> the net.. >> i get Invalid DN syntax error when i try to insert some attributes with ldap >> add.. >> >> i get and read a csv file where i get the data correctly as i can see on the >> echos that follow: >> >> *$data=split("[;\r]",$data);* >> * >> * >> * **$info["cn"]= $data[$c];* >> * **echo "|onoma-->";* >> * **echo $info["cn"] ;//* >> * ** ** $c++;* >> * **$info["sn"]= $data[$c];* >> * **echo "|epwnimo-->";* >> * **echo $info["sn"] ;* >> * * >> * **$info["objectclass"][0] = "top";* >> * ** ** $info["objectclass"][1] = "organizationalPerson";* >> * * >> * ** * >> * ** $r = ldap_add($ldapconn, >> "cn=".$info['cn'].",cn=*****,ou=@@@,ou=****.,ou=****,dc=......dc=....", >> $info);* >> >> funny thing is that when i put them absolute like *$info["sn"]= "bla >> bla";* it works fine... >> any ideas? >> >> >> Are you using the correct split() delimiter? What happens if you just >> output that array with print_r() or var_dump()? I see the delimiter as: >> >> [; >> ] >> >> Because the \r is recognised as a carriage return because your string is >> in double quotes. >> >> Thanks, >> Ash >> http://www.ashleysheridan.co.uk >> >> >> > > > -- > Manolis Vlachakis > > Nelly's Family Hotel > Visit : www.nellys-hotel.gr > www.nellys.gr > Skype : manolis.vlachakis > -- Manolis Vlachakis Nelly's Family Hotel Visit : www.nellys-hotel.gr www.nellys.gr Skype : manolis.vlachakis
From: Manolis Vlachakis on 3 May 2010 11:56
the thing i just tried is with // Open a memory "file" for read/write... $fp = fopen('php://temp', 'r+'); // ... write the $input array to the "file" using fputcsv()... fputcsv($fp, $input, $delimiter, $enclosure); // ... rewind the "file" so we can read what we just wrote... rewind($fp); // ... read the entire line into a variable... $data = fread($fp, 1048576); // [changed] // ... close the "file"... fclose($fp); // ... and return the $data to the caller, with the trailing newline from fgets() removed. and it comes back to me that is not an array does anyone think that this may cause the problem on the problem i face? On 3 May 2010 12:37, Manolis Vlachakis <vlachakis.manolis(a)gmail.com> wrote: > and my code begins like this... > > $uploaddir = > $_SERVER['DOCUMENT_ROOT'].'/webteam/voiko/public_html/uploads/'; > $file = $uploaddir . basename($_FILES['uploadfile']['name']); > > $data = file_get_contents($uploaddir . $_FILES["uploadfile"]["name"]); > > > $data=split("[;\r]",$data); > > ; > > $num = count($data); > > > var_dump($data); > > ............ > and goes on as i show you on the last mails.. > > > > > > On 30 April 2010 17:22, Manolis Vlachakis <vlachakis.manolis(a)gmail.com>wrote: > >> on the array and on the server side i can see the names are added normally >> and with the correct encode(despite what i show you ) >> and the only thing is tha i get that DN not valid... >> i used the \r cause i use it on my csv file at least one... >> but i am sure (i used a counter for the letters + i compered the name they >> are the same) >> >> so it is pretty strange why is not working... >> >> >> 1.trust me after many times faced problems with delimiters i can tell you >> the correct is with [ ] and your delimiter in between >> 2.print_r seems good exactly what i have in csv file.. >> 3.var_dump works fine counts everything and stuff but even though i get >> the right attributes ... >> i still have the same error....(see below) >> it's made me crazy.... >> >> >> >> onoma-->�������|epwnimo-->�������������� >> *Warning*: ldap_add() [function.ldap-add<https://195.251.90.188:65007/~voiko/admin/function.ldap-add>]: >> Add: Invalid DN syntax >> >> Thank you for your answer >> >> >> On 30 April 2010 16:53, Ashley Sheridan <ash(a)ashleysheridan.co.uk> wrote: >> >>> On Fri, 2010-04-30 at 14:34 +0300, Manolis Vlachakis wrote: >>> >>> Hallo there everyone >>> although i have built my code correctly according to the examples i found on >>> the net.. >>> i get Invalid DN syntax error when i try to insert some attributes with ldap >>> add.. >>> >>> i get and read a csv file where i get the data correctly as i can see on the >>> echos that follow: >>> >>> *$data=split("[;\r]",$data);* >>> * >>> * >>> * **$info["cn"]= $data[$c];* >>> * **echo "|onoma-->";* >>> * **echo $info["cn"] ;//* >>> * ** ** $c++;* >>> * **$info["sn"]= $data[$c];* >>> * **echo "|epwnimo-->";* >>> * **echo $info["sn"] ;* >>> * * >>> * **$info["objectclass"][0] = "top";* >>> * ** ** $info["objectclass"][1] = "organizationalPerson";* >>> * * >>> * ** * >>> * ** $r = ldap_add($ldapconn, >>> "cn=".$info['cn'].",cn=*****,ou=@@@,ou=****.,ou=****,dc=......dc=....", >>> $info);* >>> >>> funny thing is that when i put them absolute like *$info["sn"]= "bla >>> bla";* it works fine... >>> any ideas? >>> >>> >>> Are you using the correct split() delimiter? What happens if you just >>> output that array with print_r() or var_dump()? I see the delimiter as: >>> >>> [; >>> ] >>> >>> Because the \r is recognised as a carriage return because your string is >>> in double quotes. >>> >>> Thanks, >>> Ash >>> http://www.ashleysheridan.co.uk >>> >>> >>> >> >> >> -- >> Manolis Vlachakis >> >> Nelly's Family Hotel >> Visit : www.nellys-hotel.gr >> www.nellys.gr >> Skype : manolis.vlachakis >> > > > > -- > Manolis Vlachakis > > Nelly's Family Hotel > Visit : www.nellys-hotel.gr > www.nellys.gr > Skype : manolis.vlachakis > -- Manolis Vlachakis Nelly's Family Hotel Visit : www.nellys-hotel.gr www.nellys.gr Skype : manolis.vlachakis |