Wrox Programmer Forums
|
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Dreamweaver (all versions) 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 August 19th, 2005, 07:48 AM
Authorized User
 
Join Date: Aug 2005
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
Default Creating a Login Form problem

Heya all. I have played around with the "Creating a Login Form" for a few days now. Page 306 Dreamweaver Mx 2004.
When I type in the correct username and password. The page takes me directly to a " The page cannot be found" page. ??? Can anyone suggest what to do or look for? I have checked the code and it seems fine. Thanks.

help

 
Old August 19th, 2005, 08:05 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Can you post your code??

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old August 19th, 2005, 08:31 AM
Authorized User
 
Join Date: Aug 2005
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey there, I have included it here. Sorry about the rest of the code.

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html>
<head>
<title>Administration</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--

function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

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_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('images/Productsb.gif','images/Timbersearchb.gif','images/Admybusinessb.gif','images/Publicationb.gif','images/Factsheetsb.gif')">
<table width="100%" height="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#5D5D5D">
<tr>
    <td height="4%" colspan="2">
     <table width="100%" height="100%" border="0" align="left" cellpadding="1" cellspacing="0">
        <tr>
         <td width="50%" valign="middle">
            <div align="center">
             <p align="center"><strong>The
                    timber distributors network</strong></p>
            </div>
         </td>
         <td width="10%" valign="middle" bgcolor="#999999">
            <div align="center"> <a href="newevents.htm"><strong>events</strong></a></div>
         </td>
         <td width="10%" valign="middle" bgcolor="#999999">
            <div align="center"> <a href="newenews.htm"><strong>e-news</strong></a></div>
         </td>
         <td width="10%" valign="middle" bgcolor="#999999">
            <div align="center"> <a href="newforsale.htm"><strong>for
                     sale</strong></a></div>
         </td>
         <td width="10%" valign="middle" bgcolor="#999999">
            <div align="center"> <a href="newjobsearch.htm"><strong>job
                     search</strong></a></div>
         </td>
         <td width="10%" valign="middle" bgcolor="#999999">
            <div align="center"> <a href="newfaq.htm"><strong>faq</strong></a></div>
         </td>
        </tr>
     </table>
     <div align="right"></div>
    </td>
</tr>
<tr valign="bottom">
    <td height="14%" colspan="2" bgcolor="#000000">
     <table width="100%" height="100%" border="0" cellpadding="1" cellspacing="0">
        <tr>
         <td height="60%" valign="bottom">
            <div align="center">
             <h3 align="center"></h3>
            </div>
         </td>
         <td width="40%" rowspan="2"><div align="center"><a href="main.htm"><img src="images/logo.gif" width="270" height="64" border="0" align="middle"></a></div>
         </td>
        </tr>
        <tr>
         <td align="left" valign="bottom"><table width="100%" border="0" cellpadding="2" cellspacing="5" bordercolor="#666666" bgcolor="#464646">
             <tr valign="middle">
                <td width="16%">
                 <div align="center"> <a href="main.htm"><strong>home</strong></a></div>
                </td>
                <td width="16%">
                 <div align="center"> <a href="newsubscribe.htm"><strong>subscribe</strong></a></div>
                </td>
                <td width="22%">
                 <div align="center"> <a href="newadvertise.htm"><strong>ad
                            my business</strong></a></div>
                </td>
                <td width="16%">
                 <div align="center"> <a href="newfeedback.htm"><strong>feedback</strong></a></div>
                </td>
                <td width="16%">
                 <div align="center"> <a href="newlogin.htm"><strong>login</strong></a></div>
                </td>
                <td width="16%">
                 <div align="center"><a href="newcontactus.htm"><strong>contact</strong></a></div>
                </td>
             </tr>
            </table>
         </td>
        </tr>
     </table>
     <div align="left"></div>
    </td>
</tr>
<tr>
    <td colspan="2">
     <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" bordercolor="#5D5D5D">
        <tr>
         <td width="20%" valign="top">
            <table width="100%" height="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#5D5D5D">
             <tr>
                <td height="20%" bgcolor="#CCCC9B">
                 <div align="left"><a href="newproducts.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Products','','images/Productsb.gif',1)"><img src="images/Productsa.gif" alt="Products" name="Products" width="200" height="100" border="0"></a></div>
                </td>
             </tr>
             <tr>
                <td height="20%" bgcolor="#CCCC9B"><a href="newlogin.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Timber Search','','images/Timbersearchb.gif',1)"><img src="images/Timber.gif" alt="Search" name="Timber" width="200" height="100" border="0"></a></td>
             </tr>
             <tr>
                <td height="20%" bgcolor="#CCCC9B"><a href="newadvertise.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Ad My Business','','images/Admybusinessb.gif',1)"><img src="images/Admybusinessa.gif" alt="Ad My Business" name="Ad My Business" width="200" height="100" border="0"></a></td>
             </tr>
             <tr>
                <td height="3%" bgcolor="#666666">&nbsp;</td>
             </tr>
             <tr>
                <td height="17%"><a href="newpublications.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Publications','','image s/Publicationb.gif',1)"><img src="images/Publicationa.gif" alt="Publications" name="Publications" width="200" height="75" border="0"></a></td>
             </tr>
             <tr>
                <td height="17%"><a href="newfactsheets.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Fact Sheets','','images/Factsheetsb.gif',1)"><img src="images/Factsheetsa.gif" alt="Fact Sheets" name="Fact Sheets" width="200" height="75" border="0"></a></td>
             </tr>
            </table>
         </td>
         <td width="80%" align="center" valign="middle">
            <div align="left"></div>
         </td>
        </tr>
     </table>
     <div align="center"></div>
    </td>
</tr>
<tr>
    <td height="4%" colspan="2" valign="middle" bgcolor="#606060">
     <div align="center">
        <p> Copyright &copy; 2004
            - 2005. All Rights Reserved. <a href="newlegal.htm">[u]Privacy
            Policy</u></a> <a href="sitemap.htm">[u]Site
            Map</u></a></p>
     </div>
    </td>
</tr>
</table>
</body>
</html>
 
Old August 19th, 2005, 08:59 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Is this the correct page??

I don't see a form, no <input> controls and no ASP code for validation.....


Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old August 19th, 2005, 09:05 AM
Authorized User
 
Join Date: Aug 2005
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Imar, Im sorry about that. This is the correct one.

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Dim sErrorMessage
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("Admin/admin.asp")
Else
sErrorMessage = "<br>" & _
"Login Failed. Please type a valid username or password"
End if
End if
%>
<html>
<head>
<title>Login Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

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_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

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="css%20files/paragraph.css" rel="stylesheet" type="text/css">
</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('images/Productsb.gif','images/Timber.gif','images/Admybusinessb.gif','images/Publicationb.gif','images/Factsheetsb.gif')">
<table width="100%" height="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#5D5D5D">
<tr>
    <td height="4%" colspan="2">
     <table width="100%" height="100%" border="0" align="left" cellpadding="1" cellspacing="0">
        <tr>
         <td width="50%" valign="middle">
            <div align="center">
             <p align="center"><strong>The
                    timber distributors network</strong></p>
            </div>
         </td>
         <td width="10%" valign="middle" bgcolor="#999999">
            <div align="center"> <a href="newevents.htm"><strong>events</strong></a></div>
         </td>
         <td width="10%" valign="middle" bgcolor="#999999">
            <div align="center"> <a href="newenews.htm"><strong>e-news</strong></a></div>
         </td>
         <td width="10%" valign="middle" bgcolor="#999999">
            <div align="center"> <a href="newforsale.htm"><strong>for
                     sale</strong></a></div>
         </td>
         <td width="10%" valign="middle" bgcolor="#999999">
            <div align="center"> <a href="newjobsearch.htm"><strong>job
                     search</strong></a></div>
         </td>
         <td width="10%" valign="middle" bgcolor="#999999">
            <div align="center"> <a href="newfaq.htm"><strong>faq</strong></a></div>
         </td>
        </tr>
     </table>
     <div align="right"></div>
    </td>
</tr>
<tr valign="bottom">
    <td height="14%" colspan="2" bgcolor="#000000">
     <table width="100%" height="100%" border="0" cellpadding="1" cellspacing="0">
        <tr>
         <td height="60%" valign="bottom">
            <div align="center">
             <h3 align="center"></h3>
            </div>
         </td>
         <td width="40%" rowspan="2"><div align="center"><a href="main.htm"><img src="images/logo.gif" width="270" height="64" border="0" align="middle"></a></div>
         </td>
        </tr>
        <tr>
         <td align="left" valign="bottom"><table width="100%" border="0" cellpadding="2" cellspacing="5" bordercolor="#666666" bgcolor="#464646">
             <tr valign="middle">
                <td width="16%">
                 <div align="center"> <a href="main.htm"><strong>home</strong></a></div>
                </td>
                <td width="16%">
                 <div align="center"> <a href="newsubscribe.htm"><strong>subscribe</strong></a></div>
                </td>
                <td width="22%">
                 <div align="center"> <a href="newadvertise.htm"><strong>ad
                            my business</strong></a></div>
                </td>
                <td width="16%">
                 <div align="center"> <a href="newfeedback.htm"><strong>feedback</strong></a></div>
                </td>
                <td width="16%">
                 <div align="center"> <a href="newlogin.htm"><strong>login</strong></a></div>
                </td>
                <td width="16%">
                 <div align="center"><a href="newcontactus.htm"><strong>contact</strong></a></div>
                </td>
             </tr>
            </table>
         </td>
        </tr>
     </table>
     <div align="left"></div>
    </td>
</tr>
<tr>
    <td colspan="2">
     <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" bordercolor="#5D5D5D">
        <tr>
         <td width="20%" valign="top">
            <table width="100%" height="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#5D5D5D">
             <tr>
                <td height="20%" bgcolor="#CCCC9B">
                 <div align="left"><a href="newproducts.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Products','','images/Productsb.gif',1)"><img src="images/Productsa.gif" alt="Products" name="Products" width="200" height="100" border="0"></a></div>
                </td>
             </tr>
             <tr>
                <td height="20%" bgcolor="#CCCC9B"><a href="newlogin.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Timber Search','','images/Timber.gif',1)"><img src="images/Timber.gif" alt="Timber Search" name="Timber Search" width="200" height="100" border="0"></a></td>
             </tr>
             <tr>
                <td height="20%" bgcolor="#CCCC9B"><a href="newadvertise.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Ad My Business','','images/Admybusinessb.gif',1)"><img src="images/Admybusinessa.gif" alt="Ad My Business" name="Ad My Business" width="200" height="100" border="0"></a></td>
             </tr>
             <tr>
                <td height="3%" bgcolor="#666666">&nbsp;</td>
             </tr>
             <tr>
                <td height="17%"><a href="newpublications.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Publications','','image s/Publicationb.gif',1)"><img src="images/Publicationa.gif" alt="Publications" name="Publications" width="200" height="75" border="0"></a></td>
             </tr>
             <tr>
                <td height="17%"><a href="newfactsheets.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Fact Sheets','','images/Factsheetsb.gif',1)"><img src="images/Factsheetsa.gif" alt="Fact Sheets" name="Fact Sheets" width="200" height="75" border="0"></a></td>
             </tr>
            </table>
         </td>
         <td width="80%" align="center" valign="middle">
         <form action="login.asp" method="post" name="frmLogin" id="frmLogin" onSubmit="MM_validateForm('txtUserName','','R','tx tPassword','','R');return document.MM_returnValue">
         <table width="100%" border="0" cellspacing="0" cellpadding="1" bgcolor="#000000">
            <tr>
             <td>
                <table width="100%" border="0" cellspacing="0" cellpadding="8">
                 <tr>
<td><p>Please type your username and password and
then click the Login button
        <span class="clsErrorMessage"><%= sErrorMessage %></span>
</p></td>
                 </tr>
                 <tr>
                    <td width="100%" bgcolor="#CCCCCC" colspan="2">
                     <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="btnSubmit" value="Login">
                     </p>
                     <input name="txtReferrer" type="hidden" value="<%=sReferrer%>">
                    </td>
                 </tr>
                 <tr>
                    <td bgcolor="#CCCCCC" colspan="2">&nbsp;</td>
                 </tr>
                </table></td>
            </tr>
         </table>
         </form>
            <div align="left"></div>
         </td>
        </tr>
     </table>
     <div align="center"></div>
    </td>
</tr>
<tr>
    <td height="4%" colspan="2" valign="middle" bgcolor="#606060">
     <div align="center">
        <p> Copyright &copy; 2004
            - 2005 All Rights Reserved. <a href="newlegal.htm">[u]Privacy
            Policy</u></a> <a href="sitemap.htm">[u]Site
            Map</u></a></p>
     </div>
    </td>
</tr>
</table>
</body>
</html>
 
Old August 19th, 2005, 09: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

Right, I see.

When login succeeds, the code redirects you to Admin/admin.asp. Does that page exist??


Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old August 19th, 2005, 09:20 AM
Authorized User
 
Join Date: Aug 2005
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Imar, I created a page called admin.asp, but it wont direct to that page. I also tried uploading the "completed admin.asp" page that is on the wrox web site and it still dose not bring that one up... Can figure it out... If it helps the address is http://www.timber.com.au/html/login.asp. Is there anything u can suggest?
 
Old August 19th, 2005, 10:45 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I tried to browse to /html/admin on your site

but got a 404 - file not found error.

This means there is no Admin page, so the redirect to Admin/Admin.asp will fail. Make sure you upload the Admin folder in your Html folder as well.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old August 20th, 2005, 01:06 AM
Authorized User
 
Join Date: Aug 2005
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Imar, thanks for your replies. The admin.asp folder has been uploaded. The url is http://www.timber.com/html/admin.asp

Thanks
 
Old August 20th, 2005, 02:27 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Mal,

The code in the Login page assumes all your admin files are in an Admin folder. That's why it redirects to Admin/Admin.asp

You uploaded the file as Admin.asp not Admin/Admin.asp.

Compare the two URLs:

The one you posted:

http://www.yourdomain.com.au/html/admin.asp

and the one the browser redirects to after you logged in:

http://www.yourdomain.com.au/html/Admin/admin.asp

See the problem? You need to create an Admin folder on your server and put all admin related files in that folder.
Alternatively, modify the Login page to redirect to just Admin.asp. Not recommended, as you'll end up with loads of files in the root of your site....

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Ch.14 Creating Windows Form User Controls problem SAIFI BOOK: Beginning Microsoft Visual Basic 2008 ISBN: 978-0-470-19134-7 1 September 29th, 2008 05:51 AM
Creating login form with access database Belzebu Visual Basic 2005 Basics 0 November 8th, 2007 11:33 AM
Problem with creating Multiple instances of Form i vb_programmer Pro VB 6 1 June 29th, 2006 10:29 PM
Creating a database login Apocolypse2005 PHP Databases 3 January 6th, 2006 01:59 PM
Creating Login code Matthew Access VBA 2 November 24th, 2005 04:32 AM





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