Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Web form help

  • 17-10-2007 1:11pm
    #1
    Registered Users, Registered Users 2 Posts: 3,061 ✭✭✭


    Hey all,

    I'm trying to amend a web form for a client... the code was written by the first web designer.

    It did work...

    The client asked me to change the mailto email to another, so I opened the form in Dreamweaver and changed the mailto to the new one and uplaoded it - But now I'm getting this message when I try to send a test mail online:

    Microsoft VBScript runtime error '800a0009'

    Subscript out of range: '[number: 2]'

    /cgi-bin/formmail.asp, line 96


    I've marked line 96 for you...
    I'm probably missing something small...!

    Here's the actual old site with my amended email - info@summerhillspares.ie
    http://www.summerhillspares.ie/

    HERES THE CODE:





    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
    <html>
    <head>
    <title>Summerhill Auto Recycling, used car parts, end of life</title>


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

    <body bgcolor="#ffffff">

    <a href="http://www.summerhillspares.ie/requestprocessed.htm"><img src="images/SummerhillSparesTopofpage.jpg" alt="" border="0" style="width: 762px; height: 396px;"></a>

    <form ACTION="cgi-bin/formmail.asp" method="get" name="form1">
    <input name="recipient" value="info@summerhillspares.ie" type="hidden">
    <input type="hidden" name="redirect" value="http://www.summerhillspares.ie/requestprocessed.htm"&gt;
    <input name="subject" type="hidden" id="subject" value="spare parts request">

    <table width="760" border="1" cellpadding="1" cellspacing="1" bgcolor="#006600">

    <tbody>
    <tr bgcolor="006600">


    <td width="171"><font color="CCCCCC" face="Arial, Helvetica, sans-serif" size="3">
    Your Name</font></td>

    <td width="576"><font color="006600" face="Arial, Helvetica, sans-serif" size="2">
    <input name="CustomerName" id="CustomerName" type="text">
    </font></td>

    </tr>

    <tr bgcolor="006600">


    <td><font color="CCCCCC" face="Arial, Helvetica, sans-serif" size="3">Phone
    Number </font></td>

    <td><font color="CCCCCC" face="Arial, Helvetica, sans-serif" size="2">
    <input name="PhoneNumber" id="PhoneNumber2" type="text">

    </font></td>

    </tr>


    <tr>
    <td bgcolor="006600"><font color="CCCCCC" face="Arial, Helvetica, sans-serif" size="3">email
    address </font></td>


    <td bgcolor="006600"><font color="CCCCCC" face="Arial, Helvetica, sans-serif" size="3">
    <input name="EmailAddress" id="EmailAddress2" type="text">
    </font></td>

    </tr>

    <tr>
    <td bgcolor="006600"><font color="CCCCCC" face="Arial, Helvetica, sans-serif" size="3">Make
    of Vehicle/Car</font></td>


    <td bgcolor="006600"><font color="CCCCCC" face="Arial, Helvetica, sans-serif" size="2">
    <input name="CarMake" id="CarMake2" type="text">
    </font></td>

    </tr>

    <tr bgcolor="006600">


    <td><font color="CCCCCC" face="Arial, Helvetica, sans-serif" size="3">Model,
    eg. 1.6, 5 door</font></td>

    <td><font color="CCCCCC" face="Arial, Helvetica, sans-serif" size="3">
    <input name="ModelofCar" id="CarMake2" type="text">
    </font></td>

    </tr>

    <tr>



    <td bgcolor="006600"><font color="CCCCCC" face="Arial, Helvetica, sans-serif" size="3">Year
    of Vehicle</font></td>


    <td bgcolor="006600"><font color="CCCCCC" face="Arial, Helvetica, sans-serif" size="3">
    <input name="YearofCar" id="YearofCar2" type="text">
    </font></td>

    </tr>

    <tr>


    <td bgcolor="006600"><font color="CCCCCC" face="Arial, Helvetica, sans-serif" size="3">Extra
    information, if you require a specific part or number of parts enter here</font></td>


    <td bgcolor="006600"><font color="CCCCCC" face="Arial, Helvetica, sans-serif" size="2"> 

    </font><textarea name="PartsRequired" cols="70" id="PartsRequired"></textarea>
    </td>

    </tr>
    <tr>


    <td bgcolor="006600"></td>


    <td bgcolor="006600"><font color="CCCCCC" face="Arial, Helvetica, sans-serif" size="2"> 

    </font><input type="submit" value="SEND">


    </td>

    THIS IS LINE 96 > </tr>



    </tbody>
    </table>

    </form>

    <img style="width: 762px; height: 54px;" alt="" src="images/SummerhillSpares.gif">
    <p> </p>

    <p></p>


    </body>
    </html>


    Thanks in advance...


«1

Comments

  • Registered Users, Registered Users 2 Posts: 21,263 ✭✭✭✭Eoin


    Are you just copying in the source from your browser? That won't be any good as the code that is causing the problem is executed on the server before it is sent to the browser, so line 96 on our browser won't be the line 96 in the ASP page.


  • Registered Users, Registered Users 2 Posts: 3,061 ✭✭✭sticker


    Sorry!

    I'm used to just creating forms in Dreamweaver - not that familiar with ASP code

    What do I do to remedy the problem?

    Heres the ASP code anyway:





    <%@ Language = vbscript%>
    <%option explicit %>
    <%server.scripttimeout = 600 %>
    <%
    '
    FORMMAIL V1.3

    '
    'copyright information
    '
    'Copyright 2002: Sorted Sites http://www.sortedsites.com
    'Authors Jonas Tornqvist, David Parkes and Karl Snares
    'This script is Freeware, which means you are free to use and modify
    'the script for your own use.
    'The only condition is this copyright header remain intact and you don't
    'try and sell this script for profit without first asking us.
    'And of course also ask Matt Wright who wrote the original perl version of Formmail.

    '
    'license agreement - Important
    '
    'By using this script you agree to indeminfy the developers - Sorted Sites of any loss
    'or damages that may arise from its use or missue.
    'This script is provided as is with all faults - no warranties and no guarantees.
    'basically its free - use it at your own risk and cost.
    'No warranties and no tech support - if you need help with this don't ask us!
    'The documentation is provided as is with all the help we can offer.
    'As we develop this script we shall post updates hopefully fix any bugs
    'We are not obliged to release any future versions and we might not bother...
    'By using this script you accept this license agreement!

    '
    'documentation v1.3
    '

    '####################################################################################################
    'this is where the code starts for real
    '####################################################################################################

    '
    'declare variables
    '
    Dim strFrom, strTo, strSubject, strBody
    Dim objMessage, objConfig, strServer, intPort
    Dim recipient, redirect, subject, realname, email, required, strEmail1, strEmail2
    Dim referer, url, url_verified, icounter, query, iloop, query2, query3, i, agree, validation, error0, error0ok

    '############################## CONFIGURATION VARIABLES ####################################

    'These are the only lines you will need to change
    '
    strServer = "mail.summerhillspares.ie" 'set which smtp server will be used to send the email. enter ip address or domain name. eg: "xxx.xxx.xxx.xxx" or "smtp.your-domain.com"
    intPort = 25 'set the smtp port to be used when sending mail (by default port 25 is used)
    'Referrer's Array is defined here. Enter the valid domains which may use this script.
    url = Array("www.summerhillspares.ie","summerhillspares.ie","www.hotmail.com","hotmail.com")'Set which urls that will be accepted. http://xxxxx/
    'Seperate multiple domains by commas
    'eg: url= Array("www.your-domain.com","your-domain.com","www.my-domain.com")
    'computer names can be used instead of domains if this script is being run locally
    'eg: url = Array("computername")

    '######################################### IMPORTANT NOTICE #########################################
    'IMPORTANT: do not modify anything below this line unless you know what you are doing!!
    '######################################### IMPORTANT NOTICE #########################################

    '
    'information type and CDOSYS constants
    '
    %>
    <!--METADATA TYPE="typelib"
    UUID="CD000000-8B95-11D1-82DB-00C04FB1625D"
    NAME="CDO for Windows 2000 Library" -->
    <!--METADATA TYPE="typelib"
    UUID="00000205-0000-0010-8000-00AA006D2EA4"
    NAME="ADODB Type Library" -->
    <%
    '
    'retrieved default fields
    '
    recipient = request("recipient")
    redirect = request("redirect")
    subject = request("subject")
    email = request("email")
    required = request("required")
    if required = "" then
    required = "recipient,subject,email,redirect"
    else
    required = "recipient,subject,email,redirect," & required
    end if

    '
    'verify the referer
    '
    referer = request.ServerVariables("HTTP_REFERER")
    referer = split(referer,"/")
    url_verified = "no"
    for icounter = Lbound(url) to Ubound(url) '
    LINE 96 if referer(2) = url(icounter) then
    url_verified = "yes"
    end if
    next
    if not url_verified = "yes" then
    response.write("The url specified is invalid!")
    response.End
    end if

    '
    'verify the recipient(not tested)
    '
    'trimed_referer = split(referer(2),".")'
    'response.write recipient & "<br>" & referer(2) & "=" & trimed_referer(0) & "<br>"
    'if trimed_referer(0) = "www" then
    ' if InStr(1,recipient,trimed_referer(1),1) = 0 then
    ' response.write "recipient don't match the referer"
    ' response.end
    ' end if
    'else
    ' if InStr(1,recipient,trimed_referer(0),1) = 0 then
    ' response.write "recipient don't match the referer"
    ' response.end
    ' end if
    'end if

    '
    'retrieve form contents and create email fields
    '
    query = Request.ServerVariables("QUERY_STRING")
    query = split(query,"&")
    query3 = split(required,",")
    For iLoop = Lbound(query) to UBound(query)
    query2 = split(query(iloop),"=")

    '
    'form validation, checks required fields are not null
    '
    for i = LBound(query3) to UBound(query3)
    if query3(i) = query2(0) then
    if query2(1) = "" then
    response.write ("you must enter a valid ") & query2(0)
    response.end
    end if
    end if

    'if query2(0) = "agree" then
    'if query2(1) <> "on" or query2(1) = "" then
    ' response.write("You must agree to terms and conditions to enable Formmailv1.3 to execute!")
    'response.end
    'end if
    'end if



    '
    'form validation, checks terms and conditions checkbox has been ticked
    '

    Next
    if not query2(0) = "recipient" and not query2(0) = "redirect" and not query2(0) = "subject" and not query2(0) = "realname" and not query2(0) = "email" and not query2(0) = "required" and not query2(0) = "agree" then
    strBody = strBody & vbnewline & vbnewline & query2(0) &": " & query2(1)
    end if
    Next
    if email = "" then
    email = "formmail@" & referer(2)
    end if
    '
    'replaces any special characters parsed through the query string
    '
    strbody = replace(strbody, "+"," ")
    strbody = replace(strbody, "%26%238364%3B","€")
    strbody = replace(strbody, "%A1","¡")
    strbody = replace(strbody, "%A3","£")
    strbody = replace(strbody, "%A8","¨")
    strbody = replace(strbody, "%AA","ª")
    strbody = replace(strbody, "%AC","¬")
    strbody = replace(strbody, "%B4","´")
    strbody = replace(strbody, "%B7","·")
    strbody = replace(strbody, "%BA","º")
    strbody = replace(strbody, "%BF","¿")
    strbody = replace(strbody, "%C7","Ç")
    strbody = replace(strbody, "%E7","ç")
    strbody = replace(strbody, "%0D%0A",vbnewline)
    strbody = replace(strbody, "%21","!")
    strbody = replace(strbody, "%23","#")
    strbody = replace(strbody, "%24","$")
    strbody = replace(strbody, "%25","%")
    strbody = replace(strbody, "%26","&")
    strbody = replace(strbody, "%27","'")
    strbody = replace(strbody, "%28","(")
    strbody = replace(strbody, "%29",")")
    strbody = replace(strbody, "%2B","+")
    strbody = replace(strbody, "%2C",",")
    strbody = replace(strbody, "%2D","-")
    strbody = replace(strbody, "%2E",".")
    strbody = replace(strbody, "%2F","/")
    strbody = replace(strbody, "%3A",":")
    strbody = replace(strbody, "%3B",";")
    strbody = replace(strbody, "%3C","<")
    strbody = replace(strbody, "%3D","=")
    strbody = replace(strbody, "%3E",">")
    strbody = replace(strbody, "%3F","?")
    strbody = replace(strbody, "%5B","[")
    strbody = replace(strbody, "%5C","\")
    strbody = replace(strbody, "%5D","]")
    strbody = replace(strbody, "%5E","^")
    strbody = replace(strbody, "%5F","_")
    strbody = replace(strbody, "%60","`")
    strbody = replace(strbody, "%7B","{")
    strbody = replace(strbody, "%7C","|")
    strbody = replace(strbody, "%7D","}")
    strbody = replace(strbody, "%7E","~")

    '
    'this creates the body of the mail message, the text in quotes can be modified accordingly
    '
    strBody = "Here is the results of your form submitted from" & referer(2) & vbnewline & vbnewline & "Name: " & realname & vbnewline & vbnewline & "Email: " & email & vbnewline & strBody & vbnewline & vbnewline & "############# End Formmail Tranmission #############"

    '
    'checks if a smtp port has been specified, if not it uses the default port 25
    '
    if intport <> 25 then
    intport = intport
    else
    intport = 25
    end if

    '
    'send the mail message
    '
    set objMessage = CreateObject("CDO.Message")
    objMessage.To = recipient
    objMessage.From = email
    objMessage.Subject = subject
    objMessage.Sender = email
    objMessage.Textbody = strBody

    '
    'cdosys configuration setup
    '
    set objConfig = CreateObject("CDO.Configuration")
    objConfig.Fields(cdoSendUsingMethod) = cdoSendUsingPort
    objConfig.Fields(cdoSMTPServer) = strServer
    objConfig.Fields(cdoSMTPServerPort) = intPort
    objConfig.Fields(cdoSMTPAuthenticate) = cdoAnonymous
    objConfig.Fields.Update
    set objMessage.Configuration = objConfig

    '
    'define error handling procedures
    '
    On Error Resume Next
    objMessage.Send
    If Err.Number = 0 then
    response.write("Formmail v1.3 processed all operations successfully!")
    else
    response.write("Formmail v1.3 detected the following errors:")& "<br>"
    response.write("error no.: ")&err.number & "<br>"
    response.write("description: ")&err.description & "<br>"
    response.end
    End If
    On Error Goto 0

    '
    'send them to the page specified
    '
    Response.Redirect redirect

    '####################################################################################################
    'This is where the code ends
    '####################################################################################################
    %>
    <!-- That's All Folks -->
    <!-- Happy Surfing -->
    <!-- Credits -->
    <!-- David Parkes - Project Planning -->
    <!-- Jonas Tornqvist - Lead Programmer version 1-->
    <!-- Karl Snares - Lead Programmer version 1.2 & 1.3
    <!-- Matt Wright - Original Formmail CGI Developer -->


  • Registered Users, Registered Users 2 Posts: 413 ✭✭ianhobo


    hey,
    The error isnt actually in your code/html, its occuring in the asp page that processes your form.
    /cgi-bin/formmail.asp, line 96
    formmail.asp is causing the error, without seeing that it would be hard to say what the problem is.
    What values did you change in the form and/or html?
    It may be expecting certain values for validation or something else (such as the email address, which maybe you have changed?> So it could be generating the error because of that.

    That formmail.asp is a local file on the webserver, so either check line 96 in that, or post it here so we can have a look


  • Registered Users, Registered Users 2 Posts: 413 ✭✭ianhobo


    the formmail.asp is performing some validation checks.
    Line 96 is run because the 'if' condition is failing. It checks/indexes the array of valid domains at line 54
    Has the website moved domains or changed email addresses/providers?
    What was the old email address?
    And whats the new one?


  • Registered Users, Registered Users 2 Posts: 3,061 ✭✭✭sticker


    ianhobo wrote: »
    hey,
    The error isnt actually in your code/html, its occuring in the asp page that processes your form.

    formmail.asp is causing the error, without seeing that it would be hard to say what the problem is.
    What values did you change in the form and/or html?
    It may be expecting certain values for validation or something else (such as the email address, which maybe you have changed?> So it could be generating the error because of that.

    That formmail.asp is a local file on the webserver, so either check line 96 in that, or post it here so we can have a look

    I've posted the ASP above...

    The only change I made was with the index.htm code - which contains the form html

    I changed the email in this section of code / saved it within Dreamweaver / uploaded it (after removing the old index file)


    <form ACTION="cgi-bin/formmail.asp" method="get" name="form1">
    <input name="recipient" value="info@summerhillspares.ie" type="hidden">
    <input type="hidden" name="redirect" value="http://www.summerhillspares.ie/requestprocessed.htm"&gt;
    <input name="subject" type="hidden" id="subject" value="spare parts request">


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 413 ✭✭ianhobo


    see my replies after what you quoted from me :)


  • Registered Users, Registered Users 2 Posts: 706 ✭✭✭DJB


    Just before line 96 put this in:

    FOR EACH x IN referrer
    thisCount = thisCount + 1
    response.write thisCount & " - " & x & "<br />" & vbcrlf
    NEXT
    response.end

    Post the form again and it should spit out something to the page. Copy and paste that here so I can see it.

    Thanks, Dave


  • Registered Users, Registered Users 2 Posts: 21,263 ✭✭✭✭Eoin


    That error indicates that the code is accessing an index in an array that doesn't exist.

    Off the top of my head, it looks like the code is getting the referring URL, and trying to split it. If you are accessing the page directly, then I'd imagine that the value won't be populated.

    Try something like this - I've not tested it, and it's off the top of my head so may need some tweaking. There's also probably some unnecessary if statements there, but give it a go.
    Dim sRef, avarRef
    sRef = request.ServerVariables("HTTP_REFERER")
    If sRef <> "" Then
        If instr(sRef, "/") > 0 Then
             avarRef = split(sRef, "/")
        End If
    End If
    
    If isArray(avarRef) Then
        If ubound(avarRef) > 1 Then
            for icounter = Lbound(url) to Ubound(url) '
                if avarRef(2) = url(icounter) then
                    url_verified = "yes"
                end if
            next
        End If
    End If
    


  • Registered Users, Registered Users 2 Posts: 706 ✭✭✭DJB


    Alternatively, use a new script... http://www.dynamic.ie/sourcecode/formtomail.asp


  • Registered Users, Registered Users 2 Posts: 3,061 ✭✭✭sticker


    DJB wrote: »
    Just before line 96 put this in:

    FOR EACH x IN referrer
    thisCount = thisCount + 1
    response.write thisCount & " - " & x & "<br />" & vbcrlf
    NEXT
    response.end

    Post the form again and it should spit out something to the page. Copy and paste that here so I can see it.

    Thanks, Dave

    I added the code before line 96 - and uploaded it again - doesn't seem to work

    Still getting this message - I refreshed the new index page before trying...

    Microsoft VBScript runtime error '800a01f4'

    Variable is undefined: 'referrer'

    /cgi-bin/formmail.asp, line 96



    Here's the new ASP code as requested:



    <%@ Language = vbscript%>
    <%option explicit %>
    <%server.scripttimeout = 600 %>
    <%
    '
    FORMMAIL V1.3

    '
    'copyright information
    '
    'Copyright 2002: Sorted Sites http://www.sortedsites.com
    'Authors Jonas Tornqvist, David Parkes and Karl Snares
    'This script is Freeware, which means you are free to use and modify
    'the script for your own use.
    'The only condition is this copyright header remain intact and you don't
    'try and sell this script for profit without first asking us.
    'And of course also ask Matt Wright who wrote the original perl version of Formmail.

    '
    'license agreement - Important
    '
    'By using this script you agree to indeminfy the developers - Sorted Sites of any loss
    'or damages that may arise from its use or missue.
    'This script is provided as is with all faults - no warranties and no guarantees.
    'basically its free - use it at your own risk and cost.
    'No warranties and no tech support - if you need help with this don't ask us!
    'The documentation is provided as is with all the help we can offer.
    'As we develop this script we shall post updates hopefully fix any bugs
    'We are not obliged to release any future versions and we might not bother...
    'By using this script you accept this license agreement!

    '
    'documentation v1.3
    '

    '####################################################################################################
    'this is where the code starts for real
    '####################################################################################################

    '
    'declare variables
    '
    Dim strFrom, strTo, strSubject, strBody
    Dim objMessage, objConfig, strServer, intPort
    Dim recipient, redirect, subject, realname, email, required, strEmail1, strEmail2
    Dim referer, url, url_verified, icounter, query, iloop, query2, query3, i, agree, validation, error0, error0ok

    '############################## CONFIGURATION VARIABLES ####################################

    'These are the only lines you will need to change
    '
    strServer = "mail.summerhillspares.ie" 'set which smtp server will be used to send the email. enter ip address or domain name. eg: "xxx.xxx.xxx.xxx" or "smtp.your-domain.com"
    intPort = 25 'set the smtp port to be used when sending mail (by default port 25 is used)
    'Referrer's Array is defined here. Enter the valid domains which may use this script.
    url = Array("www.summerhillspares.ie","summerhillspares.ie","www.hotmail.com","hotmail.com")'Set which urls that will be accepted. http://xxxxx/
    'Seperate multiple domains by commas
    'eg: url= Array("www.your-domain.com","your-domain.com","www.my-domain.com")
    'computer names can be used instead of domains if this script is being run locally
    'eg: url = Array("computername")

    '######################################### IMPORTANT NOTICE #########################################
    'IMPORTANT: do not modify anything below this line unless you know what you are doing!!
    '######################################### IMPORTANT NOTICE #########################################

    '
    'information type and CDOSYS constants
    '
    %>
    <!--METADATA TYPE="typelib"
    UUID="CD000000-8B95-11D1-82DB-00C04FB1625D"
    NAME="CDO for Windows 2000 Library" -->
    <!--METADATA TYPE="typelib"
    UUID="00000205-0000-0010-8000-00AA006D2EA4"
    NAME="ADODB Type Library" -->
    <%
    '
    'retrieved default fields
    '
    recipient = request("recipient")
    redirect = request("redirect")
    subject = request("subject")
    email = request("email")
    required = request("required")
    if required = "" then
    required = "recipient,subject,email,redirect"
    else
    required = "recipient,subject,email,redirect," & required
    end if

    '
    'verify the referer
    '
    referer = request.ServerVariables("HTTP_REFERER")
    referer = split(referer,"/")
    url_verified = "no"
    for icounter = Lbound(url) to Ubound(url) '
    FOR EACH x IN referrer
    thisCount = thisCount + 1
    response.write thisCount & " - " & x & "<br />" & vbcrlf
    NEXT
    response.end
    if referer(2) = url(icounter) then
    url_verified = "yes"
    end if
    next
    if not url_verified = "yes" then
    response.write("The url specified is invalid!")
    response.End
    end if

    '
    'verify the recipient(not tested)
    '
    'trimed_referer = split(referer(2),".")'
    'response.write recipient & "<br>" & referer(2) & "=" & trimed_referer(0) & "<br>"
    'if trimed_referer(0) = "www" then
    ' if InStr(1,recipient,trimed_referer(1),1) = 0 then
    ' response.write "recipient don't match the referer"
    ' response.end
    ' end if
    'else
    ' if InStr(1,recipient,trimed_referer(0),1) = 0 then
    ' response.write "recipient don't match the referer"
    ' response.end
    ' end if
    'end if

    '
    'retrieve form contents and create email fields
    '
    query = Request.ServerVariables("QUERY_STRING")
    query = split(query,"&")
    query3 = split(required,",")
    For iLoop = Lbound(query) to UBound(query)
    query2 = split(query(iloop),"=")

    '
    'form validation, checks required fields are not null
    '
    for i = LBound(query3) to UBound(query3)
    if query3(i) = query2(0) then
    if query2(1) = "" then
    response.write ("you must enter a valid ") & query2(0)
    response.end
    end if
    end if

    'if query2(0) = "agree" then
    'if query2(1) <> "on" or query2(1) = "" then
    ' response.write("You must agree to terms and conditions to enable Formmailv1.3 to execute!")
    'response.end
    'end if
    'end if



    '
    'form validation, checks terms and conditions checkbox has been ticked
    '

    Next
    if not query2(0) = "recipient" and not query2(0) = "redirect" and not query2(0) = "subject" and not query2(0) = "realname" and not query2(0) = "email" and not query2(0) = "required" and not query2(0) = "agree" then
    strBody = strBody & vbnewline & vbnewline & query2(0) &": " & query2(1)
    end if
    Next
    if email = "" then
    email = "formmail@" & referer(2)
    end if
    '
    'replaces any special characters parsed through the query string
    '
    strbody = replace(strbody, "+"," ")
    strbody = replace(strbody, "%26%238364%3B","€")
    strbody = replace(strbody, "%A1","¡")
    strbody = replace(strbody, "%A3","£")
    strbody = replace(strbody, "%A8","¨")
    strbody = replace(strbody, "%AA","ª")
    strbody = replace(strbody, "%AC","¬")
    strbody = replace(strbody, "%B4","´")
    strbody = replace(strbody, "%B7","·")
    strbody = replace(strbody, "%BA","º")
    strbody = replace(strbody, "%BF","¿")
    strbody = replace(strbody, "%C7","Ç")
    strbody = replace(strbody, "%E7","ç")
    strbody = replace(strbody, "%0D%0A",vbnewline)
    strbody = replace(strbody, "%21","!")
    strbody = replace(strbody, "%23","#")
    strbody = replace(strbody, "%24","$")
    strbody = replace(strbody, "%25","%")
    strbody = replace(strbody, "%26","&")
    strbody = replace(strbody, "%27","'")
    strbody = replace(strbody, "%28","(")
    strbody = replace(strbody, "%29",")")
    strbody = replace(strbody, "%2B","+")
    strbody = replace(strbody, "%2C",",")
    strbody = replace(strbody, "%2D","-")
    strbody = replace(strbody, "%2E",".")
    strbody = replace(strbody, "%2F","/")
    strbody = replace(strbody, "%3A",":")
    strbody = replace(strbody, "%3B",";")
    strbody = replace(strbody, "%3C","<")
    strbody = replace(strbody, "%3D","=")
    strbody = replace(strbody, "%3E",">")
    strbody = replace(strbody, "%3F","?")
    strbody = replace(strbody, "%5B","[")
    strbody = replace(strbody, "%5C","\")
    strbody = replace(strbody, "%5D","]")
    strbody = replace(strbody, "%5E","^")
    strbody = replace(strbody, "%5F","_")
    strbody = replace(strbody, "%60","`")
    strbody = replace(strbody, "%7B","{")
    strbody = replace(strbody, "%7C","|")
    strbody = replace(strbody, "%7D","}")
    strbody = replace(strbody, "%7E","~")

    '
    'this creates the body of the mail message, the text in quotes can be modified accordingly
    '
    strBody = "Here is the results of your form submitted from" & referer(2) & vbnewline & vbnewline & "Name: " & realname & vbnewline & vbnewline & "Email: " & email & vbnewline & strBody & vbnewline & vbnewline & "############# End Formmail Tranmission #############"

    '
    'checks if a smtp port has been specified, if not it uses the default port 25
    '
    if intport <> 25 then
    intport = intport
    else
    intport = 25
    end if

    '
    'send the mail message
    '
    set objMessage = CreateObject("CDO.Message")
    objMessage.To = recipient
    objMessage.From = email
    objMessage.Subject = subject
    objMessage.Sender = email
    objMessage.Textbody = strBody

    '
    'cdosys configuration setup
    '
    set objConfig = CreateObject("CDO.Configuration")
    objConfig.Fields(cdoSendUsingMethod) = cdoSendUsingPort
    objConfig.Fields(cdoSMTPServer) = strServer
    objConfig.Fields(cdoSMTPServerPort) = intPort
    objConfig.Fields(cdoSMTPAuthenticate) = cdoAnonymous
    objConfig.Fields.Update
    set objMessage.Configuration = objConfig

    '
    'define error handling procedures
    '
    On Error Resume Next
    objMessage.Send
    If Err.Number = 0 then
    response.write("Formmail v1.3 processed all operations successfully!")
    else
    response.write("Formmail v1.3 detected the following errors:")& "<br>"
    response.write("error no.: ")&err.number & "<br>"
    response.write("description: ")&err.description & "<br>"
    response.end
    End If
    On Error Goto 0

    '
    'send them to the page specified
    '
    Response.Redirect redirect

    '####################################################################################################
    'This is where the code ends
    '####################################################################################################
    %>
    <!-- That's All Folks -->
    <!-- Happy Surfing -->
    <!-- Credits -->
    <!-- David Parkes - Project Planning -->
    <!-- Jonas Tornqvist - Lead Programmer version 1-->
    <!-- Karl Snares - Lead Programmer version 1.2 & 1.3
    <!-- Matt Wright - Original Formmail CGI Developer -->


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 3,061 ✭✭✭sticker


    DJB wrote: »
    Alternatively, use a new script... http://www.dynamic.ie/sourcecode/formtomail.asp


    Do I just overwrite the old asp code with the code provided in the link you posted and then upload it?

    Sorry everyone - I'm just not familiar with ASP coding!


  • Registered Users, Registered Users 2 Posts: 3,061 ✭✭✭sticker


    eoin_s wrote: »
    That error indicates that the code is accessing an index in an array that doesn't exist.

    Off the top of my head, it looks like the code is getting the referring URL, and trying to split it. If you are accessing the page directly, then I'd imagine that the value won't be populated.

    Try something like this - I've not tested it, and it's off the top of my head so may need some tweaking. There's also probably some unnecessary if statements there, but give it a go.
    Dim sRef, avarRef
    sRef = request.ServerVariables("HTTP_REFERER")
    If sRef <> "" Then
        If instr(sRef, "/") > 0 Then
             avarRef = split(sRef, "/")
        End If
    End If
    
    If isArray(avarRef) Then
        If ubound(avarRef) > 1 Then
            for icounter = Lbound(url) to Ubound(url) '
                if avarRef(2) = url(icounter) then
                    url_verified = "yes"
                end if
            next
        End If
    End If
    

    Thanks Eoin -

    I'm fortunate to have a LOT of replies here today!

    Where do I place this code? in the ASP / index ? / at which line etc?!


  • Registered Users, Registered Users 2 Posts: 413 ✭✭ianhobo


    the entries in the url array on line 54 are not mathcing up with the referer which is whats being checked in line 96 .What is your refererer??
    Again i ask you, has the website moved domains? because this would change the referer object


  • Registered Users, Registered Users 2 Posts: 706 ✭✭✭DJB


    for new script, follow instructions that come with it.

    In code piece I asked you to put in, change referrer to referer wherever you see it. I spelt it wrong!


  • Registered Users, Registered Users 2 Posts: 21,263 ✭✭✭✭Eoin


    Maybe I'm just not tuned in today, but does that code only allow the mail to be sent when the HTTP_REFERER is from a certain domain? So, if someone goes to that page from any other site (or directly without clicking a link to it), then it won't work?

    Unless you've got a massive spam problem, it seems a little OTT.

    By the way, that code I posted should work as is.


  • Registered Users, Registered Users 2 Posts: 706 ✭✭✭DJB


    ianhobo... I agree, I just looked at the script more.

    He said, that's the old site. What's the new one?


  • Registered Users, Registered Users 2 Posts: 21,263 ✭✭✭✭Eoin


    sticker wrote: »
    Thanks Eoin -

    I'm fortunate to have a LOT of replies here today!

    Where do I place this code? in the ASP / index ? / at which line etc?!

    That should replace lines 92 to 99 in formmail.asp


  • Registered Users, Registered Users 2 Posts: 3,061 ✭✭✭sticker


    ianhobo wrote: »
    the entries in the url array on line 54 are not mathcing up with the referer which is whats being checked in line 96 .What is your refererer??
    Again i ask you, has the website moved domains? because this would change the referer object

    Sorry - What do you mean "referer" it's hosted by 365 domains... the website hasn't changed domains since I've been asked to help...

    I assumed it would be a simple change of html code!

    The only change I made was to the html code - changing the email value - then this error appeared!


  • Registered Users, Registered Users 2 Posts: 3,061 ✭✭✭sticker


    eoin_s wrote: »
    That should replace lines 92 to 99 in formmail.asp

    Code reads like this Eoin - is this correct?

    <%@ Language = vbscript%>
    <%option explicit %>
    <%server.scripttimeout = 600 %>
    <%
    '
    FORMMAIL V1.3

    '
    'copyright information
    '
    'Copyright 2002: Sorted Sites http://www.sortedsites.com
    'Authors Jonas Tornqvist, David Parkes and Karl Snares
    'This script is Freeware, which means you are free to use and modify
    'the script for your own use.
    'The only condition is this copyright header remain intact and you don't
    'try and sell this script for profit without first asking us.
    'And of course also ask Matt Wright who wrote the original perl version of Formmail.

    '
    'license agreement - Important
    '
    'By using this script you agree to indeminfy the developers - Sorted Sites of any loss
    'or damages that may arise from its use or missue.
    'This script is provided as is with all faults - no warranties and no guarantees.
    'basically its free - use it at your own risk and cost.
    'No warranties and no tech support - if you need help with this don't ask us!
    'The documentation is provided as is with all the help we can offer.
    'As we develop this script we shall post updates hopefully fix any bugs
    'We are not obliged to release any future versions and we might not bother...
    'By using this script you accept this license agreement!

    '
    'documentation v1.3
    '

    '####################################################################################################
    'this is where the code starts for real
    '####################################################################################################

    '
    'declare variables
    '
    Dim strFrom, strTo, strSubject, strBody
    Dim objMessage, objConfig, strServer, intPort
    Dim recipient, redirect, subject, realname, email, required, strEmail1, strEmail2
    Dim referer, url, url_verified, icounter, query, iloop, query2, query3, i, agree, validation, error0, error0ok

    '############################## CONFIGURATION VARIABLES ####################################

    'These are the only lines you will need to change
    '
    strServer = "mail.summerhillspares.ie" 'set which smtp server will be used to send the email. enter ip address or domain name. eg: "xxx.xxx.xxx.xxx" or "smtp.your-domain.com"
    intPort = 25 'set the smtp port to be used when sending mail (by default port 25 is used)
    'Referrer's Array is defined here. Enter the valid domains which may use this script.
    url = Array("www.summerhillspares.ie","summerhillspares.ie","www.hotmail.com","hotmail.com")'Set which urls that will be accepted. http://xxxxx/
    'Seperate multiple domains by commas
    'eg: url= Array("www.your-domain.com","your-domain.com","www.my-domain.com")
    'computer names can be used instead of domains if this script is being run locally
    'eg: url = Array("computername")

    '######################################### IMPORTANT NOTICE #########################################
    'IMPORTANT: do not modify anything below this line unless you know what you are doing!!
    '######################################### IMPORTANT NOTICE #########################################

    '
    'information type and CDOSYS constants
    '
    %>
    <!--METADATA TYPE="typelib"
    UUID="CD000000-8B95-11D1-82DB-00C04FB1625D"
    NAME="CDO for Windows 2000 Library" -->
    <!--METADATA TYPE="typelib"
    UUID="00000205-0000-0010-8000-00AA006D2EA4"
    NAME="ADODB Type Library" -->
    <%
    '
    'retrieved default fields
    '
    recipient = request("recipient")
    redirect = request("redirect")
    subject = request("subject")
    email = request("email")
    required = request("required")
    if required = "" then
    required = "recipient,subject,email,redirect"
    else
    required = "recipient,subject,email,redirect," & required
    end if

    '
    'verify the referer
    '
    Dim sRef, avarRef
    sRef = request.ServerVariables("HTTP_REFERER")
    If sRef <> "" Then
    If instr(sRef, "/") > 0 Then
    avarRef = split(sRef, "/")
    End If
    End If

    If isArray(avarRef) Then
    If ubound(avarRef) > 1 Then
    for icounter = Lbound(url) to Ubound(url) '
    if avarRef(2) = url(icounter) then
    url_verified = "yes"
    end if
    next
    End If
    End If
    next
    if not url_verified = "yes" then
    response.write("The url specified is invalid!")
    response.End
    end if

    '
    'verify the recipient(not tested)
    '
    'trimed_referer = split(referer(2),".")'
    'response.write recipient & "<br>" & referer(2) & "=" & trimed_referer(0) & "<br>"
    'if trimed_referer(0) = "www" then
    ' if InStr(1,recipient,trimed_referer(1),1) = 0 then
    ' response.write "recipient don't match the referer"
    ' response.end
    ' end if
    'else
    ' if InStr(1,recipient,trimed_referer(0),1) = 0 then
    ' response.write "recipient don't match the referer"
    ' response.end
    ' end if
    'end if

    '
    'retrieve form contents and create email fields
    '
    query = Request.ServerVariables("QUERY_STRING")
    query = split(query,"&")
    query3 = split(required,",")
    For iLoop = Lbound(query) to UBound(query)
    query2 = split(query(iloop),"=")

    '
    'form validation, checks required fields are not null
    '
    for i = LBound(query3) to UBound(query3)
    if query3(i) = query2(0) then
    if query2(1) = "" then
    response.write ("you must enter a valid ") & query2(0)
    response.end
    end if
    end if

    'if query2(0) = "agree" then
    'if query2(1) <> "on" or query2(1) = "" then
    ' response.write("You must agree to terms and conditions to enable Formmailv1.3 to execute!")
    'response.end
    'end if
    'end if



    '
    'form validation, checks terms and conditions checkbox has been ticked
    '

    Next
    if not query2(0) = "recipient" and not query2(0) = "redirect" and not query2(0) = "subject" and not query2(0) = "realname" and not query2(0) = "email" and not query2(0) = "required" and not query2(0) = "agree" then
    strBody = strBody & vbnewline & vbnewline & query2(0) &": " & query2(1)
    end if
    Next
    if email = "" then
    email = "formmail@" & referer(2)
    end if
    '
    'replaces any special characters parsed through the query string
    '
    strbody = replace(strbody, "+"," ")
    strbody = replace(strbody, "%26%238364%3B","€")
    strbody = replace(strbody, "%A1","¡")
    strbody = replace(strbody, "%A3","£")
    strbody = replace(strbody, "%A8","¨")
    strbody = replace(strbody, "%AA","ª")
    strbody = replace(strbody, "%AC","¬")
    strbody = replace(strbody, "%B4","´")
    strbody = replace(strbody, "%B7","·")
    strbody = replace(strbody, "%BA","º")
    strbody = replace(strbody, "%BF","¿")
    strbody = replace(strbody, "%C7","Ç")
    strbody = replace(strbody, "%E7","ç")
    strbody = replace(strbody, "%0D%0A",vbnewline)
    strbody = replace(strbody, "%21","!")
    strbody = replace(strbody, "%23","#")
    strbody = replace(strbody, "%24","$")
    strbody = replace(strbody, "%25","%")
    strbody = replace(strbody, "%26","&")
    strbody = replace(strbody, "%27","'")
    strbody = replace(strbody, "%28","(")
    strbody = replace(strbody, "%29",")")
    strbody = replace(strbody, "%2B","+")
    strbody = replace(strbody, "%2C",",")
    strbody = replace(strbody, "%2D","-")
    strbody = replace(strbody, "%2E",".")
    strbody = replace(strbody, "%2F","/")
    strbody = replace(strbody, "%3A",":")
    strbody = replace(strbody, "%3B",";")
    strbody = replace(strbody, "%3C","<")
    strbody = replace(strbody, "%3D","=")
    strbody = replace(strbody, "%3E",">")
    strbody = replace(strbody, "%3F","?")
    strbody = replace(strbody, "%5B","[")
    strbody = replace(strbody, "%5C","\")
    strbody = replace(strbody, "%5D","]")
    strbody = replace(strbody, "%5E","^")
    strbody = replace(strbody, "%5F","_")
    strbody = replace(strbody, "%60","`")
    strbody = replace(strbody, "%7B","{")
    strbody = replace(strbody, "%7C","|")
    strbody = replace(strbody, "%7D","}")
    strbody = replace(strbody, "%7E","~")

    '
    'this creates the body of the mail message, the text in quotes can be modified accordingly
    '
    strBody = "Here is the results of your form submitted from" & referer(2) & vbnewline & vbnewline & "Name: " & realname & vbnewline & vbnewline & "Email: " & email & vbnewline & strBody & vbnewline & vbnewline & "############# End Formmail Tranmission #############"

    '
    'checks if a smtp port has been specified, if not it uses the default port 25
    '
    if intport <> 25 then
    intport = intport
    else
    intport = 25
    end if

    '
    'send the mail message
    '
    set objMessage = CreateObject("CDO.Message")
    objMessage.To = recipient
    objMessage.From = email
    objMessage.Subject = subject
    objMessage.Sender = email
    objMessage.Textbody = strBody

    '
    'cdosys configuration setup
    '
    set objConfig = CreateObject("CDO.Configuration")
    objConfig.Fields(cdoSendUsingMethod) = cdoSendUsingPort
    objConfig.Fields(cdoSMTPServer) = strServer
    objConfig.Fields(cdoSMTPServerPort) = intPort
    objConfig.Fields(cdoSMTPAuthenticate) = cdoAnonymous
    objConfig.Fields.Update
    set objMessage.Configuration = objConfig

    '
    'define error handling procedures
    '
    On Error Resume Next
    objMessage.Send
    If Err.Number = 0 then
    response.write("Formmail v1.3 processed all operations successfully!")
    else
    response.write("Formmail v1.3 detected the following errors:")& "<br>"
    response.write("error no.: ")&err.number & "<br>"
    response.write("description: ")&err.description & "<br>"
    response.end
    End If
    On Error Goto 0

    '
    'send them to the page specified
    '
    Response.Redirect redirect

    '####################################################################################################
    'This is where the code ends
    '####################################################################################################
    %>
    <!-- That's All Folks -->
    <!-- Happy Surfing -->
    <!-- Credits -->
    <!-- David Parkes - Project Planning -->
    <!-- Jonas Tornqvist - Lead Programmer version 1-->
    <!-- Karl Snares - Lead Programmer version 1.2 & 1.3
    <!-- Matt Wright - Original Formmail CGI Developer -->


  • Registered Users, Registered Users 2 Posts: 706 ✭✭✭DJB


    Give me ftp access and i'll have it working in 2 mins! :D


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 3,061 ✭✭✭sticker


    DJB wrote: »
    ianhobo... I agree, I just looked at the script more.

    He said, that's the old site. What's the new one?

    I'm building a simple alternative site for him - it's not online yet...

    I thought I had a simple task this morning of changing the email attribute in the form (which was part of the existing site)


  • Registered Users, Registered Users 2 Posts: 21,263 ✭✭✭✭Eoin


    No, 92 - 99 inclusive, there's an extra "next" there that needs removing. Or DJB can sort you out - I would, but I've no FTP access at work.
    '----------------------------------------------------------------------------------------------------
    'verify the referer
    '----------------------------------------------------------------------------------------------------
    Dim sRef, avarRef
    sRef = request.ServerVariables("HTTP_REFERER")
    If sRef <> "" Then
    	If instr(sRef, "/") > 0 Then
    		avarRef = split(sRef, "/")
    	End If
    End If
    
    If isArray(avarRef) Then
    	If ubound(avarRef) > 1 Then
    		for icounter = Lbound(url) to Ubound(url) '
    			if avarRef(2) = url(icounter) then
    				url_verified = "yes"
    			end if
    		next
    	End If
    End If
    
    if not url_verified = "yes" then
    	response.write("The url specified is invalid!")
    	response.End
    end if
    
    '----------------------------------------------------------------------------------------------------
    'verify the recipient(not tested)
    '----------------------------------------------------------------------------------------------------
    
    


  • Registered Users, Registered Users 2 Posts: 3,061 ✭✭✭sticker


    DJB wrote: »
    Give me ftp access and i'll have it working in 2 mins! :D


    PM sent DJB - Much appreciated!!


  • Registered Users, Registered Users 2 Posts: 413 ✭✭ianhobo


    ok, i missed a few replies
    The referer, or HTTP referer, identifies, from the point of view of an internet webpage or resource, the address of the webpage (commonly the URL, the more generic URI or the i18n updated IRI) of the resource which links to it. By checking the referer, the new page can see where the request came from.

    addthe domain of where ever your test stuff is hosted to into the array at line 54. e.g www.hosting365.com or whatever it is
    This WONT work is your running on localhost (your own machine)
    (if you add localhost/127.0.0.1 to the array too, line 96 error shouldn't occur, but no mail will be sent)
    Howd you get on DJB?


  • Registered Users, Registered Users 2 Posts: 3,061 ✭✭✭sticker


    DJB is on the case!

    Thanks so much to everyone who helped today! ;)


  • Registered Users, Registered Users 2 Posts: 3,061 ✭✭✭sticker


    ianhobo wrote: »
    ok, i missed a few replies



    addthe domain of where ever your test stuff is hosted to into the array at line 54. e.g www.hosting365.com or whatever it is
    This WONT work is your running on localhost (your own machine)
    (if you add localhost/127.0.0.1 to the array too, line 96 error shouldn't occur, but no mail will be sent)
    Howd you get on DJB?

    He has the FTP codes -

    It's a bit spooky that this amount of work is needed to change a simple thing!

    I know my way around html but I need a crash course in ASP methinks!

    I'll be changing the aesthetic look of the site down the road,

    If I alter the colour scheme / fonts of the html file (where the form is) will I need to go through this again?!!

    Thanks


  • Registered Users, Registered Users 2 Posts: 413 ✭✭ianhobo


    its not that much work really, if you know asp.

    but before you go diving in, asp is quite general.
    it can (in general) be written in one of MANY languages, your stuff here is in VBScript and would be called "classic asp"
    You can also write it in JSript

    The newer asp stuff is the dot net. This can be written in c#,j#,jscript net, vb, managed cpp, cobol, yada yada yada.

    if your only starting, sure you may as well start out by learning one of the newer languages? try c#, or i think jscript.net is a bit easier going and more resembles the old "classic asp"

    or check out php! ( i should really do that myself....... :) )


  • Registered Users, Registered Users 2 Posts: 21,263 ✭✭✭✭Eoin


    sticker wrote: »
    He has the FTP codes -

    It's a bit spooky that this amount of work is needed to change a simple thing!

    I know my way around html but I need a crash course in ASP methinks!

    I'll be changing the aesthetic look of the site down the road,

    If I alter the colour scheme / fonts of the html file (where the form is) will I need to go through this again?!!

    Thanks

    It seems to be more of a case of overly complicated code


  • Registered Users, Registered Users 2 Posts: 3,061 ✭✭✭sticker


    eoin_s wrote: »
    It seems to be more of a case of overly complicated code

    good to know it wasn't just me being an absolute dumbell!


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 706 ✭✭✭DJB


    Lads, strange problem. I found where it is happening but don't know why!

    line 92 - referer = request.ServerVariables("HTTP_REFERER")

    On the OP machine, when he visits the site and clicks send, for some reason, referer is blank, which in turn breaks the array call. But on my machine, it is what it should be, i.e. http://www.summerhillspares.ie/

    I've done a response.write just after this line so could you guys go to the site, click the send button and tell me if it comes back with a blank page or has "http://www.summerhillspares.ie/".

    This might be local to the OP's machine but how can this happen as this is all happening on the server. Why can't request.ServerVariables("HTTP_REFERER") not read the OP's previous page?

    Not seen this before!


  • Registered Users, Registered Users 2 Posts: 413 ✭✭ianhobo




  • Registered Users, Registered Users 2 Posts: 413 ✭✭ianhobo


    is he running the page from his open dreamweaver design or from a freshly uploaded copy each time?

    if he's just pressing "preview" in dreamweaver, and processing/sending the form from his local preview, he might have a valid referer to reference......


  • Registered Users, Registered Users 2 Posts: 706 ✭✭✭DJB


    that should happen but on the OP's computer, he's not getting that!

    I can't figure it out as it is requesting servervariables so should be browser/user independent!


  • Registered Users, Registered Users 2 Posts: 706 ✭✭✭DJB


    he's going to the site and clicking send. i just talked to him and we walked through it! it's not a cache as I did an "hello world" response.write at top of script and that worked fine!

    This one is baffling me!!!!


  • Registered Users, Registered Users 2 Posts: 21,263 ✭✭✭✭Eoin


    DJB wrote: »
    that should happen but on the OP's computer, he's not getting that!

    I can't figure it out as it is requesting servervariables so should be browser/user independent!

    Is it still not reading a value from the browser, so it's not really 100% server side?

    I don't see why that code is there at all anyway?


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 3,061 ✭✭✭sticker


    For what its worth, I restarted PC / modem / cleared cache / entered the site through a safe link in google - and I'm still seeing nothing onscreen when I click send!

    To be honest, if it's working for you guys - ie IS working - I'll live with my rig being a little temperamental!

    It's bizzare all the same!


  • Registered Users, Registered Users 2 Posts: 706 ✭✭✭DJB


    Your right. It's pointless really! I've commeted it out and it should be working fine now then.

    Let me know!


  • Registered Users, Registered Users 2 Posts: 413 ✭✭ianhobo


    the code is there to simply prevent any one sending data to the script for email processing.

    it says to itself:
    "did the data i just recieve come from my own domain (or another allowed domain as per line 54?). Ah, yes if did i'll just process it an send it on, we dont want any spam here!" :)


  • Registered Users, Registered Users 2 Posts: 21,263 ✭✭✭✭Eoin


    ianhobo wrote: »
    the code is there to simply prevent any one sending data to the script for email processing.

    it says to itself:
    "did the data i just recieve come from my own domain (or another allowed domain as per line 54?). Ah, yes if did i'll just process it an send it on, we dont want any spam here!" :)

    But if someone accesses that page directly, it won't work because there is no referer.

    A better way to check that the page was executed on their own domain would be to use

    Request.ServerVariables("Servername") or "HTTP_HOST".


  • Registered Users, Registered Users 2 Posts: 3,061 ✭✭✭sticker


    DJB wrote: »
    Your right. It's pointless really! I've commeted it out and it should be working fine now then.

    Let me know!

    Are you happy that the form is operational now to info@summerhillspares.ie then David?


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 413 ✭✭ianhobo


    Because its a general free script, it is a simple security measure used to prevent the form accepting and processing email from random people. Like me at my computer here

    but based on what you said eoin, it was probably originally designed to be used as a central processing script for several websites/domains


  • Registered Users, Registered Users 2 Posts: 706 ✭✭✭DJB


    I'm happy it is working but it doesn't check who is posting to it, that's all. I don't know why your machine is different but it works now.

    If you start getting spam through it than maybe look at putting a new script in but for now, it should be fine. Send a test and contact your client.


  • Registered Users, Registered Users 2 Posts: 3,061 ✭✭✭sticker


    I've just been on to the client - all tests are working - thanks so much David and everyone for the help today!!

    Much appreciated... ;)


  • Registered Users, Registered Users 2 Posts: 21,263 ✭✭✭✭Eoin


    ianhobo wrote: »
    Because its a general free script, it is a simple security measure used to prevent the form accepting and processing email from random people. Like me at my computer here

    but based on what you said eoin, it was probably originally designed to be used as a central processing script for several websites/domains

    Sorry - I was thinking about this the wrong way. If the HTTP_REFERER method is used after the form submission, then it should indeed work - regardless of where the user came from before visiting the contact page.

    However, due to the lack of indenting on the source, and the length of the script itself, it's hard to tell if the request to the server variables collection is being made at the right time.


  • Registered Users, Registered Users 2 Posts: 413 ✭✭ianhobo


    eoin_s wrote: »
    However, due to the lack of indenting on the source, and the length of the script itself, it's hard to tell if the request to the server variables collection is being made at the right time.

    Correct,
    any HTTP variable that are wanted should be the very first thing done.

    Same if your writing a response script.
    You have to do your cookies first thing, before the response object is fully constructed, and any http body data is added (the html or other)


  • Registered Users, Registered Users 2 Posts: 3,061 ✭✭✭sticker


    I just heard back from the client - it would appear the form is still not working properly

    Here's his email:

    Meant to mention the other day that the automated reply thats sent to customers (after they've filled in the parts request form)is now arriving at my inbox. E-mails are still arriving at the correct address,

    Anyone any ideas...?

    Thanks


  • Registered Users, Registered Users 2 Posts: 413 ✭✭ianhobo


    hey,
    yep, your sending it to yourself
    Line ten of your html <input name="recipient" id="summerhill......
    this value with name recipient is supposed to be the email address of the person who filled in the form, not yours. you should be from and sender

    change line 10 from:
    <input name="recipient" value="info@summerhillspares.ie" type="hidden">
    
    to
    <input name="email" value="info@summerhillspares.ie" type="hidden">
    

    and change line 29(ish) from:
    <input name="EmailAddress" id="EmailAddress2" type="text">
    

    to
    <input name="recipient" id="EmailAddress2" type="text">
    

    try that, then use the form by filling in your own email address and see if you get an email!
    If not, post back here saying what heppend.
    I hope its right, its very early and im still half asleep!!!!


  • Registered Users, Registered Users 2 Posts: 3,061 ✭✭✭sticker


    Thanks ianhobo...

    Although the client is now telling me:

    The 'parts request' mail is now arriving at my personal e-mail and no sign of the 'auto reply'


    I'm not familiar with coding - I'm happy to give temporary ftp access to remedy this problem...


  • Registered Users, Registered Users 2 Posts: 413 ✭✭ianhobo


    hmmm ok , i may have got that wrong! can make ftp connections from my location at the moment,
    so I the mean time just undo those last changes, at least that was half working


  • Registered Users, Registered Users 2 Posts: 413 ✭✭ianhobo


    ianhobo wrote: »
    hey,
    yep, your sending it to yourself

    Your supposed to be, well to summerhillsspares email address :) sorry :(


  • Advertisement
Advertisement