91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡(jiǎn)介

開發(fā)環(huán)境為VS2010+SQL2008,一個(gè)簡(jiǎn)易的留言板程序,管理員可對(duì)留言用戶進(jìn)行增刪改查。留言板利用Session對(duì)象記錄登錄時(shí)的用戶名,可以顯示在留言板中。

資源截圖

代碼片段和文件信息

using?System;
using?System.Data;
using?System.Configuration;
using?System.Web;
using?System.Web.Security;
using?System.Web.UI;
using?System.Web.UI.WebControls;
using?System.Web.UI.WebControls.WebParts;
using?System.Web.UI.HtmlControls;
using?System.Data.SqlClient;
using?System.Configuration;

public?partial?class?_Default?:?System.Web.UI.Page?
{
????protected?void?Page_Load(object?sender?EventArgs?e)
????{
????????this.title?=?“簡(jiǎn)易留言板——用戶登錄“;
????????
????}
????protected?void?Login_Click(object?sender?EventArgs?e)
????{
????????if?(Username.Text?==?““?||?UserPwd.Text?==?““)
????????{
????????????Response.Write(“ript?language=javascript>alert(‘用戶名或密碼不得為空!‘);ript>“);
????????????return;
????????}
????????//設(shè)置conn對(duì)象的連接字符串
????????string?ConnSql?=?ConfigurationManager.ConnectionStrings[“ConnString“].ToString();
????????
????????//聲明conn為一個(gè)SQL?Server連接對(duì)象
????????SqlConnection?Conn?=?new?SqlConnection(ConnSql);
????????
????????Conn.Open(); //打開連接
????????//使用MD5算法加密用戶口令
????????string?SecPwd?=?FormsAuthentication.HashPasswordForStoringInConfigFile(UserPwd.Text?“MD5“);
????????string?StrinSQL?=?“select?*?from?userinfo?where?u_name=‘“?+?Username.Text?+?“‘?and?u_password=‘“?+?SecPwd?+?“‘“;
????????//聲明一個(gè)Command對(duì)象com,該對(duì)象使用conn指定的連接,執(zhí)行strSQL指定的SQL語(yǔ)句
????????SqlCommand?SelectCom?=?new?SqlCommand(StrinSQL?Conn);
????????//執(zhí)行查詢,返回一個(gè)DataReader對(duì)象
????????SqlDataReader?dr?=?SelectCom.ExecuteReader();

????????if?(!dr.Read())
????????{
????????????Response.Write(“ript?language=javascript>alert(‘用戶名或密碼錯(cuò)!‘);ript>“);
????????}
????????else
????????{
????????????Session[“Pass“]?=?dr[“u_name“]; //將用戶名字段值保存到Session對(duì)象pass中
????????????Response.Redirect(“msg.aspx“);
????????}

????????dr.Close(); //關(guān)閉Reader對(duì)象
????????Conn.Close(); //關(guān)閉連接

????}
????protected?void?Register_Click(object?sender?EventArgs?e)
????{???????
????????Response.Redirect(“register.aspx“);
????}
????protected?void?Repassword_Click(object?sender?EventArgs?e)
????{
????????if?(Username.Text?==?““)
????????{
????????????Response.Write(“ript?language=javascript>alert(‘請(qǐng)輸入用戶名!‘);ript>“);
????????}
????????else
????????{
????????????Session[“username“]?=?Username.Text;?????//將用戶名通過(guò)Session對(duì)象username傳遞到recover.aspx
????????????Response.Redirect(“recover.aspx“);
????????}
????}
????protected?void?Memanger_Click(object?sender?EventArgs?e)
????{
????????if?(Username.Text?!=?“admin“)
????????{
????????????Response.Write(“ript?language=javascript>alert(‘請(qǐng)使用管理員身份登錄!‘);ript>“);
????????????return;
????????}
????????
????????string?ConnSql?=?System.Configuration.ConfigurationManager.ConnectionStrings[“ConnString“].ConnectionString;??????
????????SqlConnection?Conn?=?new?SqlConnection(ConnSql);
????????Conn.Open();
????????string?SecPwd?=?FormsAuthentication.HashPasswordForStoringInConfigFile(UserPwd.Text?“MD5“);
????????string?StrinSQL?=?“select?*?from?userinfo?where?u_name=‘a(chǎn)dmin‘?and?u_password=‘

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2009-10-14?12:15??Chapter14\
?????文件?????4194304??2009-10-14?16:11??Chapter14\guestbook.mdf
?????文件?????1048576??2009-10-14?16:11??Chapter14\guestbook_log.ldf
?????目錄???????????0??2009-10-14?12:36??Chapter14\綜合實(shí)訓(xùn)\
?????目錄???????????0??2019-06-15?21:18??Chapter14\綜合實(shí)訓(xùn)\App_Data\
?????文件????????2185??2009-10-14?12:22??Chapter14\綜合實(shí)訓(xùn)\Default.aspx
?????文件????????3793??2009-10-14?12:33??Chapter14\綜合實(shí)訓(xùn)\Default.aspx.cs
?????文件????????3361??2009-09-28?10:39??Chapter14\綜合實(shí)訓(xùn)\msg.aspx
?????文件????????3111??2009-09-28?12:45??Chapter14\綜合實(shí)訓(xùn)\msg.aspx.cs
?????文件????????3292??2009-09-28?18:13??Chapter14\綜合實(shí)訓(xùn)\recover.aspx
?????文件????????3815??2009-09-28?13:40??Chapter14\綜合實(shí)訓(xùn)\recover.aspx.cs
?????文件????????2950??2009-09-28?18:22??Chapter14\綜合實(shí)訓(xùn)\register.aspx
?????文件????????4221??2009-09-28?17:59??Chapter14\綜合實(shí)訓(xùn)\register.aspx.cs
?????文件????????3139??2009-09-28?14:50??Chapter14\綜合實(shí)訓(xùn)\users.aspx
?????文件????????3586??2009-09-28?13:22??Chapter14\綜合實(shí)訓(xùn)\users.aspx.cs
?????文件????????8417??2009-10-14?12:36??Chapter14\綜合實(shí)訓(xùn)\web.config

評(píng)論

共有 條評(píng)論