Wrox Programmer Forums
|
BOOK: Beginning Dreamweaver MX/MX 2004 MX ISBN: 978-0-7645-4404-0; MX 2004 ISBN: 978-0-7645-5524-4
This is the forum to discuss the Wrox book Beginning Dreamweaver MX by Charles E. Brown, Imar Spaanjaars, Todd Marks; ISBN: 9780764544040
Please indicate which version of the book you are using when posting questions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Dreamweaver MX/MX 2004 MX ISBN: 978-0-7645-4404-0; MX 2004 ISBN: 978-0-7645-5524-4 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 14th, 2004, 04:28 PM
Registered User
 
Join Date: Nov 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Beginning Dreamweaver MX Ch10 p364

After inserting the code on pages 364 and 365 when i run the page i get the error


HTTP 500.100 - Internal Server Error - ASP error
Internet Information Services

--------------------------------------------------------------------------------

Technical Information (for support personnel)

Error Type:
Microsoft VBScript compilation (0x800A03EE)
Expected ')'
/thesoccersite/backuplogin.asp, line 54, column 41
arrTemp(1) = Request.Form("txtPassword") Then
----------------------------------------^


Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)

Page:
GET /thesoccersite/backuplogin.asp


I have checked my file against the book and the reference file in the zip from this site, but i cannot see my error. Also when i try putting the reference file from the zip in place of my file it gives the error



HTTP 500.100 - Internal Server Error - ASP error
Internet Information Services

--------------------------------------------------------------------------------

Technical Information (for support personnel)

Error Type:
Microsoft VBScript compilation (0x800A0409)
Unterminated string constant
/thesoccersite/login.asp, line 71, column 56
"Login failed. Please type a valid username and password
-------------------------------------------------------^


Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)

Page:
GET /thesoccersite/login.asp


As neither file works i'm beginning to wonder if this could possibly be a problem with my setup, not the code. I have MX2004, XP Pro with ISS, and norton internet security 2004. If anyone can see my error and help me along i would be grateful. My code creating the error looks like this


<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
    Dim sErrorMessage

    Dim sReferrer
    If Request.Form("txtReferrer") = "" Then
      sReferrer = Request.QueryString("(accessdenied")
    Else
      sReferrer = Request.Form("txtReferrer")
    End If
    If sReferrer = "" Then
      sReferrer = "admin/admin.asp"
    End If

    If Request.Form("txtUserName") <> "" And _
                Request.Form("txtPassword") <> "" Then

        Const ForReading = 1
        Dim oFileSystemObject
        Dim oTextStream
        Dim sFileLocation
        Dim sTempString
        Dim arrTemp
        Dim bUserFound
        sFileLocation = Server.MapPath("tools/users.txt")

        ' Create an instance of the FileSystemObject
        Set oFileSystemObject = Server.CreateObject("Scripting.FileSystemObject")

        ' Create a reference to our text file so we can read from it
        Set oTextStream = oFileSystemObject.OpenTextFile(sFileLocation, ForReading)

        ' Read in each line until we reach the end of the file
        Do While (Not oTextStream.AtEndOfStream = True)
          ' Read a line
          sTempString = oTextStream.ReadLine()

          ' If the line contains text
          If Len(sTempString) > 0 Then
            ' The line should hold the username and password, seperated by a tab
            ' Split the line based on a taba, so we get the username and password
            ' in two seperate array elements
            arrTemp = Split(sTempString, vbTab)

            If IsArray(arrTemp) Then
              ' An Ubound of 1 means two elements in the array, the username
              ' and the password. If we haven't found both, we do not continue

              If Ubound(arrTemp) = 1 Then
                ' Compare array elements with username and password

                If arrTemp(0) = Request.Form("txtUserName" And _
                                arrTemp(1) = Request.Form("txtPassword") Then
                  bUserFound = True
                  Exit Do
                End If
              End If
            End If
          End If
        Loop

        ' Close our textstream and clean up our objects
        oTextStream.Close
        set oTextStream = Nothing
        Set oFileSystemObject = Nothing

        If bUserFound = True Then
          Session("MM_Username") = Request.Form("txtUserName")
          Response.Redirect(sReferrer)
          Else
            sErrorMessage = "<span class=""clsErrorMessage""><br>" & _
                    "Login failed. Please type a valid username and password</span>"
            End If
    End If
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<title>Login to GlobalSoccerEvents.com - Your Source for Soccer Events Around the Globe</title>

<script language="JavaScript" type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
  var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_valida teForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}
//-->
</script>


<link href="Styles/mainStyles.css" rel="stylesheet" type="text/css">
</head>

<body><table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><img src="Images/logo.gif"></td>
    <td><table border="0" align="right" cellpadding="0" cellspacing="0">
  <tr>
    <td><a href="home.asp" id="home">Home</a></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><a href="events.asp" id="events">Events</a></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><a href="mysite.asp" id="mysite">My Site</a></td>
     <td>&nbsp;&nbsp;&nbsp;</td>
    <td><a href="login.asp" id="login">Login</a></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
  </tr>
</table>
</td>
  </tr>
</table>

<br>

 <script language="javascript" type="text/javascript">
    var sPageName = '<%=Request.ServerVariables("SCRIPT_NAME")%>';
    sPageName = sPageName.substr(sPageName.lastIndexOf('/') + 1).toLowerCase();

    sPageName = sPageName.substr(0, sPageName.lastIndexOf('.'));
    if (document.getElementById(sPageName))
    {
        document.getElementById(sPageName).style.fontWeigh t = 'Bold';
        document.getElementById(sPageName).style.fontSize = '14pt';
    }
</script><table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>
      <h2>Login to GlobalSoccerEvents.com </h2>
    </td>
  </tr>
  <tr>
    <td>
      <table width="100%" border="0" cellspacing="0" cellpadding="1" bgcolor="#000000">
        <tr>
          <td><table width="100%" border="0" cellspacing="0" cellpadding="8">
              <tr>
                <td>Please type your Username and Password, then click the Login button
                <%= sErrorMessage %></td>
              </tr>
              <tr>
                <td width="100%" bgcolor="#CCCCCC" colspan="2">
                  <form action="login.asp" method="post" name="frmLogin" onSubmit="MM_validateForm('txtUserName','','R','tx tPassword','','R');return document.MM_returnValue">
                  <p>Username<br>
                          <input name="txtUserName" type="text" class="clsTextInput" id="txtUserName" style="width:150px;">
                    </p>
                      <p>Password<br>
                          <input name="txtPassword" type="password" class="clsTextInput" id="txtPassword" style="width:150px;">
                      </p>
                      <p>
                        <input name="BtnLogin" type="submit" id="BtnLogin" value="Login">
                    </p>
                  <input name="txtReferrer" type="hidden" value="<%=sReferrer%>"></form>
                </td>

              </tr>
          </table></td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td align="center"><br>
    <br>
    <br>
    <br>
    <br>
    </td>
  </tr>
</table>
</body>
</html>


 
Old November 14th, 2004, 05:41 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Craig,

It was hard to spot, at first, but you missed a closing )

Your code should read:
Code:
If arrTemp(0) = Request.Form("txtUserName") And _
            arrTemp(1) = Request.Form("txtPassword") Then
            Having any fun with the book??

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old November 14th, 2004, 06:29 PM
Registered User
 
Join Date: Nov 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

THank you very much Imar

As always it WAS just a simple code error. That's the only problem i've ever had so far; my own bad typing! Everything is working fine again.

I've found this book very useful. I am a complete beginner but this book has been very useful to me and makes a lot of sense! Web design is something i've always been interested in as an outsider but now i'm finally getting into it i'm really enjoying it. I am doing a college project where my group is creating a website which will have a database of audio engineering related courses and jobs in the UK, as well as the ability to post and view CVs. Though we may never have a fully functioning website with everything we planned this books is helping me get a lot closer than i would have on my own. Once again thank you very much for your help.

 
Old November 15th, 2004, 03:09 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Glad it's working again. Darn typos..... ;)

Your site sounds like a great plan to me. If you need any help, you know where to find us....

Cheers,

Imar





Similar Threads
Thread Thread Starter Forum Replies Last Post
Beginning Dreamweaver MX 2004? stephman Dreamweaver (all versions) 6 January 22nd, 2004 05:03 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.