passwordrecovery.aspx.cs
上传用户:vtryaojia
上传日期:2020-04-18
资源大小:1214k
文件大小:2k
源码类别:

SCSI/ASPI

开发平台:

Others

  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using System.Web.UI.WebControls.WebParts;
  10. using System.Web.UI.HtmlControls;
  11. using System.Data.OleDb;
  12. public partial class passwordrecovery : System.Web.UI.Page
  13. {
  14.     protected void Page_Load(object sender, EventArgs e)
  15.     {
  16.     }
  17.     protected void PwrButton_Click(object sender, EventArgs e)
  18.     {
  19.         string strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("~/App_Data/zzu.mdb") + ";";
  20.         OleDbConnection conn = new OleDbConnection(strConnection);
  21.         conn.Open();
  22.         OleDbCommand cmd1 = new OleDbCommand("select*from [Member] where Name='" + UserName.Text.ToString() + "'and PhoneCode='" + Telephone.Text.ToString() + "'");
  23.         cmd1.Connection = conn;
  24.         OleDbDataReader dr = cmd1.ExecuteReader();
  25.         if (dr.Read())
  26.         {
  27.   Session["Name"]=UserName.Text.ToString();
  28.                 Session["PhoneCode"] = Telephone.Text.ToString();
  29.                 OleDbCommand cmd2 = new OleDbCommand("select password from [Member] where Name='" + UserName.Text.ToString() + "'and PhoneCode='" + Telephone.Text.ToString() + "'");
  30.                 cmd2.Connection = conn;
  31.                 message.Visible = true;
  32.                 message.Text = "你的密码是n" + dr["Password"].ToString().Trim();
  33.             }
  34.   
  35.         else
  36.         {
  37.             Response.Write("<script>alert('不存在该用户!')</script>");
  38.         }
  39.     }
  40. }