📄 login.aspx
字号:
<%@ Page Language="VB" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="system.configuration" %>
<%@ import Namespace="System.Data.SqlClient" %>
<script runat="server">
Dim myConnection As New SqlConnection
Sub Page_Load(Sender As Object, E As EventArgs)
myConnection = New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))
End Sub
Sub login_Click(sender As Object, e As EventArgs)
if username.text="" or password.text="" then
msg.text="帐号和密码不能为空"
else
Dim InsertCmd As String = "select * from admin where username='"+Username.Text+"'"
Dim MyCommand As New SqlCommand(InsertCmd, MyConnection)
dim dr As SqlDataReader
myCommand.Connection.Open()
dr = myCommand.ExecuteReader()
if dr.Read() then
if dr("userpass").ToString()=Password.Text then
Dim cookie As HttpCookie
cookie = New HttpCookie("chkadmin", username.text)
Response.AppendCookie(cookie)
Dim MyCookie As New HttpCookie("chkadmin")
MyCookie.Value=dr("username").ToString()
MyCookie.Expires = DateTime.Now.AddHours(1)
Response.Cookies.Add(MyCookie)
response.redirect("default.aspx")
else
msg.text="密码错误"
end if
else
msg.text="帐号错误"
end if
myCommand.Connection.Close()
end if
End Sub
</script>
<html>
<head>
<title>非非.net留言本</title>
<link href="css/style.css" type="text/css" rel="stylesheet" />
<style type="text/css">.style1 {
COLOR: #ffffff
}
body {
margin-left: 0px;
margin-top: 0px;
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head>
<body>
<!-- #include virtual="./top.inc" -->
<form runat="server">
<table cellspacing="1" cellpadding="2" width="250" align="center" bgcolor="#000000" border="0">
<tbody>
<tr bgcolor="#000000">
<td colspan="2" height="25">
<div align="center"><span class="style1">管理员登陆</span>
</div>
</td>
</tr>
<tr bgcolor="#ffffff">
<td width="78" height="22">
<div align="right">帐号:
</div>
</td>
<td width="160" height="22">
<asp:TextBox id="username" CssClass="input" runat="server"></asp:TextBox>
</td>
</tr>
<tr bgcolor="#ffffff">
<td height="22">
<div align="right">密码:
</div>
</td>
<td height="22">
<asp:TextBox id="password" CssClass="input" runat="server" TextMode="Password"></asp:TextBox>
</td>
</tr>
<tr bgcolor="#ffffff">
<td colspan="2" height="22">
<p align="center">
<asp:Button id="login" onclick="login_Click" runat="server" Text="登录"></asp:Button>
</p>
</td>
</tr>
</tbody>
</table>
<p align="center">
<asp:Label id="msg" runat="server" forecolor="Red"></asp:Label>
</p>
<!-- #include virtual="./boot.inc" -->
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -