Results 1 to 4 of 4

Thread: Need help with validation

  1. #1
    Join Date
    Nov 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Need help with validation

    hi, i hope u guys cld help me out. i have done this login page and i need to do some validation. but i added some/code some but none seems to work.. anyone willing to help me? i need the validation on my registration page as well. i'm making a cinema website for my project actually, and i wld like to knoe how to make the seatings? pls help asap..! thx

    Here's my login page code:


    <%@LANGUAGE="VBSCRIPT"%>
    <!--#include file="Connections/connnew.asp" -->
    <%
    ' *** Validate request to log in to this site.
    MM_LoginAction = Request.ServerVariables("URL")
    If Request.QueryString<>"" Then MM_LoginAction = MM_LoginAction + "?" + Server.HTMLEncode(Request.QueryString)
    MM_valUsername=CStr(Request.Form("txtusername"))
    If MM_valUsername <> "" Then
    MM_fldUserAuthorization=""
    MM_redirectLoginSuccess="showing.asp"
    MM_redirectLoginFailed="loginfail.asp"
    MM_flag="ADODB.Recordset"
    set MM_rsUser = Server.CreateObject(MM_flag)
    MM_rsUser.ActiveConnection = MM_connnew_STRING
    MM_rsUser.Source = "SELECT Username, Password"
    If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization
    MM_rsUser.Source = MM_rsUser.Source & " FROM register WHERE Username='" & Replace(MM_valUsername,"'","''") &"' AND Password='" & Replace(Request.Form("txtpassword"),"'","''") & "'"
    MM_rsUser.CursorType = 0
    MM_rsUser.CursorLocation = 2
    MM_rsUser.LockType = 3
    MM_rsUser.Open
    If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then
    ' username and password match - this is a valid user
    Session("MM_Username") = MM_valUsername
    If (MM_fldUserAuthorization <> "") Then
    Session("MM_UserAuthorization") = CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization).Value)
    Else
    Session("MM_UserAuthorization") = ""
    End If
    if CStr(Request.QueryString("accessdenied")) <> "" And false Then
    MM_redirectLoginSuccess = Request.QueryString("accessdenied")
    End If
    MM_rsUser.Close
    Response.Redirect(MM_redirectLoginSuccess)
    End If
    MM_rsUser.Close
    Response.Redirect(MM_redirectLoginFailed)
    End If
    %>
    <HTML>
    <HEAD>
    <TITLE>: xEnO :</TITLE>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
    <link rel="stylesheet" href="style.css" type="text/css">
    <BASE TARGET="_self">
    <style type="text/css">
    <!--
    body {
    background-image: url(images/login.gif);
    background-repeat: no-repeat;
    }
    #Layer2 {
    position:absolute;
    width:53px;
    height:37px;
    z-index:1;
    left: 362px;
    top: 81px;
    }
    #Layer1 {
    position:absolute;
    width:164px;
    height:112px;
    z-index:2;
    left: 315px;
    top: 31px;
    }
    #Layer3 {
    position:absolute;
    width:162px;
    height:105px;
    z-index:2;
    left: 321px;
    top: 51px;
    }
    #Layer4 {
    position:absolute;
    width:353px;
    height:47px;
    z-index:2;
    left: 228px;
    top: 173px;
    }
    #Layer5 {
    position:absolute;
    width:94px;
    height:19px;
    z-index:3;
    left: 384px;
    top: 82px;
    }
    #Layer6 {
    position:absolute;
    width:94px;
    height:19px;
    z-index:1;
    left: -117px;
    top: -46px;
    }
    #Layer7 {
    position:absolute;
    width:96px;
    height:20px;
    z-index:4;
    left: 384px;
    top: 107px;
    }
    #Layer8 {
    position:absolute;
    width:50px;
    height:23px;
    z-index:5;
    left: 384px;
    top: 126px;
    }
    -->
    </style></HEAD>
    <BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
    <form ACTION="<%=MM_LoginAction%>" name="frmLogin" method="POST">
    <div id="Layer8">
    <input name="btnLogin" type="submit" value="Login" target="_self">
    </div>

    <div id="Layer5">
    <input name="txtusername" type="text" size="19" maxlength="20" height="12" class="style3">
    </div>

    <div id="Layer7">
    <input name="txtpassword" type="password" size="19" maxlength="20" height="12" class="style3">
    </div>

    <div id="Layer4">
    <p align="center">Please login using your given Username &amp; Password.</p>
    <p align="center">If you do not have a username, please click <strong><a href="register.asp" target="MainFrame" class="style1">here</a></strong> to register.</p>
    </div>
    </form>
    </BODY>
    </HTML>

  2. #2
    Join Date
    Nov 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    and here's the register page:


    <%@LANGUAGE="VBSCRIPT"%>
    <!--#include file="Connections/connnew.asp" -->
    <%
    ' *** Edit Operations: declare variables

    Dim MM_editAction
    Dim MM_abortEdit
    Dim MM_editQuery
    Dim MM_editCmd

    Dim MM_editConnection
    Dim MM_editTable
    Dim MM_editRedirectUrl
    Dim MM_editColumn
    Dim MM_recordId

    Dim MM_fieldsStr
    Dim MM_columnsStr
    Dim MM_fields
    Dim MM_columns
    Dim MM_typeArray
    Dim MM_formVal
    Dim MM_delim
    Dim MM_altVal
    Dim MM_emptyVal
    Dim MM_i

    MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
    If (Request.QueryString <> "") Then
    MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
    End If

    ' boolean to abort record edit
    MM_abortEdit = false

    ' query string to execute
    MM_editQuery = ""
    %>
    <%
    ' *** Insert Record: set variables

    If (CStr(Request("MM_insert")) = "frmRegister") Then

    MM_editConnection = MM_connnew_STRING
    MM_editTable = "register"
    MM_editRedirectUrl = "login.asp"
    MM_fieldsStr = "username|value|password|value|email|value"
    MM_columnsStr = "Username|',none,''|Password|',none,''|Email|',none,''"

    ' create the MM_fields and MM_columns arrays
    MM_fields = Split(MM_fieldsStr, "|")
    MM_columns = Split(MM_columnsStr, "|")

    ' set the form values
    For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
    Next

    ' append the query string to the redirect URL
    If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
    If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
    MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
    Else
    MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
    End If
    End If

    End If
    %>
    <%
    ' *** Insert Record: construct a sql insert statement and execute it

    Dim MM_tableValues
    Dim MM_dbValues

    If (CStr(Request("MM_insert")) <> "") Then

    ' create the sql insert statement
    MM_tableValues = ""
    MM_dbValues = ""
    For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_formVal = MM_fields(MM_i+1)
    MM_typeArray = Split(MM_columns(MM_i+1),",")
    MM_delim = MM_typeArray(0)
    If (MM_delim = "none") Then MM_delim = ""
    MM_altVal = MM_typeArray(1)
    If (MM_altVal = "none") Then MM_altVal = ""
    MM_emptyVal = MM_typeArray(2)
    If (MM_emptyVal = "none") Then MM_emptyVal = ""
    If (MM_formVal = "") Then
    MM_formVal = MM_emptyVal
    Else
    If (MM_altVal <> "") Then
    MM_formVal = MM_altVal
    ElseIf (MM_delim = "'") Then ' escape quotes
    MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
    Else
    MM_formVal = MM_delim + MM_formVal + MM_delim
    End If
    End If
    If (MM_i <> LBound(MM_fields)) Then
    MM_tableValues = MM_tableValues & ","
    MM_dbValues = MM_dbValues & ","
    End If
    MM_tableValues = MM_tableValues & MM_columns(MM_i)
    MM_dbValues = MM_dbValues & MM_formVal
    Next
    MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"

    If (Not MM_abortEdit) Then
    ' execute the insert
    Set MM_editCmd = Server.CreateObject("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_editConnection
    MM_editCmd.CommandText = MM_editQuery
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    If (MM_editRedirectUrl <> "") Then
    Response.Redirect(MM_editRedirectUrl)
    End If
    End If

    End If
    %>
    <HTML>
    <HEAD>
    <TITLE>: xEnO :</TITLE>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
    <link rel="stylesheet" href="style2.css" type="text/css">
    <BASE TARGET="_self">
    <style type="text/css">
    <!--
    .style1 {
    color: #FFFFFF;
    font-size: 14pt;
    }
    .style2 {
    color: #FFFFFF;
    font-size: 10pt;
    }
    .style3 {color: #FFFFFF}
    -->
    </style>
    <script language="JavaScript" type="text/JavaScript">
    <!--
    function MM_reloadPage(init) { //reloads the window if Nav4 resized
    if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
    else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
    }
    MM_reloadPage(true);
    //-->
    </script>
    </HEAD>
    <BODY>
    <form ACTION="<%=MM_editAction%>" METHOD="POST" name="frmRegister">
    <table width="298" height="94" border="0" align="center">
    <tr>
    <td height="44"><div align="center"></div> <div align="center"><img src="images/register.gif" width="158" height="18"></div></td>
    </tr>
    <tr>
    <td height="44"><div class="smallfont" style="MARGIN-BOTTOM: 3px"><font color="#FFFFFF"><strong>User Name</strong>:<br>
    <input name="username" type="text">
    </font> </div>
    <fieldset class="fieldset">
    <legend style="color: #22229C; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; font-family: tahoma, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif"> <font color="#FFFFFF">Password</font></legend>
    <table cellSpacing="3" cellPadding="0" width="400" border="0">
    <tr>
    <td colSpan="2" style="font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; font-family: verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif"> <font color="#FFFFFF">Please enter a password for your user account. Note that passwords are case-sensitive.</font></td>
    </tr>
    <tr>
    <td style="font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; font-family: verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif"> <font color="#FFFFFF">Password:
    <input name="password" type="password">
    <br>
    </font></td>
    <td style="font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; font-family: verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif"> <font color="#FFFFFF">Confirm Password:<br>
    <input name="cpassword" type="password">
    </font></td>
    </tr>
    </table>
    </fieldset>
    <font color="#FFFFFF">&nbsp; </font>
    <fieldset class="fieldset">
    <legend style="color: #22229C; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; font-family: tahoma, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif"> <font color="#FFFFFF">Email Address</font></legend>
    <table width="400" height="63" border="0" cellPadding="0" cellSpacing="3">
    <tr>
    <td height="22" style="font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; font-family: verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif"> <font color="#FFFFFF">Please enter a valid email address. </font></td>
    </tr>
    <tr>
    <td height="32" style="font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; font-family: verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif"> <font color="#FFFFFF">Email Address:<br>
    <input name="email" type="text">
    </font></td>
    </tr>
    </table>
    </fieldset></td>
    </tr>
    </table>


    <div class="smallfont" style="MARGIN-BOTTOM: 3px"> </div>
    <div id="Layer1" style="position:absolute; width:70px; height:27px; z-index:1; left: 302px; top: 281px;">
    <input name="Register" type="submit" value="Register" target="MainFrame">
    </div>

    <input type="hidden" name="MM_insert" value="frmRegister">
    </p>
    </form>
    </BODY>
    </HTML>

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Just a heads-up, but not many regulars here know ASP (jscheuer1 began learning, but I don't know how far he got). It's probably worth posting on a few other boards in case you don't get a reply.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Nov 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Twey
    Just a heads-up, but not many regulars here know ASP (jscheuer1 began learning, but I don't know how far he got). It's probably worth posting on a few other boards in case you don't get a reply.
    any idea where shld i post? i'm sorri i'm a newbie

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •