Hi all.

I have this variable cn$
which sometimes is in base64 format and sometimes it isnt.
This is how the script looks like. It will get bigger but this is one of the problem i 
have to get threw first.

If you wonder why i dont use the built in ldap function in PHP i just can tell you 
that i want to. The compilation doesnt work and i have talked to several OpanLdap 
persons. So ignore that for now.
The problem below is that ldaps $cn is sometimes in base64 format and if it is i need 
to decode it.
I have no problem decoding it my problem is that i need to make it somehow "know" if 
it is in that format or not.
Thankfull for any help.


$string=`$ldap -L uid=$user uid cn department telephoneNumber| awk '{print $0}'`;

$line = explode("\n",$string);
$var = array("cn:", "department:","uid:", "telephoneNumber:");

foreach ($var as $varx) {
        foreach ($line as $str) {
                if (ereg($varx,$str)) {
                    $newvarx = str_replace (":","",$varx);
                    $tomte[$newvarx] = str_replace($varx,"",$str);
                } //if
        } //foreach
} //foreach



PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to