This article describes the method of password change after postfixadmin forgotten password. Share to everyone for your reference, as follows:
Postfix Admin is a Web-based Postfix Mail sending server management tool that can directly manage Postfix virtual domain names and users.
Because for a period of time did not use postfixadmin Delete user, suddenly need to forget the management password, using the way the foreigner directly in the database change password, after login success
PHP Source:
<?phpecho md5crypt ("New password");//md5crypt//action:creates MD5 encrypted password//call:md5crypt (string CLEARTEXTPASSW ORD) function Md5crypt ($PW, $salt = "", $magic = "") {$MAGIC = "$1$"; if ($magic = = "") {$magic = $MAGIC; } if ($salt = = "") {$salt = Create_salt (); } $slist = Explode ("$", $salt); if (isset ($slist [0]) && $slist [0] = = "1") {$salt = $slist [1]; } $salt = substr ($salt, 0, 8); $ctx = $pw. $magic. $salt; $final = Hex2bin (MD5 ($PW. $salt. $pw)); for ($i = strlen ($PW); $i > 0; $i-=) {if ($i >) {$ctx. = substr ($final, 0,16); } else {$ctx. = substr ($final, 0, $i); }} $i = strlen ($PW); while ($i > 0) {if ($i & 1) {$ctx. = chr (0); } else {$ctx. = $PW [0]; } $i = $i >> 1; } $final = Hex2bin (MD5 ($CTX)); for ($i =0; $i <1000; $i + +) {$ctx 1 = ""; if ($i & 1) {$ctx 1. = $PW; } else {$ctx 1. = substr ($final, 0,16); } if ($I% 3) {$ctx 1. = $salt; } if ($i% 7) {$ctx 1. = $PW; } if ($i & 1) {$ctx 1. = substr ($final, 0, 16); } else {$ctx 1. = $PW; } $final = Hex2bin (MD5 ($ctx 1)); } $passwd = ""; $passwd. = To64 ((ord ($final [0]) << 16) | (Ord ($final [6]) << 8) | (Ord ($final [12])), 4); $passwd. = To64 ((Ord ($final [1]) << 16) | (Ord ($final [7]) << 8) | (Ord ($final [13])), 4); $passwd. = To64 ((Ord ($final [2]) << 16) | (Ord ($final [8]) << 8) | (Ord ($final [14])), 4); $passwd. = To64 ((Ord ($final [3]) << 16) | (Ord ($final [9]) << 8) | (Ord ($final [15])), 4); $passwd. = To64 ((Ord ($final [4]) << 16) | (Ord ($final [ten]) << 8) | (Ord ($final [5])), 4); $passwd. = To64 (Ord ($final [11]), 2); Return $magic. $salt. ' $ '. $passwd;} function Create_salt () {srand (double) microtime () * 1000000); Return substr (MD5 (rand (0,9999999)), 0, 8);} PHP around 5.3.8 includes hex2bin as native function-http://php.Net/hex2binfunction Hex2bin ($str) {$len = strlen ($STR); $nstr = ""; for ($i = 0; $i < $len; $i + = 2) {$num = sscanf (substr ($str, $i, 2), "%x"); $nstr. = Chr ($num [0]); } return $nstr;} function To64 ($v, $n) {$ITOA = "./0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"; $ret = ""; while (($n-1) >= 0) {$n-; $ret. = $ITOA 64[$v & 0x3f]; $v = $v >> 6; } return $ret;}
More about PHP related content readers can view the topic: "PHP Encryption Method Summary", "PHP coding and transcoding Operation skills Summary", "PHP Object-oriented Programming tutorial", "PHP Math Skills Summary", "PHP array" operation Skills Daquan, " PHP string Usage Summary, PHP data structure and algorithm tutorial, PHP programming algorithm Summary, PHP Regular Expression usage summary, and PHP Common database Operations Skills Summary
I hope this article is helpful to you in PHP programming.