網(wǎng)站開發(fā)項目報告書_第1頁
網(wǎng)站開發(fā)項目報告書_第2頁
網(wǎng)站開發(fā)項目報告書_第3頁
網(wǎng)站開發(fā)項目報告書_第4頁
網(wǎng)站開發(fā)項目報告書_第5頁
已閱讀5頁,還剩21頁未讀 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

1、項目報告書注冊與登錄科目:web項目開發(fā) 學號: 姓名: 班級:軟件10301班現(xiàn)在網(wǎng)站功能越來越多,但很多的網(wǎng)站都需要用戶是網(wǎng)站的會員,通過會員登錄才能夠使用網(wǎng)站中的一些功能。會員的登錄與注冊已成為眾多網(wǎng)站的基本功能之一。網(wǎng)站會員的注冊與登錄Ø 掌握會員注冊功能的實現(xiàn)Ø 了解驗證控件的使用Ø 了解MD5加密技術(shù)Ø 掌握會員登錄功能的實現(xiàn)Ø 了解驗證碼技術(shù)Ø 培養(yǎng)網(wǎng)站開發(fā)技術(shù),積累相關(guān)開發(fā)經(jīng)驗 現(xiàn)在網(wǎng)站的很多功能都是需要會員才能使用,例如在網(wǎng)站上下載一些資料,查看文章,留言等。這就需要開發(fā)人員給網(wǎng)站設(shè)計登錄與注冊的功能。這樣使用戶成為

2、會員后能使用更多的功能。本學期初,在老師帶領(lǐng)之下學生獨立開發(fā)一個web項目,實現(xiàn)網(wǎng)站會員登錄與注冊功能。通過本項目熟悉網(wǎng)站開發(fā)的基本流程,掌握相關(guān)技術(shù),積累開發(fā)經(jīng)驗。 軟件10301班師生成員2012年2月2012年3月二可行性研究報告網(wǎng)站會員注冊與登錄項目運用.NET、數(shù)據(jù)庫、MD5加密和C#相關(guān)技術(shù),有其相應(yīng)的運行環(huán)境,本案通過對其相應(yīng)的研究確定開發(fā)可行性及注意事項。2可行性研究的前提本項目實例主要包括三種操作,即用戶登錄、用戶注冊及用戶密碼的修改。用戶運行登錄界面,如果用戶沒有注冊會員可以單擊“新會員注冊”按鈕跳轉(zhuǎn)到會員注冊頁面,在此頁面可以先判斷用戶輸入的會員名是否存在,如果存在需要輸

3、入會員名,如果不存在用戶可以繼續(xù)輸入個人資料來完成注冊,完成注冊后添加注冊日志。如果用戶名已經(jīng)注冊,則可以直接輸入會員名、密碼和驗證碼,單擊“登錄”按鈕進行登錄。在單擊“登錄”按鈕時,系統(tǒng)首先判斷用戶輸入的信息和驗證碼是否正確,如果正確,再判斷用戶輸入的會員名和密碼是否正確,都正確后登錄成功,同時添加登錄日志。在登錄頁面中,單擊“修改密碼”按鈕,進入修改密碼頁面,在此頁面用戶可以修改原有密碼。注冊用戶名并用該用戶名登錄進入首頁,修改用戶密碼后重新登錄。使用驗證碼技術(shù)提高網(wǎng)站安全性。 技術(shù)、團隊團結(jié)力、開發(fā)人員的意志和恒心系統(tǒng)開發(fā)語言:ASP.NET、C#語言、HTML語言基礎(chǔ)、CSS樣式布局數(shù)

4、據(jù)庫:SQL Server 2005系統(tǒng)開發(fā)環(huán)境:Microsoft Visual Studio 2008運行平臺:Windows XPWeb服務(wù)器:IIS程序業(yè)務(wù)流程圖該系統(tǒng)主要分為三部分:登錄部分、 注冊部分和修改密碼部分。為了方便用戶者可以根據(jù)需求進行操作 ,本系統(tǒng)還可對用戶的賬號和密碼進行進入管理。需要用戶注冊用戶名和密碼。.NET網(wǎng)站開發(fā)技術(shù),C#程序設(shè)計語言,數(shù)據(jù)庫技術(shù),MD5加密技術(shù)滿足相關(guān)相關(guān)技術(shù)要求和設(shè)備需求,可以開發(fā)本項目通過研究具備相關(guān)的開發(fā)條件,可以開發(fā)本項目。開發(fā)過程中仍需進一步鉆研、進取,結(jié)合所學知識綜合運用,在實踐中加深對知識的理解。三需求規(guī)格說明書網(wǎng)站會員的注冊

5、與登錄功能的實現(xiàn)需要相應(yīng)的開發(fā)和運行環(huán)境,本案介紹該項目在開發(fā)和運行過程中所需的準備工作和相關(guān)規(guī)格需求,以規(guī)范該項目,保證功能的完整性和網(wǎng)站的安全性。1、現(xiàn)在網(wǎng)站的很多功能都需要是會員才能登錄,例如在網(wǎng)站上下載一些資料,查看某些文件,留言等。這就需要開發(fā)人員給網(wǎng)站設(shè)計登陸和注冊的功能。這樣使用戶成為會員后能事更多的功能。本項目的具體功能實現(xiàn)如下:Ø 判斷用戶輸入的會員名和密碼是否正確;Ø 利用驗證碼來防止用戶的非法操作Ø 用戶登錄成功添加登陸日志Ø 注冊新會員Ø 判斷注冊新的會員是否被用過Ø 判斷用戶輸入的資料是否合法Ø 用

6、戶注冊成功添加注冊日志系統(tǒng)開發(fā)環(huán)境:Microsoft Visual Studio 2008系統(tǒng)開發(fā)語言:et+C#運行平臺:Windows XP數(shù)據(jù)庫:SQL Server 2005Web服務(wù)器: IIS 登錄與注冊系統(tǒng)的規(guī)范有以下幾個方面:(1)界面設(shè)計友好、美觀。(2)數(shù)據(jù)存儲安全、可靠。(3)信息分類清晰、準確。(4)提供靈活、方便的權(quán)限設(shè)置功能,使整個系統(tǒng)的管理分工明確。(5)具有易維護性和易操作性。四概要設(shè)計說明書該項目主要有三個功能模塊:登錄模塊、注冊模塊和修改密碼模塊。三個模塊對應(yīng)三個頁面,有相應(yīng)的數(shù)據(jù)在三個頁面間傳遞。本案主要介紹該項目的總體設(shè)計和對應(yīng)的模塊功能劃分。修改模塊

7、修改用戶密碼 (修改用戶信息)登錄模塊用戶登錄主頁面(檢驗用戶信息并登錄新頁)注冊模塊注冊用戶名和密碼(生成用戶信息) 1.1登錄模塊:(1)用戶輸入用戶名、密碼和驗證碼,如果正確點擊登錄跳轉(zhuǎn)到主頁面,同時向數(shù)據(jù)庫添加登陸日志。若錯誤則不能跳轉(zhuǎn)到主頁面并給出相應(yīng)提示。(2) 單擊“新會員注冊”按鈕,跳轉(zhuǎn)到注冊頁面;(3) 單擊“修改密碼”按鈕,跳轉(zhuǎn)到修改密碼頁面。1.2注冊模塊:(1)輸入用戶名,單擊“檢測而用戶名”按鈕,檢測用戶名是否存在。(2) 如存在則重新輸入用戶名用該用戶登錄。(3) 若不存在則輸入其他信息,驗證過通過后點擊“注冊用戶”按鈕,完成注冊同時向數(shù)據(jù)庫中添加注冊日志。1.3修

8、改模塊:(1)填寫用戶名、舊密碼和新密碼,單擊“確認修改”按鈕。(2) 若輸入用戶名及密碼一致,則修改成功并更改后臺數(shù)據(jù)庫。(3) 若輸入用戶名及密碼不一致,則彈出“修改失敗”對話框。 本系統(tǒng)采用SQL SERVER 2005數(shù)據(jù)庫,主要有3個表:logininfo,loginlog,rntrylog.數(shù)據(jù)表logininfo用來存儲后臺會員名稱,密碼和基本資料數(shù)據(jù)庫設(shè)計結(jié)構(gòu)實效:2.1用戶信息表:字段類型長度說明IDInt4主鍵(自動編號)NameVarchar50會員名PassVarchar50密碼SexBit2性別PhoneVarchar50電話E_mailVarchar50電子郵箱表L

9、ogininfo的結(jié)構(gòu)及實效2.2注冊日志表:字段類型長度說明IDInt4主鍵(自動編號)NameVarchar50會員名LogindateDatetime8會員注冊日期表Loginlog的結(jié)構(gòu)及實效2.3登錄日志表:字段類型長度說明IDInt4主鍵(自動編號)NameVarchar50會員名LandingdateDatetime8會員登錄日期表entrylog的結(jié)構(gòu)及實效輸入密碼時,使用MD5加密技術(shù)向后臺數(shù)據(jù)庫添加用戶密碼信息。將信息保存到數(shù)據(jù)庫前應(yīng)考慮一下密碼的安全性,MD5是單項加密,根據(jù)指定的密碼和散列算法生成一個合適于存儲在配置文件中的散列密碼。引用的命名空間為System.Web

10、.Security;語法:public static string HashPasswordForStoringInConfigFile (string password, string passwordformat);參數(shù)說明:Password 要進行散列運算的密碼;Passwordformat 要使用的散列算法五詳細設(shè)計說明書本案主要介紹各個頁面的主要控件及功能實現(xiàn),通過實例展現(xiàn)出項目開發(fā)的詳細過程。網(wǎng)頁設(shè)計結(jié)構(gòu)圖1.登錄頁設(shè)計驗證碼技術(shù) 驗證碼的作用是有效防止注冊用戶用特定程序集暴力破解方式進行不斷的登錄嘗試來破解密碼,不少網(wǎng)站為了防止用戶利用機器人自動注冊,登錄,灌水,都采用了驗證碼技

11、術(shù)。下面詳細介紹驗證碼技術(shù)的實現(xiàn)。需要引用using System.Drawing ;using System.IO;命名空間。主要代碼如下:public partial class yanzhengma : System.Web.UI.Page protected void Page_Load(object sender, EventArgs e) string checkCode = CreateRandomCode(4); Session"CheckCode" = checkCode; CreateImage(checkCode); private string Cr

12、eateRandomCode(int codeCount) string allChar="0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,s,y,z," string allCharArray =allChar .Split (','); string randomcode = "" int temp; Random rand=new Random (); for (int i=0;i<codeCount ;i+) int t=rand .Next

13、 (35); temp =t ; randomcode += allCharArray t; return randomcode ; private void CreateImage(string checkCode) int iwdth = (int)(checkCode.Length * 20.5); System.Drawing.Bitmap image = new System.Drawing.Bitmap(iwdth, 30); Graphics g = Graphics.FromImage(image); Font f=new System .Drawing .Font (&quo

14、t;宋體",20,System.Drawing .FontStyle .Bold ); Brush b = new System.Drawing.SolidBrush(Color.White); g.Clear(Color.BurlyWood); g.DrawString(checkCode, f, b, 3, 3); Pen blackPen = new Pen(Color.Blue, 0); Random rand = new Random(); for (int i = 0; i < 2; i+) int y = rand.Next(image.Height); g.Dr

15、awLine(blackPen, 0, y, image.Width, y); for (int i = 0; i < 150; i+) int x = rand.Next(image.Width); int y = rand.Next(image.Height); image.SetPixel(x, y, Color.FromArgb(rand.Next(); System.IO.MemoryStream ms = new System.IO.MemoryStream(); image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);

16、 Response.ClearContent(); Response.ContentType = "image/Jpeg" Response.BinaryWrite(ms.ToArray(); g.Dispose(); image.Dispose(); 運行如圖所示圖1-3頁面設(shè)置:控件類型空間名稱用途TextBox控件Textname會員名Textpass密碼Textbosyzm驗證碼Button控件Button1登錄Button2重置Image控件Image1顯示驗證碼linkButton控件linkButton1鏈接注冊頁面運行實例如圖:登錄頁面關(guān)鍵代碼:需要引用us

17、ing System.Data.SqlClient;usingng;命名空間;public partial class _Default : System.Web.UI.Page protected void Page_Load(object sender, EventArgs e) if (!IsPostBack) this.Image1.ImageUrl = "/ValidataCode.aspx" protected void LinkButton1_Click(object sender, EventArgs e) this.Image1.ImageUrl = &q

18、uot;/ValidataCode.aspx" protected void Button1_Click(object sender, EventArgs e) string name = Textname.Text.Trim(); string pwd = Textpwd.Text.Trim(); string code = Textcode.Text.Trim(); string str = "server=.;uid=sa;pwd=123;database=sss" SqlConnection con=new SqlConnection(str); try

19、con.Open(); string str2 = "select count(*) from Logininfo where name=name and pass=pwd" SqlCommand cmd = new SqlCommand(str2, con); cmd.Parameters.Add("name", SqlDbType.VarChar, 50); cmd.Parameters"name".Value = name; cmd.Parameters.Add("pwd", SqlDbType.VarCha

20、r, 50); cmd.Parameters"pwd".Value = FormsAuthentication.HashPasswordForStoringInConfigFile(Textpwd.Text, "MD5"); int count = Convert.ToInt16(cmd.ExecuteScalar(); if (count > 0 & Session"checkCode".ToString() = code) this.Textcode.Text = "" Session"

21、login" = "true" cmd = new SqlCommand("insert entrylog values('" + Textname.Text + "','" + DateTime.Now.ToString() + "')", con); cmd.ExecuteNonQuery(); /Response.Redirect("Sucess.aspx"); Response.Write("<script>alert(&#

22、39;登錄成功!')</script>"); else this.Textcode.Text="" Response.Write("<script>alert('密碼或用戶名錯誤!')</script>"); catch(Exception error) Response.Write(error.ToString(); 2.注冊頁面設(shè)計會員注冊主要將用戶輸入的信息存儲到數(shù)據(jù)庫中,這里使用到了數(shù)據(jù)庫的技術(shù),通過使用SQLConnection對象鏈接數(shù)據(jù)庫,將數(shù)據(jù)庫做成一個自定義方法ree

23、ateloginconn在需要用到數(shù)據(jù)庫鏈接時調(diào)用此方法。頁面設(shè)置:控件類型控件名稱用途TextBoxTextname輸入會員名Textpass輸入密碼Textpasses確認密碼Textphone輸入電話Textmail輸入電子郵件Buttonbtnlogin將信息添加到數(shù)據(jù)庫btnreturn返回都登錄頁面btndete檢測是否有該用戶運行實例如圖關(guān)鍵代碼:protected SqlConnection createloginconn() SqlConnection con = new SqlConnection("server=.;database=xsdl;Integrate

24、d security=SSPI;"); return con;注意:此方法中應(yīng)用了System.Data.SqlClicent命名空間中的Sqlconnection對象,需要引用System.Data.SqlClicent命名空間。主要程序代碼: protected void ButtonisName _Click(object sender, EventArgs e) int i = isName(); if (i > 0) RegisterStartupScript("yes", "<script>alert('會員名已經(jīng)存

25、在!')</script>"); else RegisterStartupScript("no", "<script>alert('可以注冊!')</script>"); protected int isName() int i; string name = Textname.Text; if (name.Trim() != "") SqlConnection con = createloginconn(); con.Open(); SqlCommand com =

26、 new SqlCommand("select count(*) from logininfo where Name='" + name + "'", con); return i = Convert.ToInt32(com.ExecuteScalar(); con.Close(); else return i = 1; protected void ButtonLogin _Click(object sender, EventArgs e) int i = isName(); if (i <= 0) if (add() SqlCo

27、nnection con = this.createloginconn(); con.Open(); SqlCommand com = new SqlCommand("insert loginlog(name,logindate) values('" + Textname.Text + "','" + DateTime.Now.ToString() + "')", con); com.ExecuteNonQuery(); Response.Write("<script>alert(

28、'注冊成功!單擊確定返回登陸頁面');location='landing.aspx'</script>"); con.Close(); else Response.Write("<script>alert('注冊失敗')</script>"); else Response.Write("<script>alert('會員名已經(jīng)存!')</script>"); public bool add() string name =

29、Textname.Text; string pass = FormsAuthentication.HashPasswordForStoringInConfigFile(Textpass.Text, "MD5"); string email = TextEmail.Text; string address = Textaddress.Text; string sql = "insert into logininfo(name,pass,email,address) values('" + name + " ','"

30、; + pass+ "','" +email + "','" + address + "')" SqlConnection con = this.createloginconn(); con.Open(); SqlCommand com = new SqlCommand(sql, con); int i =Convert.ToInt32 (com.ExecuteNonQuery(); if (i > 0) return true; else return false; con.Close(

31、); 3.修改密碼頁面設(shè)計界面設(shè)置:單擊“修改密碼”超鏈接轉(zhuǎn)到注冊頁面。所有用戶登錄后都可以修改自己的密碼,當輸入的新密碼兩次一致是即可修改成功。在窗體中添加控件,添加的主要控件及用途見下表1-5控件類型空間名稱用途TextBox控件Textbox1會員名Textbox2密碼Textbox3新密碼Textbox4確認密碼Button控件Button1確認Button2取消關(guān)鍵代碼:需要引用using System.Data.SqlClient;命名空間public partial class xiugaimima : System.Web.UI.Page protected void Page

32、_Load(object sender, EventArgs e) if (Session"login" = "false") Response.Redirect("landing.aspx"); protected void Button1_Click(object sender, EventArgs e) string name = this.TextBox1.Text.Trim(); string oldpwd = this.TextBox2.Text.Trim(); string newpwd = this.TextBox3.

33、Text.Trim(); try SqlConnection con = new SqlConnection("server=.;database=xsdl;Integrated security=SSPI"); con.Open(); string str = "select count(*) from logininfo where name=name and pass=oldpwd" SqlCommand cmd = new SqlCommand(str, con); cmd.Parameters.Add("name", Sql

34、DbType.VarChar, 50); cmd.Parameters"name".Value = name; cmd.Parameters.Add("oldpwd", SqlDbType.VarChar, 50); cmd.Parameters"oldpwd".Value = FormsAuthentication.HashPasswordForStoringInConfigFile(oldpwd, "MD5"); int count = Convert.ToInt16(cmd.ExecuteScalar();

35、if (count > 0) string str2 = "update logininfo set pass='" + FormsAuthentication.HashPasswordForStoringInConfigFile(newpwd, "MD5") + "' where name='" + name + "'" cmd.CommandText = str2; cmd.ExecuteNonQuery(); Response.Write("<script

36、>alert('注冊成功!單擊確定返回登陸頁面');location='landing.aspx'</script>"); else Response.Write("<script>alert('沒有此用戶')</script>"); this.TextBox1.Text = "" TextBox1.Focus(); catch Response.Write("<script>alert('修改密碼不成功')</script>"); protected void Button2_Click(object sender, EventArgs e) R

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論