日期:2014-05-16 浏览次数:20508 次
#!/usr/bin/env ruby require 'rubygems' require 'md5' require 'pg' puts "请输入您的Email" email = gets puts "请输入您的新密码" password = gets password = Digest::MD5.hexdigest("--#{password.chop}--") puts "请输入您的数据库地址" address = gets p address.chop puts "请输入您的数据库名" database = gets @postgres = PGconn.connect address.chop,5432,'','',database.chop,'数据库用户名','数据库密码' str = "update users set password = '" + password + "' where email = '" + email.chop + "';" @postgres.exec str puts "您的密码已经修改成功"?