0
$uploaddir = $_SERVER['DOCUMENT_ROOT'].'/bla/bla/uploads/'; 
$file = $uploaddir . basename($_FILES['uploadfile']['name']);

$data = file_get_contents($uploaddir . $_FILES["uploadfile"]["name"]);

$data=split("[;\r]",$data);

include_once("processes.php");
$ldapconn=connectToDB();


$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=gr", $info);

so i get the attributes i want from the file correctly (i have also counted them and tried anything that proves i get the string from the attribute)...
but i get the warning below


|onoma-->Γιά|epwnimo-->Κωνσ
Warning: ldap_add() [function.ldap-add]: Add: Invalid DN syntax


when i insert the attributes like:

$info["cn"] = "�����";
    		$info["sn"] = "��������";

they are inserted fine in the ldap server...

Edited by manolisvl46: n/a

1
Contributor
2
Replies
6
Views
7 Years
Discussion Span
Last Post by manolisvl46
0

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?

0

solved as simple as i couldn't imagine...
for a reason was not accepting
the iconv anywhere else but...

$info["cn"] =iconv("Windows-1253","UTF-8",$data[$c]);
			//echo "|onoma-->";
			//echo $info["cn"] ;
    		$c++;
			$info["sn"] = iconv("Windows-1253","UTF-8",$data[$c]);

so for all the greeks out there this is the way is being done....

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.