|
Subject:
|
Beginning Dreamweaver MX Ch10 p364
|
|
Posted By:
|
craigrobertson
|
Post Date:
|
11/14/2004 3:28:33 PM
|
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><!-- InstanceBegin template="/Templates/mainTemplate.dwt.asp" codeOutsideHTMLIsLocked="false" --> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <!-- InstanceBeginEditable name="doctitle" --> <title>Login to GlobalSoccerEvents.com - Your Source for Soccer Events Around the Globe</title> <!-- InstanceEndEditable --><!-- InstanceBeginEditable name="head" --> <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_validateForm.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> <!-- InstanceEndEditable -->
<link href="Styles/mainStyles.css" rel="stylesheet" type="text/css"> </head>
<body><!-- #BeginLibraryItem "/Library/mainMenu.lbi" --><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> </td> <td><a href="events.asp" id="events">Events</a></td> <td> </td> <td><a href="mysite.asp" id="mysite">My Site</a></td> <td> </td> <td><a href="login.asp" id="login">Login</a></td> <td> </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.fontWeight = 'Bold'; document.getElementById(sPageName).style.fontSize = '14pt'; } </script><!-- #EndLibraryItem --><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><!-- InstanceBeginEditable name="Title" --> <h2>Login to GlobalSoccerEvents.com </h2> <!-- InstanceEndEditable --></td> </tr> <tr> <td><!-- InstanceBeginEditable name="Content" --> <table width="100%" border="0" cellspacing="0" cellpadding="1" bgcolor="#000000"> <tr> <td><table width="100%" border="0" cellspacing="0" cellpadding="8"> <tr> <td><font color="#CCCCCC">Please type your Username and Password, then click the Login button <%= sErrorMessage %></font></td> </tr> <tr> <td width="100%" bgcolor="#CCCCCC" colspan="2"> <form action="login.asp" method="post" name="frmLogin" onSubmit="MM_validateForm('txtUserName','','R','txtPassword','','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> <!-- InstanceEndEditable --></td> </tr> <tr> <td align="center"><br> <br> <br> <br> <br> <!-- InstanceBeginEditable name="Footer" --><!-- InstanceEndEditable --></td> </tr> </table> </body> <!-- InstanceEnd --></html>
|
|
Reply By:
|
Imar
|
Reply Date:
|
11/14/2004 4:41:26 PM
|
Hi Craig,
It was hard to spot, at first, but you missed a closing )
Your code should read:If arrTemp(0) = Request.Form("txtUserName") And _
arrTemp(1) = Request.Form("txtPassword") ThenHaving any fun with the book??
Cheers,
Imar --------------------------------------- Imar Spaanjaars Everyone is unique, except for me.
|
|
Reply By:
|
craigrobertson
|
Reply Date:
|
11/14/2004 5:29:13 PM
|
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.
|
|
Reply By:
|
Imar
|
Reply Date:
|
11/15/2004 2:09:53 AM
|
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
|
|