base64_decode problem.

From: Date: Fri, 31 Aug 2001 08:54:12 +0000
Subject: base64_decode problem.
Groups: php.general 
Request: Send a blank email to php-general+get-65435@lists.php.net to get a copy of this message
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. //Johan <?php $ldap="/export/scratch/apps3/ldap/bin/ldapsearch"; $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 $cn=$tomte['cn']; $uid=$tomte['uid']; $dep=$tomte['department']; $phone=$tomte['telephoneNumber']; ?> </HTML>

« previous php.general (#65435) next »