当前位置:首页
开发技术指南» 文章正文
    引言:

    摘要: 在某java接口程序中,用mq进行消息传递,接口程序长期运行,每隔大约20天就出现mq错误如下:com.ibm.mq.mqexception: mqje001:完成码 2,原因 2102,不知哪位大虾肯指点一下! 在线等待! ......
 ·如何實現字符串對數字的轉換    »显示摘要«
    摘要: example: string szbuffer = "123456.78"; int a = (???) zbuffer 該怎麼辦? ......


密码问题

输入用户名和密码后,为了安全期间想在数据库中密码栏里只能看到很多没有规则的数据。我应该怎么做?

NO.1   作者: Ordin

存入数据库前先加密啊,找个加密类

NO.2   作者: zhfjessie2008

可以建立或找一种加密组件,然后每次建立新用户时将加密过得乱码放到库中.  
  有这样的组件.我们用到过.

NO.3   作者: super_zhaowenke

先将密码加密,存入数据库,登陆时再将其解密.

NO.4   作者: caizhenfang

可以利用   md5加密啊       登陆输入密码的时候也加密刚输入的密码     再把数据库中以前用md5加密的字段值取出来     比较就可以了

NO.5   作者: seaonce

public   string   MD5(String   str)  
  {  
  MD5   md5=new   MD5CryptoServiceProvider();  
  byte[]   data=System.Text.Encoding.Default.GetBytes(str);  
  byte[]   result=md5.ComputeHash(data);  
  String   ret="";  
  for(int   i=0;i<result.Length;i++)  
  ret+=result[i].ToString("x").PadLeft(2,0);  
  return   ret;  
  }    
  网上多的是,呵呵

NO.6   作者: caizhenfang

刚好前面老师分了任务给我就是加密解密的,自己慢慢看吧     这里是   md5加密的     先是通过   textbox把密码加密   写到数据库,然后登陆的时候     通过加密输入的密码,然后与数据库中已经加密的密码做比较。  
   
  private   void   button10_Click(object   sender,   System.EventArgs   e)  
  {  
  string   reGex,reGex2;  
  byte[]   bt=UTF8Encoding.UTF8.GetBytes(textPass1.Text.Trim());  
  MD5CryptoServiceProvider   objMD5;  
  objMD5=new   MD5CryptoServiceProvider();  
  byte[]   output=objMD5.ComputeHash   (bt);  
  reGex=BitConverter.ToString   (output);  
  reGex2=reGex.Replace("-","");  
   
  if   (textName1.Text==""   ||   textPass1.Text   =="")  
  {  
  MessageBox.Show("您提交的信息不完全","提示!");  
  return;  
  }  
  try  
  {  
   
  string   strCon   =   "   Provider=Microsoft.Jet.OLEDB.4.0;   Data   Source=usermd5.mdb   ";  
  OleDbConnection   myConn=new   OleDbConnection(strCon);  
  string   strInsert   =   "INSERT   INTO   cc_admin(usernam,passwor)   VALUES   ("  
  +   textName1.Text   +","  
  +   reGex2   +")";  
  myConn.Open();  
  OleDbCommand   myCmd   =   new   OleDbCommand(strInsert,myConn);  
  myCmd.ExecuteNonQuery();  
  myConn.Close();  
  MessageBox.Show("添加用户成功!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);  
  }  
  catch   (Exception   ex)  
  {  
  MessageBox.Show(ex.Message,"提示",MessageBoxButtons.OK,MessageBoxIcon.Information);  
  }  
  }  
   
  private   void   button28_Click(object   sender,   System.EventArgs   e)  
  {  
  string   reGex,reGex2;  
  byte[]   bt=UTF8Encoding.UTF8.GetBytes(textPass.Text.Trim());  
  MD5CryptoServiceProvider   objMD5;  
  objMD5=new   MD5CryptoServiceProvider();  
  byte[]   output=objMD5.ComputeHash   (bt);  
  reGex=BitConverter.ToString   (output);  
  reGex2=reGex.Replace("-","");  
   
  if   (textName.Text==""   ||   textPass.Text   =="")  
  {  
  MessageBox.Show("您提交的信息不完全","提示!");  
  return;  
  }  
  string   strCon   =   "   Provider=Microsoft.Jet.OLEDB.4.0;   Data   Source=usermd5.mdb   ";  
  OleDbConnection   myConn=new   OleDbConnection(strCon);  
  string   strSel   =   "select   count(*)   from   cc_admin   where   usernam="+textName.Text+"   and   passwor="+reGex2+"";  
  myConn.Open();  
  OleDbCommand   myCmd   =   new   OleDbCommand(strSel,myConn);  
  int   Count=(int)myCmd.ExecuteScalar();  
  myConn.Close();  
  if(Count==0)  
  {  
  MessageBox.Show("没有这个用户!请核对您是否输入正确!","提示!");  
  textName.Text="";  
  textPass.Text="";  
  return;  
  }  
  try  
  {  
  MessageBox.Show("通过验证!","提示!",MessageBoxButtons.OK,MessageBoxIcon.Information);  
  textName.Text="";  
  textPass.Text="";  
  }  
  catch   (Exception   ex)  
  {  
  MessageBox.Show(ex.Message,"提示",MessageBoxButtons.OK,MessageBoxIcon.Information);  
  }  
  }


    摘要: 有十个button,其功能就是实现,点击一个button就将button的text属性显示到一个lable上,如: button.text=1 点击后就将1显示到lable上,但是有很多个button,有没有好的方法一次性将这种事件实现,谢谢 ......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE