📄 pass.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)
If IsNothing(request.cookies("chkadmin")) Then
response.redirect("login.aspx")
else
myConnection = New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))
username.text = request.cookies("chkadmin").Value
end if
End Sub
Sub Button1_Click(sender As Object, e As EventArgs)
if userpass.text="" or userpass2.text="" then
msg.text="请填写完整的表单"
elseif userpass.text <> userpass2.text then
msg.text="新密码与确认密码不一致"
else
Dim InsertCmd As String = "update admin set userpass=@userpass where username=@username"
Dim MyCommand As New SqlCommand(InsertCmd, MyConnection)
MyCommand.Parameters.Add(New SqlParameter("@userpass", SqlDbType.VarChar, 16))
MyCommand.Parameters("@userpass").Value = userpass.text
MyCommand.Parameters.Add(New SqlParameter("@username", SqlDbType.VarChar, 16))
MyCommand.Parameters("@username").Value = username.text
myCommand.Connection.Open()
myCommand.ExecuteNonQuery()
myCommand.Connection.Close()
response.redirect("default.aspx")
end if
End Sub
</script>
<html>
<head>
<title>非非.net留言本</title>
<link href="css/style.css" type="text/css" rel="stylesheet" />
<style type="text/css">
body {
margin-left: 0px;
margin-top: 0px;
}
.style1 {color: #FFFFFF}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head>
<body>
<!-- #include virtual="./top.inc" -->
<form runat="server">
<table border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#000000" style="WIDTH: 328px; HEIGHT: 184px">
<tbody>
<tr bgcolor="#000000">
<td colspan="2" height="25">
<div align="center"><span class="style1">修改密码</span></div>
</td>
</tr>
<tr bgcolor="#ffffff">
<td width="100" height="20">
<p align="right">
用户名:
</p>
</td>
<td width="216" height="20"><asp:Label ID="username" runat="server" /></td>
</tr>
<tr bgcolor="#ffffff">
<td height="20">
<p align="right">
新密码:
</p>
</td>
<td height="20"><asp:TextBox ID="userpass" CssClass="input" runat="server" Columns="20" MaxLength="16" TextMode="Password" /></td>
</tr>
<tr bgcolor="#ffffff">
<td height="20">
<p align="right">
确认密码:
</p>
</td>
<td height="20"><asp:TextBox ID="userpass2" CssClass="input" runat="server" MaxLength="16" Columns="20" TextMode="Password" /></td>
</tr>
<tr bgcolor="#ffffff">
<td colspan="2" height="20"><p align="center"><asp:Button id="Button1" onclick="Button1_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 + -