月度归档: 2006 年 11 月

  • 武汉大学首届中国移动杯搜索大赛开始啦

    协会成立后的又一大创举,但毕竟精力有限,规模谈不上盛大。

    花三个小时做好了初赛的网上答题系统,结果赶上郑州的服务器遭攻击,上午刚搞好傍晚又掉了。等待吧。不知道是不是故意选在周末攻击我们的服务器,好在服务商也在积极响应。

    移动很不错,支持力度很大,我们也希望人气再好一点。

    http://www.infolit.cn ,有时间来看看哦

  • ASP.NET2.0(VB)+ACCESS的自定义登陆页

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Login.aspx.vb" Inherits="Login" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>Login</title>
        <link href="Images/style.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <table style="width: 387px">
                <tr>
                    <td style="width: 7px">
                        UserName</td>
                    <td>
                        <asp:TextBox ID="TextBoxU" runat="server"></asp:TextBox></td>
                    <td>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBoxU"
                            ErrorMessage="*"></asp:RequiredFieldValidator></td>
                </tr>
                <tr>
                    <td style="width: 7px">
                        Password</td>
                    <td>
                        <asp:TextBox ID="TextBoxP" runat="server" TextMode="Password"></asp:TextBox></td>
                    <td>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="TextBoxP"
                            ErrorMessage="*"></asp:RequiredFieldValidator></td>
                </tr>
                <tr>
                    <td style="width: 7px">
                    </td>
                    <td>
                        <asp:Button ID="Button1" runat="server" Text="Login" /></td>
                    <td>
                        <asp:Label ID="LabelErr" runat="server"></asp:Label>
                        <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/Register.aspx" Target="_self">Register</asp:HyperLink></td>
                </tr>
            </table>
       
        </div>
        </form>
    </body>
    </html>

    ————————————————————————————————————————

    Imports System.Data.SqlClient
    Imports System.Data
    Imports System.Data.OleDb
    Partial Class Login
        Inherits System.Web.UI.Page
        Public p As String   ‘保存密码
        Public t As Integer   ‘保存登陆尝试次数
        Public c As String    ‘保存成员资格
        Public Id As Integer

     

        Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
            t += 1
            If t < 5 Then

                Dim ss As String
                ss = System.Configuration.ConfigurationManager.ConnectionStrings("ilaConnectionString").ConnectionString

                Dim conn As New OleDbConnection
                conn.ConnectionString = ss

                Dim cmd As New OleDbCommand
                cmd.CommandText = "SELECT [Password],[Class],[Id] FROM [User] WHERE [Name] =?"
                cmd.Connection = conn
                ‘ Create a OleDbParameter for each parameter in the stored procedure.
                Dim userNameParam As New OleDbParameter("?", TextBoxU.Text)
                cmd.Parameters.Add(userNameParam)
                Dim reader As OleDbDataReader = Nothing

                Try
                    conn.Open()

                    reader = cmd.ExecuteReader
                    reader.Read()

                    If reader.HasRows = False Then
                        reader = Nothing
                    Else

                        p = reader("Password").ToString
                        c = reader("Class").ToString
                        Id = reader("Id")
                    End If

                Catch ex As Exception
                    Throw New Exception(ex.Message)

                Finally
                    If Not (reader Is Nothing) Then
                        reader.Close()
                    End If
                    If Not (conn Is Nothing) Then
                        conn.Close()
                        conn.Dispose()
                        GC.SuppressFinalize(conn)
                    End If
                End Try

                If p = TextBoxP.Text Then
                    Session("User") = TextBoxU.Text
                    Session("C") = c
                    Session("Id") = Id
                    Response.Redirect("Admin/Default.aspx")
                Else
                    LabelErr.Text = "Sorry,login failed!"
                End If
            Else
                LabelErr.Text = "You have failed more than five times."

            End If

        End Sub

        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
           t = 0

        End Sub
    End Class