Mailinglisten-Archive |
>Das hilft mir aber nix, wenn ich Scripte mit crypt() aus der Unix-Welt
>habe, die unter Windoof laufen sollen. Bisher helfe ich mir mit Perl:
>
>function vercrypte_das($passwd)
>if ($GLOBALS["WINDIR"])
> {
> $salt = substr(md5(rand()),0,2);
> // Ersatz durch Perl fuer Windows
> $crypte = "perl -e \"print crypt('$passwd', '$salt');\"";
> $cryptString = exec($crypte);
> return $cryptString;
> }
>else
> {
> return crypt($passwd);
> }
>}
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");
?>
bye
Daniel
php::bar PHP Wiki - Listenarchive