PDA

View Full Version : user website registration page


bmroczek
05-17-2007, 05:55 PM
Good afternoon,
When hitting the 'Register' button on my asp page i get the following error:
"Cannot find 'file:///C:/CTGR/_forms/%3C%=MM_editAction%%3E'. Make sure the path or Internet address is correct.
Thank you in advance.

Source code (spaces removed to fit):

<%@LANGUAGE="VBSCRIPT"CODEPAGE="1252"%>
<!--#includefile="../Connections/db.asp"-->
<%
'***EditOperations:declarevariables
DimMM_editAction
DimMM_abortEdit
DimMM_editQuery
DimMM_editCmd
DimMM_editConnection
DimMM_editTable
DimMM_editRedirectUrl
DimMM_editColumn
DimMM_recordId
DimMM_fieldsStr
DimMM_columnsStr
DimMM_fields
DimMM_columns
DimMM_typeArray
DimMM_formVal
DimMM_delim
DimMM_altVal
DimMM_emptyVal
DimMM_i
MM_editAction=CStr(Request.ServerVariables("SCRIPT_NAME"))
If(Request.QueryString<>"")Then
MM_editAction=MM_editAction&"?"&Server.HTMLEncode(Request.QueryString)
EndIf
'booleantoabortrecordedit
MM_abortEdit=false
'querystringtoexecute
MM_editQuery=""
%>
<%
'***Redirectifusernameexists
MM_flag="MM_insert"
If(CStr(Request(MM_flag))<>"")Then
MM_dupKeyRedirect="sorry.asp"
MM_rsKeyConnection=MM_db_STRING
MM_dupKeyUsernameValue=CStr(Request.Form("txt_role"))
MM_dupKeySQL="SELECTRole_NumberFROMwebsite_usersWHERERole_Number ='"&Replace(MM_dupKeyUsernameValue,"'","''")&"'"
MM_adodbRecordset="ADODB.Recordset"
setMM_rsKey=Server.CreateObject(MM_adodbRecordset)
MM_rsKey.ActiveConnection=MM_rsKeyConnection
MM_rsKey.Source=MM_dupKeySQL
MM_rsKey.CursorType=0
MM_rsKey.CursorLocation=2
MM_rsKey.LockType=3
MM_rsKey.Open
IfNotMM_rsKey.EOFOrNotMM_rsKey.BOFThen
'theusernamewasfound-cannotaddtherequestedusername
MM_qsChar="?"
If(InStr(1,MM_dupKeyRedirect,"?")>=1)ThenMM_qsChar="&"
MM_dupKeyRedirect=MM_dupKeyRedirect&MM_qsChar&"requsername="&MM_dupKeyUsernameValue
Response.Redirect(MM_dupKeyRedirect)
EndIf
MM_rsKey.Close
EndIf
%>
<%
'***InsertRecord:setvariables
If(CStr(Request("MM_insert"))="fmregistration")Then
Session("MM_UserName")=("txt_role")
Session("MM_PassWord")=("txt_password")
Session("GreetingName")=Request("txt_first_name")&""&Request("txt_last_name")
MM_editConnection=MM_db_STRING
MM_editTable="website_users"
MM_editRedirectUrl="confirm_registration.asp"
MM_fieldsStr="txt_first_name|value|txt_last_name|value|txt_email |value|txt_role|value|txt_password|value|txt_passw ord_reenter|value|txt_dob|value"
MM_columnsStr="First_Name|',none,''|Last_Name|',none,''|Email|',n one,''|Role_Number|none,none,NULL|Password|',none, ''|Password|',none,''|Dob|',none,NULL"
'createtheMM_fieldsandMM_columnsarrays
MM_fields=Split(MM_fieldsStr,"|")
MM_columns=Split(MM_columnsStr,"|")
'settheformvalues
ForMM_i=LBound(MM_fields)ToUBound(MM_fields)Step2
MM_fields(MM_i+1)=CStr(Request.Form(MM_fields(MM_i )))
Next
'appendthequerystringtotheredirectURL
If(MM_editRedirectUrl<>""AndRequest.QueryString<>"")Then
If(InStr(1,MM_editRedirectUrl,"?",vbTextCompare)=0AndRequest.QueryString<>"")Then
MM_editRedirectUrl=MM_editRedirectUrl&"?"&Request.QueryString
Else
MM_editRedirectUrl=MM_editRedirectUrl&"&"&Request.QueryString
EndIf
EndIf
EndIf
%>
<%
'***InsertRecord:constructasqlinsertstatementandex ecuteit
DimMM_tableValues
DimMM_dbValues
If(CStr(Request("MM_insert"))<>"")Then
'createthesqlinsertstatement
MM_tableValues=""
MM_dbValues=""
ForMM_i=LBound(MM_fields)ToUBound(MM_fields)Step2
MM_formVal=MM_fields(MM_i+1)
MM_typeArray=Split(MM_columns(MM_i+1),",")
MM_delim=MM_typeArray(0)
If(MM_delim="none")ThenMM_delim=""
MM_altVal=MM_typeArray(1)
If(MM_altVal="none")ThenMM_altVal=""
MM_emptyVal=MM_typeArray(2)
If(MM_emptyVal="none")ThenMM_emptyVal=""
If(MM_formVal="")Then
MM_formVal=MM_emptyVal
Else
If(MM_altVal<>"")Then
MM_formVal=MM_altVal
ElseIf(MM_delim="'")Then'escapequotes
MM_formVal="'"&Replace(MM_formVal,"'","''")&"'"
Else
MM_formVal=MM_delim+MM_formVal+MM_delim
EndIf
EndIf
If(MM_i<>LBound(MM_fields))Then
MM_tableValues=MM_tableValues&","
MM_dbValues=MM_dbValues&","
EndIf
MM_tableValues=MM_tableValues&MM_columns(MM_i)
MM_dbValues=MM_dbValues&MM_formVal
Next
MM_editQuery="insertinto"&MM_editTable&"("&MM_tableValues&")values("&MM_dbValues&")"
If(NotMM_abortEdit)Then
'executetheinsert
SetMM_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)
EndIf
EndIf
EndIf
%>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=iso-8859-1"/>
<title>UntitledDocument</title>
<linkhref="../_css/base.css"rel="stylesheet"type="text/css"/>
</head>
<tablewidth="900"border="0"align="center"cellpadding="0"cellspacing="0">
<tr>
<tdcolspan="3"class="masthead">&nbsp;</td>
</tr>
<tr>
<tdcolspan="3"class="masthead_bottom">
<!--StartQuickLinks-->
<!--LockedConent-->
<formname="form1">
<divalign="right">
<selectname="select1"size="1"style="background-color:#FFFFFF"onChange="displaydesc(document.form1.select1,thetext1,'textc ontainer1')">
<option>&raquo;QuickLinks</option>
<optionvalue="index.htm">FinancialLearningCenterMain</option>
<optionvalue="level_1/level_1a.htm">Level1</option>
<optionvalue="level_2/level_2a.htm">Level2</option>
<optionvalue="level_3/level_3a.htm">Level3</option>
<optionvalue="level_4/level_4a.htm">Level4</option>
<optionvalue="_contact/contact.asp">Contact</option>
</select>
<inputtype="button"value="Go"onClick="jumptolink(document.form1.select1)">
<spanid="textcontainer1"align="left">
</span>
</div>
</form>
<!--EndQuickLinks-->
</td>
</tr>
<tr>
<tdwidth="134"valign="top"class="nav"><tablewidth="100"border="0"cellspacing="0"cellpadding="3">
<tr>
<tdwidth="18"><ahref="../_contact/contact.htm"></a></td>
<tdwidth="76">&nbsp;</td>
</tr>
</table>
<palign="left">&nbsp;</p></td>
<tdwidth="758"valign="top"class="content"><palign="left"class="h2">FinancialLearningCenteruserregistration</p>
<palign="left"class="content">Inordertoaccessthelearningmodulescontainedonthiswe bsite,youwillneedtocompletetheregistrationbelow.</p>
<formid="fmregistration"name="fmregistration"method="POST"action="<%=MM_editAction%>">
<tablewidth="100%"border="0"cellspacing="0"cellpadding="3">
<tr>
<tdcolspan="2"class="content"><strong><imgsrc="../_images/box.jpg"width="16"height="16"/>OptionalUserInformation</strong></td>
</tr>
<tr>
<tdwidth="18%"class="content">FirstName</td>
<tdwidth="82%"class="content"><label>
<inputname="txt_first_name"type="text"id="txt_first_name"size="25"maxlength="25"/>
</label></td>
</tr>
<tr>
<tdclass="content">LastName</td>
<tdclass="content"><label>
<inputname="txt_last_name"type="text"id="txt_last_name"size="25"maxlength="25"/>
</label></td>
</tr>
<tr>
<tdclass="content">EmailAddress</td>
<tdclass="content"><label>
<inputname="txt_email"type="text"id="txt_email"size="25"maxlength="25"/>
</label></td>
</tr>
<tr>
<tdcolspan="2"class="content"><strong><imgsrc="../_images/box.jpg"width="16"height="16"/>AccessDetails</strong></td>
</tr>
<tr>
<tdclass="content">RoleNumber<strong>*</strong></td>
<tdclass="content"><label>
<inputname="txt_role"type="text"id="txt_role"size="6"maxlength="6"/>
<imgsrc="../_images/help.jpg"alt="help"width="14"height="14"/></label></td>
</tr>
<tr>
<tdclass="content">Password<strong>*</strong></td>
<tdclass="content"><label>
<inputname="txt_password"type="password"id="txt_password"size="25"maxlength="25"/>
</label></td>
</tr>
<tr>
<tdclass="content">Re-EnterPassword<strong>*</strong></td>
<tdclass="content"><label>
<inputname="txt_password_reenter"type="password"id="txt_password_reenter"size="25"maxlength="25"/>
</label></td>
</tr>
<tr>
<tdclass="content">DateofBirth<strong>*</strong></td>
<tdclass="content"><label>
<inputname="txt_dob"type="text"id="txt_dob"size="10"maxlength="10"/>
<em>dd/mm/yyy</em></label></td>
</tr>
<tr>
<tdcolspan="2"class="content"><em>note:*denotesarequiredfield</em></td>
</tr>
<tr>
<tdcolspan="2"class="content">
<label>
<inputname="Reset"type="reset"id="Reset"value="Reset"/>
<inputname="Register"type="submit"id="Register"value="Register"/>
</label></td>
</tr>
</table>
<inputtype="hidden"name="MM_insert"value="fmregistration">
</form>
<palign="left"class="content">&nbsp;</p>
</td>
<tdwidth="8"class="right">&nbsp;</td>
</tr>
<tr>
<tdheight="51"colspan="3"class="bottom"><divalign="center">Copyrightanddisclaimertobeinsertedatalaterdate.</div></td>
</tr>
</table>
</body>
<!--StartQuickLinksJavascript-->
<scripttype="text/javascript">
functiondisplaydesc(which,descriptionarray,contain er){
if(document.getElementById)
document.getElementById(container).innerHTML=descr iptionarray[which.selectedIndex]
}
functionjumptolink(what){
varselectedopt=what.options[what.selectedIndex]
if(document.getElementById&&selectedopt.getAttribute("target")=="newwin")
window.open(selectedopt.value)
else
window.location=selectedopt.value
}
displaydesc(document.form1.select1,thetext1,'textc ontainer1')
</script>
<!--EndQuickLinksJavascript-->
</html>

davidj
05-17-2007, 08:46 PM
your not calling the page through a server

do you have a server setup on your test machine

bmroczek
05-21-2007, 02:23 PM
Thank you!

I got the files uploaded to the testing server and the error went away and was replaced with another.

It looks as though my database path in the UDL file is incorrect since the files are on another machine. I've attempted to change it to the path and it still can't seem to find it. How to I translate this to the path?

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\CTGR\_access\_db\db1.mdb;Persist Security Info=False

davidj
05-21-2007, 02:26 PM
this bit here...

C:\CTGR\_access\_db\db1.mdb

translates to the location of your database and if you have uploaded to your host you may need to give them a call to find out what the path has to be and if there is any special instructions of where the database needs to be uploaded to.

bmroczek
05-21-2007, 03:10 PM
I will certainly do that.

bmroczek
05-21-2007, 03:56 PM
Good morning,

I've gotten the database connection working (i think) and yet another error came up. Once you fill out the form and hit submit the following comes up:

Microsoft JET Database Engine error '80040e14'

Syntax error in INSERT INTO statement.

/_access/registration.asp, line 145

The source code in question (--->):

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

davidj
05-22-2007, 07:59 AM
as im not an ASP coder it may be difficult for the problem to jump out at me

please post the entire script

bmroczek
05-22-2007, 04:54 PM
Thank you for the response.

The entire source is above in the first post.