Mailinglisten-Archive |
Hallo,
> Das sollte doch wohl besser so aussehen:
>
> <?php
>
> if(getenv("WINDIR"))
> {
> function crypt($string, $salt = "")
> {
> srand(time());
> if($salt == "") $salt = substr(md5(uniqid(rand())),0,2);
> return exec("perl -e \"print crypt('$string', '$salt');\"");
> }
> }
>
> print crypt("passwort");
>
> ?>
Das mit getenv() ist ganz schlau, aber imho ist der Wert identisch mit
dem in $GLOBALS. Hat schon mal jemand die Vari WINDIR unter Linux
declariert. Also dann sollte das doch wohl besser so aussehen:
if(!function_exists("crypt"))
{
function crypt($string, $salt = "")
{
srand(time());
if($salt == "") $salt = substr(md5(uniqid(rand())),0,2);
$passwd = exec("perl -e \"print crypt('$string', '$salt');\"");
if(empty($passwd)) return 0;
else return $passwd;
}
}
print crypt("passwort");
Haben wirs jetzt geschafft? ;-)
gruss
ritze
php::bar PHP Wiki - Listenarchive