简易留言板课程设计报告_第1页
简易留言板课程设计报告_第2页
简易留言板课程设计报告_第3页
简易留言板课程设计报告_第4页
简易留言板课程设计报告_第5页
已阅读5页,还剩14页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、武汉软件工程职业学院课程设计报告2016-2017学年度第 二 学期题目:简易留言板设计姓名:肖志超班级:网络1502系部:计算机学院指导教师:梁晓雅日期:2017年6月13日 摘要在网络网络技术迅速发展以信息交流频繁的今天,网络应用已经渗透到人类社会的各个角落。 作为网络世界的支撑点的网站,更是人们关注的热点:政府利用网站宣传自己的施政纲领,日益成为与百姓交流的直通车;企业利用网站宣传自己的形象,进而挖掘无限商机;个人利用网站展示个性风采,创建彼此沟通的桥梁。越来越多的网站建立了自己的WWW网站。 随着网络技术的不断发展,网络应用已经渗透到人类社会的各个角落。作为网络世界的支撑点的网站,更是

2、人们关注的热点:政府利用网站宣传自己的施政纲领,日益成为与百姓交流的直通车;企业利用网站宣传自己的形象,进而挖掘无限商机;个人利用网站展示个性风采,创建彼此沟通的桥梁。越来越多的企业和个人希望拥有自己的网站,开辟网络世界里的一片天地。BBS 系统是最常见的一类网上社区,是 Internet 上最重要的应用之一。随着 Internet 的普及,许多原本只提供Telnet 方式登录的BBS 系统也提供了允许用户使用HTTP 协议方式进行网上交流的功能,Telnet 与 HTTP 的应用界限开始交融。当用户在网上冲浪访问到一个制作精美、内容丰富的网站时,会想到将自己的喜爱之情告诉网站的制作人。同样,

3、当用户看到一个不能令人满意的网站时,也会想到将自己的高见留给网站的维护者,希望他们能有所改进。这时就要用到互动式网络一个重要的功能留言板系统。 留言板是网站上用户交流信息、相互沟通的乐园。留言板是一种最为简单的BBS 应用。借助留言板,浏览者可以张贴留言给站长或其他浏览者。在企业或单位内部的局域网中,留言板提供了员工之间交流的绝好的场所。留言板可以说是网上最常见的,网站留言管理方式是基于ASP.NET 和脚本语言,将动 态网页和数据库结合,通过应用程序来处理留言。 关键词 ASP.NET, Sqlconnection , connsql, sqldataadapter目录一、综述二、系统设计2

4、.1 系统流程2.2 系统结构2.3 数据库逻辑结构设计三、数据库设计3.1 SQL Sever 2008 简介3.2 userinfo 表结构四、开发实现4.1 用户登录4.2 注册新用户4.3 找回遗忘的密码4.4 修改用户信息五、总结一、综述多数ASP.NET应用程序中都包含有一个用户管理模块,网站管理员或用户可以通过 改模块实现用户登录(身份验证),注册新用户,浏览用户,修改密码,找回遗忘的密码, 改变用户级别或删除用户等操作。蹦设计将使用datdset对象和dataadapter对象相配合设计一个通用的网站用户管理模块。二、系统设计2.1系统流程后台管理系统业务流程图自镒金子前台业务

5、流程图2.2系统结构2.3数据库逻辑结构设计三、数据库设计3.1 SQL Sever 2008 简介SQL Sever是一种高性能的关系数据库系统(RDBMS),其主要特点有:?与 Windows 9x 和 Windows NT 集成?提供企业级的数据库复制?提供并行的体系结构?支持超大型数据库?与OLE对象紧密集成对客户/服务器用户的一个主要挑战就是中央管理跨整个企业范围内的对个服务器。SQL Sever用一个称为分布式管理框架( DMF )的企业级系统管理框架来实现。DMF有对象、服务器和用户管理 Miccrosoft SQL Sever的其他组件组成。SQL Sever Enterpri

6、se Manage位安排和管理多喝服务器提供了一个图形化用户界面(GUI), Sever提供的分布式管理对象(DMO )的能力给SQL Sever引擎和服务器提供可一个对行啊接口。该层包括用户接口组件使用的OLE SQL Sever对象及任何遵循 OLE Sever引擎和服务的途径。该层包含数据库引擎的后端, 并提供有SQL Executive所管理的核心管理服务。3.2userinfo 表结构unameuemailuleveluquesbonanswerE10ADC3949BA,-,1235 163, ecmuser你居住的城市OOeD76E737952r.adnwiC333677O1511

7、b.admadmin你是哪里人8FF1BF5F 38455.杀ALUALUMJLLNLALNULL四、开发实现4.1. 用户登录程序运行后显示如图所示的界面,输入用户名和密码后单击登录链接按钮,即可进入 主页面.即"上*Mil 巾iu KjJtpgA EWq .nBlf * ft"用址画事出用户登录用户包MmWK i!JQ 康本班”也川门也忸9. RHYEf 必心0EUHnBm ."以amMMiEfh廿核心代码如下static string Coonstr =System.Configuration. ConfigurationManager .Connectio

8、nStrings "coonstring" .ToString();SqlConnection conn = new SqlConnection (Coonstr);protected voidPage_Load( object sender,EventArgs e)protected voidLinkButton2_Click( objectsender,EventArgse)Response.Redirect("zuce.aspx");protected voidLinkButton3_Click( objectsender,EventArgse)S

9、ession"zhmm' = TextBox1.Text.Trim();Response.Redirect("zhmm.aspx");protected void LinkButton4_Click( object sender,EventArgse)+ "'andstring yh = "select count(*) from userinfo where uname='"+ TextBox1.Text.Trim()upwd='" + FormsAuthentication .HashPa

10、sswordForStoringInConfigFile(TextBox2.Text.Trim(),"MD5") +conn.Open();SqlCommanctmd = new SqlCommand/h, conn);if ( int )cmd.ExecuteScalar() > 0)stringyhx = "admin" ;stringyhxx = "select count(*) from userinfo where uname='"TextBox1.Text.Trim() +"'and upw

11、d='" +FormsAuthentication .HashPasswordForStoringInConfigFile(TextBox2.Text.Trim(),"MD5") + "'andulevel='"+ yhx +"'" ;SqlCommandcmd1 = new SqlCommand(yhxx, conn);if(int )cmd1.ExecuteScalar() > 0) Session"sf" = "admin" ;Session

12、"s" = TextBox1.Text.Trim();else Session "sf" = TextBox1.Text.Trim(); ; Response.Redirect("xgxx.aspx" );else Response.Write( "<script>alert(' 用户名或密码错误')</script>"); protected void LinkButton1_Click( object sender, EventArgse)string yh = &quo

13、t;select count(*) from userinfo where uname='"+ TextBox1.Text.Trim()+ "'and upwd='"+FormsAuthentication .HashPasswordForStoringInConfigFile( TextBox2.Text.Trim(),"MD5") +conn.Open();SqlCommandcmd = new SqlComman(dyh, conn);if ( int )cmd.ExecuteScalar() > 0)Ses

14、sion"uname" = TextBox1.Text;Response.Redirect("ly.aspx" );); else Response.Write( "<script>alert(' 用户名或密码错误')</script>"4.2. 新用户注册在登录页面点击注册即可进入新用户注册页面核心代码如下static string Coonstr =System.Configuration. ConfigurationManager .ConnectionStrings "coon

15、string" .ToString();SqlConnection conn = new SqlConnection (Coonstr);static int i = 1;protected void Page_Load( object sender, EventArgs e)protected void LinkButton2_Click( object sender, EventArgs e)Response.Redirect("Default.aspx" );protected void LinkButton3_Click( object sender, E

16、ventArgs e)string xyh = "select count(*) from userinfo where uname='"+ TextBox1.Text.Trim()+ "'"conn.Open();SqlCommanctmd = new SqlCommandxyh, conn);if ( int )cmd.ExecuteScalar() > 0)Label1.Text ="用户名重复";else Label1.Text ="可以使用的用户名";int i = 0; prote

17、cted void LinkButton1_Click( object sender, EventArgs e)conn.Open();if (i != 0) string ss = "user" /string cyh = "insert into userinfo values。" + TextBoxl.Text + "','" +TextBox2.Text + "','"+ TextBox4.Text + "','"+ ss + "

18、""+ DropDownList1.SelectedValue.ToString()+ "','"+ FormsAuthentication.HashPasswordForStoringInConfigFile(TextBox5.Text,"MD5") + "')"string cyh = "insert intouserinfo(uname,upwd,uemail,ulevel,uquestion,uanswer) values。"+ TextBox1.Text +&q

19、uot;','"+FormsAuthentication.HashPasswordForStoringInConfigFile(TextBox2.Text,"MD5") + "','"+TextBox4.Text +"','"+ ss +"','"+ DropDownList1.SelectedValue.ToString() +"','"+FormsAuthentication.HashPasswordF

20、orStoringInConfigFile(TextBox5.Text,"MD5") + "')"SqlCommandcmd = new SqlCommandcyh, conn);int num = cmd.ExecuteNonQuery(); if (num > 0) Response.Write("<script>alert('用户注册成功')</script>" ); else Response.Write( "<script>alert('用户

21、注册失败')</script>" ); else Response.Write( "<script>alert('请检查用户名')</script>" ); 4.3找回遗忘的密码在用户登录界面中输入用户名,单击“忘记密码”链接按钮打开如图所示的界面,程序根据用户输入的用户名,在页面中显示注册时填写的安全问题,若用户能正确回答安全问题答案,即可重置密码用户名安全向电安生归的尊案admin3 34网一通.Fi«Iuk的小修加*度现超.肝干理f H曝谭同电鹏叫母.忠可以口田善整修二网幽廿鼻E,核心代码

22、如下public partial class zhmm: System.Web.UI. Pagestatic string Coonstr =System.Configuration. ConfigurationManager .ConnectionStrings "coonstring" .ToString();SqlConnection conn = new SqlConnection (Coonstr);protected void Page_Load( object sender, EventArgs e)if (!IsPostBack) Label1.Text =

23、Convert .ToString(Session "zhmm");if (Label1.Text= "" ) Response.Redirect("Default.aspx" ); DropDownList1.Items.Clear();conn.Open();this .DropDownList1.Items.Add( "" );string mm = "select uquestion from userinfo where uname='"+Session "zhmm&

24、quot;+ "'" ;SqlCommandsql = new SqlComman(dmm, conn);SqlDataReader dr = sql.ExecuteReader();while (dr.Read() this .DropDownList1.Items.Add(dr "uquestion" .ToString();protected void LinkButton1_Click( object sender, EventArgs e)string m = "select count(*) from userinfo wh

25、ere uname='"+ Session "zhmm" + "'anduanswer='" + FormsAuthentication .HashPasswordForStoringInConfigFile(TextBox1.Text.Trim(), "MD5") + "'and uquestion='" +DropDownList1.SelectedValue.ToString() +"'" ;conn.Open();SqlComma

26、ndcmd = new SqlComman(dm, conn);if ( int )cmd.ExecuteScalar() > 0)Response.Write("<script>alert(' 找回成功')</script>" );else Response.Write( "<script>alert(' 用户名错误或者答案错误')</script>" ); protected void LinkButton2_Click( object sender, EventA

27、rgs e)Response.Redirect("Default.aspx" );4.4.修改用户信息在用户登录页面中输入用户名和密码,单击“修改用户信息”链接按钮讲打开用户管理页面。管理员用户可以使用页面中的所有功能,而普通用户只能修改自己的密码,电子邮箱等信息。核心代码如下public partial class xgxx : System.Web.UI. Page static string Coonstr =System.Configuration. ConfigurationManager .ConnectionStrings "coonstring&q

28、uot; .ToString();SqlConnection conn = new SqlConnection (Coonstr);protected void Page_Load( object sender, EventArgs e) if (!IsPostBack)if ( string )Session "sf" = "admin")string dr = "select uname,uemail,ulevel from userinfo where ulevel='user'"DropDownList1.It

29、ems.Clear();conn.Open();DropDownList1.Items.Add(Session"sf" .ToString();DropDownList2.Items.Add("admin");SqlCommandsql = new SqlCommanddr, conn);SqlDataReader dr1 = sql.ExecuteReader();while (dr1.Read()this .DropDownList1.Items.Add(dr1 "uname".ToString(); conn.Close();s

30、tring drq = "select uname ,uemail,ulevel from userinfo where ulevel='"+Session "s" + "'" ;conn.Open();SqlCommandsq1l = new SqlCommand(drq, conn);SqlDataReader dr11 = sq1l.ExecuteReader();while (dr11.Read()TextBox3.Text = dr11"uemail" .ToString();else&q

31、uot;sf" .ToString();false ;"user" );false ; DropDownList1.Items.Add(SessionDropDownList1.Enabled =DropDownList2.Items.Add(LinkButton2.Enabled =protected void LinkButton1_Click( object sender, EventArgs e) conn.Open();string cz = "update userinfo set upwd='"+FormsAuthenti

32、cation .HashPasswordForStoringInConfigFile(TextBox2.Text.Trim(),"MD5") +"',uemail='" +TextBox3.Text.Trim()+ "' where uname='" + Session "sf" + "'" ;SqlCommandcmd = new SqlComman(dcz, conn);if ( int )cmd.ExecuteNonQuery() > 0)Re

33、sponse.Write("<script>alert(' 用户信息修改成功')</script>" );protected void LinkButton3_Click( object sender, EventArgs e)Default.aspx" );Response.Redirect( protected void DropDownList1_SelectedIndexChanged( object sender, EventArgs e) TextBox3.Text ="" ;string y

34、x = "select uemail,ulevel from userinfo whereuname='" +DropDownList1.SelectedValue.ToString()+ "'" ;conn.Open();DropDownList2.Items.Clear();SqlCommandsql = new SqlComman(dyx, conn);SqlDataReader dr1 = sql.ExecuteReader();while (dr1.Read()TextBox3.Text = dr1"uemail" .ToString();DropDownList2.Items.Add(dr1 "ulevel" .ToString(); 五、总结做课设让我对ASP.NET 有了新的认识,首先我接触了很多上课见过见过但没有实际用过的类和方法,让我对编程有了许多新的思想。虽然系统的基本功能都已实现,但还是存在系统不稳定等多个问题尚待解决。这个系统主要是我自己开发的,但也得到了老师和同学的很大帮助。我正在做系统的过程

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论