温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:Vb.net网上订票系统源码
1Public Class login1 2
Inherits System.Web.UI.UserControl 3
4
Web 窗体设计器生成的代码 41
Dim userID, userNickName As String 42
Dim struserName, struserPwd As String 43
Dim SqlDb As SQLDb = New SQLDb 44
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 45
46
lblTime.Text = Date.Now.ToLongDateString & " " & Date.Now.DayOfWeek.ToString 47
' lbluserName.Text = Request.QueryString("userName") 48
Dim userInfos As HttpCookie = Request.Cookies("userInfo") 49
'Dim userName As String 50
51
If Session("userNickName") <> "" Then 52
lbluserName.Visible = True 53
Label3.Visible = True 54
lbluserName.Text = Session("userNickName") 55
lkbtnQuit.Visible = True 56
txtLoginName.Visible = False 57
txtPwd.Visible = False 58
Label1.Visible = False 59
imgbtnLogin.Visible = False 60
Label2.Visible = False 61
Panel1.Visible = True 62
Else 63
If Request("flag") = 1 Or Request("flag") = "" Then 64
Else 65
If Not userInfos Is Nothing Then 66
strusername = userInfos.Values("userName") 67
struserPwd = userInfos.Values("userPwd") 68
geruserInfo() 69
End If 70
End If 71
72
End If 73
74
End Sub 75
'登录 76
Private Sub imgbtnLogin_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles imgbtnLogin.Click 77
78
79
'成功登录后进入用户个人页面,否则进入登录页面,进行重新登录或注册 80
geruserInfo() 81
82
End Sub 83
Sub geruserInfo() 84
Dim strUserName As String = Trim(txtLoginName.Text.ToString) 85
Dim strUserPwd As String = Trim(txtPwd.Text.ToString) 86
87
If SqlDb.GetuserInfo(struserName, struserPwd, userID, userNickName) = 1 Then 88
Session("userNickName") = userNickName 89
Session("userID") = userID 90
Session("_login") = 1 91
Session("biaozhi") = 3 92
'If rdmem.Checked Then 93
' Response.Cookies("userInfo")("userName") = struserName 94
' Response.Cookies("userInfo")("userPwd") = struserPwd 95
' Response.Cookies("userInfo").Expires = Now.AddMonths(6) 96
'End If 97
Response.Redirect("userinfo.aspx") 98
Else 99
Response.Redirect("responseInfo.aspx?flag=2") 100
End If 101
End Sub 102
Private Sub lkbtnQuit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lkbtnQuit.Click 103
104
Session("_login") = 0 105
Session("userNickName") = "" 106
Session("userID") = "" 107
Response.Redirect("index.aspx?flag=1") 108
109
End Sub 110
111
Private Sub lbluserName_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lbluserName.Click 112
Response.Redirect("userinfo.aspx?flag=0") 113
End Sub 114
End Class 115







