"; @fclose($fp); } // MS-Windows platform? if (@class_exists('COM')) { // http://msdn.microsoft.com/en-us/library/aa388176(VS.85).aspx try { $CAPI_Util = new COM('CAPICOM.Utilities.1'); $entropy .= $CAPI_Util->GetRandom(16, 0); if ($entropy) { $entropy = md5($entropy, TRUE); //echo "USING WINDOWS" . "
"; } } catch (Exception $ex) { // echo 'Exception: ' . $ex->getMessage(); } } if (strlen($entropy) < 16) { $entropy = sha1_file('/includes/configure.php'); $entropy .= microtime() . mt_rand() . $seed; //echo "USING FALLBACK" . "
"; } return sha1($entropy); } function zen_create_PADSS_password($length = 8) { $charsAlpha = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $charsNum = '0123456789'; $charsMixed = $charsAlpha . $charsNum; $password = ""; for ($i = 0; $i < $length; $i++) { $addChar = substr($charsMixed, zen_pwd_rand(0, strlen($charsMixed) - 1), 1); while (strpos($password, $addChar)) { $addChar = substr($charsMixed, zen_pwd_rand(0, strlen($charsMixed) - 1), 1); } $password .= $addChar; } if (!preg_match('/[0-9]/', $password)) { $addChar = substr($charsNum, zen_pwd_rand(0, strlen($charsNum) - 1), 1); $addPos = zen_pwd_rand(0, strlen($password) - 1); $password[$addPos] = $addChar; } return $password; } function zen_pwd_rand($min = 0, $max = 10) { static $seed; if (!isset($seed)) $seed = zen_get_entropy(microtime()); $random = zen_get_entropy($seed); $random .= zen_get_entropy($random); $random = sha1($random); $random = substr($random, 0, 8); $value = abs(hexdec($random)); $value = $min + (($max - $min + 1) * ($value / (4294967295 + 1))); $value = abs(intval($value)); return $value; }