Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 31st, 2004, 03:29 AM
Authorized User
 
Join Date: Sep 2003
Location: Dubai, Dubai, United Arab Emirates.
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Default Using the Referrer - Beginning DW- MX - Page 357

Hi Imar!

Just when I thought everything is going all right, I have faced another problem.

In Using The Referrer (page 357) after I made the changes to login.asp, the page has stopped functioning properly.

As instructed on page 359, when I go to the popularFirstPage I am directed to login.asp as expected. There I give wrong user name and password and I am again correctly taken to the login page with the red error message. Fine up to now.

Now when I give *correct* user name and password – I get “HTTP 404 - File not found” error message.

After adding the code, even if I go directly to login page, and give correct user name and password – I still get the file not found message.

When I removed the extra code from this ‘try it out’ section, everything started working properly again. But as soon as I make the changes it stops working.

Could it be ME + PWS again?

Shubhada.


  #2 (permalink)  
Old March 31st, 2004, 03:59 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Can you post the code for the Login page?

I doubt this has something to do with PWS, but since our last problem, I am not too sure of that anymore.... ;)


Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
  #3 (permalink)  
Old March 31st, 2004, 04:05 AM
Authorized User
 
Join Date: Sep 2003
Location: Dubai, Dubai, United Arab Emirates.
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Here is the code for login.asp:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
    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
        If Request.Form("txtUserName") = "UserName" And _
            Request.Form("txtPassword") = "Password" 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>

<title>Login to GlobalSoccerEvents.com</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<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">
                  sReferrer = <%= sReferrer %>
         <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:150 px">
                    </p>
                    <p>Password<br>
                      <input name="txtPassword" type="password" class="clsTextInput" id="txtPassword" style="width:150 px">
                    </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>


----- Shubhada.



  #4 (permalink)  
Old March 31st, 2004, 04:10 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Right. See this:
Code:
If Request.Form("txtUserName") = "UserName" And _
    Request.Form("txtPassword") = "Password" 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
You are redirecting to the string "sReferrer", not to the value of the variable sReferrer. Change it to this:

Response.Redirect(sReferrer)

Is this in the book, or did you make a type?

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
  #5 (permalink)  
Old March 31st, 2004, 04:31 AM
Authorized User
 
Join Date: Sep 2003
Location: Dubai, Dubai, United Arab Emirates.
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Default

No...!!!!!! The quote marks are not in the book - I made a very silly typo!!!

Now everything is working fine!

Thanks.

Shubhada.


  #6 (permalink)  
Old March 31st, 2004, 04:53 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Ha, great.

I am trying to reproduce your initial problem on PWS under Windows ME in a Virtual PC, but it's not working yet.... Glad this problem had nothing to do with PWS......

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
  #7 (permalink)  
Old March 31st, 2004, 05:00 AM
Authorized User
 
Join Date: Sep 2003
Location: Dubai, Dubai, United Arab Emirates.
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I had a lot of problems even installing PWS on ME - as PWS is not supposed to be for ME. But After using a patch by Microsoft I could at least install it properly. But it seems there are many issues with ME+PWS apart from installation. I might have to face them as I progress through your book.

yeah..glad this problem had nothing to do with PWS......

Shubhada.



  #8 (permalink)  
Old March 31st, 2004, 05:07 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Yeah, it's quite a messy installation procedure, isn't it? Using an install package not really meant for PWS, installing fixes, installing just parts of the package etc etc, all that just to end up with a Web server not capable of running Web sites really well. Then again, it may work well for learning and development purposes....

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
  #9 (permalink)  
Old March 31st, 2004, 08:13 AM
Authorized User
 
Join Date: Sep 2003
Location: Dubai, Dubai, United Arab Emirates.
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Actually once before I had installed it without the Microsoft patch and in one part. During installation it showed a message "MTS not installed" and after installation it said "Installation not complete". Still it worked to a large extent. For basic educational purpose even that half-installation' was ok! But may be I didn't require Transaction Server then..

Shubhada.

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Beginning DW.MX 2004 Global Soccer terry s Dreamweaver (all versions) 6 October 13th, 2004 02:40 PM



All times are GMT -4. The time now is 01:20 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.