⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 migrate_to_md5.php3

📁 PHPLOB注释详细版 使用模板技术的好帮手 PHP最有用的东东了
💻 PHP3
字号:
<? # Script to migrate from regular authentication to md5-hashed passwords## Jim Zajkowski <jim@jimz.com>## This only works for MySQL, since I don't have any other database.  # You'll need to change it as necessary.# Before running this script you must create the auth_user_md5 table.  # Check out create_auth_md5.mysql, which is the proper SQL to create# the table.# Please set up DB_Example (or a subclass) in the php/local.inc file# first, as I depend on it.  Configure for your site:$database_class  = "DB_Example";       ## Class for login credentials$from_table      = "auth_user";        ## Table with current users$to_table        = "auth_user_md5";    ## New table to make$clear_to_first  = 1;                  ## Delete auth table first#####################################################################$db = new $database_class;$db2 = new $database_class;if ($clear_to_first) {   $db->query(sprintf("delete from %s", $to_table));}echo "Converting $from_table to $to_table...<br>";$db->query(sprintf("select user_id, username, perms, password from %s",                     $from_table)          );while($db->next_record()) {   $uid  = $db->f("user_id");   $user = $db->f("username");   $perm = $db->f("perms");   $pass = $db->f("password");      $newpass = md5($pass);   $db2->query(sprintf("insert into %s (user_id, username, perms, password)" .		         "values ('%s', '%s', '%s', '%s')", 	                 $to_table, $uid, $user, $perm, $newpass));   echo "Converted $user...<br>";}echo "Conversion complete.<br>";?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -