A Flash Developer Resource Site

Page 3 of 3 FirstFirst 123
Results 41 to 54 of 54

Thread: Add comment

  1. #41
    ? tonytryout's Avatar
    Join Date
    Oct 2001
    Location
    Somewhere out there
    Posts
    864
    Oh I see now!

    You could use a ASP function called HTTP_refereer, so your ASP code would look like this
    Code:
    <input name="source_page" type="hidden"  id="source_page" value="<%=Request.ServerVariables("HTTP_REFERER")%>">
    So you may have several pages but one form. Btw, I can't remember exactly what the format is displayed when you do a HTTP_REFERER (e.g. full address, filename, or..?).

  2. #42
    Senior Member littleMatt's Avatar
    Join Date
    Apr 2004
    Posts
    1,148
    It has all stopped working. I tested the form last night from my flat mates PC and the message still hasn't come through. The only thing that I can think of that I've done is added googleAnalytics. I didn't intend to, I just did a replace all on the folder. Not sure if that's it? What do you think?

    Code:
    <%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <%
    if (String(Request("send_email")) != "undefined") {
    
    var objName = String(Request.Form("Name"));
    var objEmail = String(Request.Form("Email"));
    var objsource_page = String(Request.Form("source_page"));
    var objComments = String(Request.Form("Comments")).replace(/\n/g,"<BR>");
    
    var mainBody = "Someone used the Comments form. The details are as follows:<BR>";
        mainBody = mainBody + "<BR><BR><b>Name:</b> " + objName
        mainBody = mainBody + "<BR><BR><b>Email:</b> " + objEmail
        mainBody = mainBody + "<BR><BR><b>source_page:</b> " + objsource_page
            mainBody = mainBody + "<BR><BR><b>Comments</b><BR><BR>" + String(Request.Form("Comments")).replace(/\n/g,"<BR>") + "</P><BR>";
    var endBody = mainBody + "<BR><BR>Powered by whatever";
    
    var objCDO = Server.CreateObject("CDONTS.NewMail");
    objCDO.To = "user@somedomain.com"
    objCDO.From = "website@somedomain.com"
    objCDO.Subject = "Comments"
    objCDO.Body = endBody
    objCDO.MailFormat = 0
    objCDO.BodyFormat = 0
    objCDO.Send()
    objCDO = null
    }
    %>
    <html>
    <head>
    <title>fish &amp; onions photography | all rights reserved</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
    <!--
    -->
    </style>
    <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
    </script>
    <script type="text/javascript">
    <!--
    _uacct="UA-xxxx-x";
    urchinTracker();
    
    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>
    <style type="text/css">
    <!--
    @import url("fishandonions.css");
    -->
    </style>
    </head>
    
    <body bgcolor="#CCCCCC" background="images/back.jpg" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('images/fenka.jpg')">
    <form action="comments.asp" method="post" name="frmComments" onSubmit="javascript:self.close()">
      <table width="400" height="100%" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td width="4" background="images/sides.jpg">&nbsp;</td>
          <td valign="top" bgcolor="#FFFFFF"><br> 
            <table width="100" height="100" align="center" cellpadding="0" cellspacing="0">
              <tr> 
                <td><div align="center"> 
                    <table width="350" align="center" cellpadding="0" cellspacing="0">
                      <tr> 
                        <td width="50"> <div align="center"> 
                            <p align="center"><span class="bodyCopy"><font color="#646466" face="Georgia, Times New Roman, Times, serif">name</font></span><br>
                              <input name="Name" type="text" id="Name2" size="26">
                              <input name="source_page" type="hidden"  id="source_page" value="<%=Request.ServerVariables("HTTP_REFERER")%>">
                            </p>
                          </div></td>
                      </tr>
                      <tr> 
                        <td height="50"> <div align="center"> 
                            <p align="center"><span class="bodyCopy"><font color="#646466" face="Georgia, Times New Roman, Times, serif">email 
                              address</font></span><br>
                              <input name="Email" type="text" id="Email" size="26">
                            </p>
                          </div></td>
                      </tr>
                      <tr> 
                        <td width="100"> <div align="center"> 
                            <p align="center"><span class="bodyCopy"><font color="#646466"><font face="Georgia, Times New Roman, Times, serif">comments</font></font></span><br>
                              <span class="bodyCopy">(please specify which image you're 
                              commenting on)</span><br>
                              <textarea name="Comments" cols="26" rows="4" wrap="PHYSICAL" id="Comments"></textarea>
                              <input name="send_email" type="hidden"  id="send_email" value="true">
                              <br>
                              <input type="submit" name="Submit" value="submit and close">
                            </p>
                          </div></td>
                      </tr>
                    </table>
                  </div>
                  <p align="center"> 
                    <input name="pageinfo" type="hidden"  id="pageinfo" value="Products page">
                  </p>
                  <p align="center">&nbsp; </p>
                  <p align="center" class="bodyCopy"><font color="#646466" face="Georgia, Times New Roman, Times, serif">thank 
                    you</font></p>
                  <p align="center" class="bodyCopy"><font color="#646466" face="Georgia, Times New Roman, Times, serif">comments 
                    may take some time to appear on the website.</font></p>
                  <p align="center">&nbsp;</p>
                  <p align="center" class="bodyCopy">made possible by, and with thanks 
                    to<font size="2">:<br>
                    <a href="http://www.fenka.co.uk" target="_blank" onMouseOver="MM_swapImage('Image1','','images/fenka.jpg',1)" onMouseOut="MM_swapImgRestore()"><img src="images/fenka.jpg" name="Image1" width="101" height="134" border="0"></a></font></p>
                  </td>
              </tr>
            </table>
          </td>
          <td width="4" background="images/sides.jpg">&nbsp;</td>
        </tr>
      </table>
    </form>
    </body>
    </html>

  3. #43
    ? tonytryout's Avatar
    Join Date
    Oct 2001
    Location
    Somewhere out there
    Posts
    864
    Can't see anything wrong and also tried your code on my site -- email sent to my hotmail account straight away.

    Ask your host for access to your email logs.

  4. #44
    Senior Member littleMatt's Avatar
    Join Date
    Apr 2004
    Posts
    1,148


    I've asked my host for the logs. So could it be my work mail server not letting them through for some reason? I don't have internet at home so I can't check there

  5. #45
    Senior Member littleMatt's Avatar
    Join Date
    Apr 2004
    Posts
    1,148
    Quote Originally Posted by tonytryout
    e -- email sent to my hotmail account straight away.
    did the source_page work by the way?

  6. #46
    ? tonytryout's Avatar
    Join Date
    Oct 2001
    Location
    Somewhere out there
    Posts
    864
    yep, source_page worked and it came out as "http://www.fenka.co.uk/try01.asp" in the email.

    It is possible that your work mail server blocked it but it worked the other day so it can't have been that?

  7. #47
    Senior Member littleMatt's Avatar
    Join Date
    Apr 2004
    Posts
    1,148
    It just wont work

    I've tried it with my work email, my hotmail and my yahoo addresses - and nothing. My IT manager doesn't think they're being blocked. My host doesn't know what's wrong with it...

    Tony giveth, God taketh away!

  8. #48
    ? tonytryout's Avatar
    Join Date
    Oct 2001
    Location
    Somewhere out there
    Posts
    864
    Mmmm, replace the value in the source_page hidden field (e.g. HTTP_REFERER) so it says "whatever", e.g.:
    Code:
    <input name="source_page" type="hidden"  id="source_page" value="hello">
    Try again and let me know what happens.

  9. #49
    Senior Member littleMatt's Avatar
    Join Date
    Apr 2004
    Posts
    1,148
    The guy that hosts my sight changed it around yesterday. Don't even know what he did or why the code that had worked stopped working, but it kinda works again. I can't get it to self close again though. There is this if statement in there:
    Code:
    ' send
    If NOT blnSpam Then
      oCdoMsg.send
      strResult = "Mail Sent."
    Else
      strResult = "Mail Not Sent."
    End If
    
    ' display message
    response.write strResult
    
    
    ' clear up
    set oCdoMsg = nothing
    set oCdoConfg = nothing
    
    
    end if
    Last edited by littleMatt; 12-07-2005 at 06:18 AM. Reason: littleMatt's a dumb arse!

  10. #50
    ? tonytryout's Avatar
    Join Date
    Oct 2001
    Location
    Somewhere out there
    Posts
    864
    That code can't have been working in the comments.asp page as you can't mix serverside VBScript and JavaScript versions on the same page.

    Can you paste the whole code for me.

  11. #51
    Senior Member littleMatt's Avatar
    Join Date
    Apr 2004
    Posts
    1,148
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <%
    IF Request("send_email") = "true" then
    
    dim objName
    objName = Request.Form("Name")
    dim objEmail
    objEmail = Request.Form("Email")
    dim objsource_page
    objsource_page = Request.Form("source_page")
    
    
    dim mainBody
    mainBody = "Someone used the Comments form. The details are as follows:<BR>"
    	mainBody = mainBody & "<BR><BR><b>Name:</b> " & objName
    	mainBody = mainBody & "<BR><BR><b>Email:</b> " & objEmail
    	mainBody = mainBody & "<BR><BR><b>source_page:</b> " & objsource_page
        mainBody = mainBody & "<BR><BR><b>Comments</b><BR><BR>" & Replace(Request.Form("Comments"), VbCrLf,"<BR>") & "</P><BR>"
    dim endBody
    endBody = mainBody + "<BR><BR>Powered by whatever"
    
    
    
    
    
    ' setup CDO
    dim oCdoMsg, oCdoConfg, strReferer, strServer, strClientIP, strServerIP, blnSpam
    set oCdoMsg = server.createobject("CDO.Message")
    strReferer = Request.servervariables("HTTP_REFERER")
    strServer = Replace(Request.servervariables("SERVER_NAME"), "www.", "")
    strClientIP = Request.servervariables("REMOTE_ADDR")
    strServerIP = Request.servervariables("LOCAL_ADDR")
    
    
    ' block spamming attempts
    intComp = inStr(strReferer, strServer)
    If intComp > 0 Then
        blnSpam = False
    Else
       ' Spam Attempt Block
        blnSpam = True
    End If
    
    ' set up email
    oCdoMsg.to = "matt@fishandonions.co.uk"
    oCdoMsg.from = "website@fishandonions.co.uk" ' use the .co.uk one as it is the primary domain
    oCdoMsg.Subject = "Comments"
    oCdoMsg.HTMLBody = endBody
    
    
    ' CDO CONFIG SECTION
    ' set up cdo config
    strMSSchema = "http://schemas.microsoft.com/cdo/configuration/"
    Set oCdoConfg = Server.CreateObject("CDO.Configuration")
    oCdoConfg.Fields.Item(strMSSchema & "sendusing") = 2
    oCdoConfg.Fields.Item(strMSSchema & "smtpserver") = "smtp." & strServer
    oCdoConfg.Fields.Update
    Set oCdoMsg.Configuration = oCdoConfg
    ' END OF CDO CONFIG SECTION
    
    
    
    
    ' send
    If NOT blnSpam Then
      oCdoMsg.send
      strResult = "Mail Sent."
    Else
      strResult = "Mail Not Sent."
    End If
    
    ' display message
    response.write strResult
    
    
    ' clear up
    set oCdoMsg = nothing
    set oCdoConfg = nothing
    
    
    end if
    
    %>
    <html>
    <head>
    <title>fish &amp; onions photography | all rights reserved</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
    <!--
    -->
    </style>
    <script src="http://www.google-analytics.com/urchin.js" 
    type="text/javascript">
    </script>
    <script type="text/javascript">
    <!--
    _uacct="UA-xxxx-x";
    urchinTracker();
    
    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>
    <style type="text/css">
    <!--
    @import url("fishandonions.css");
    -->
    </style>
    </head>
    
    <body bgcolor="#CCCCCC" background="images/back.jpg" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" 
    onLoad="MM_preloadImages('images/fenka.jpg')">
    <form action="comments.asp" method="post" name="frmComments">
      <table width="400" height="100%" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td width="4" background="images/sides.jpg">&nbsp;</td>
          <td valign="top" bgcolor="#FFFFFF"><br>
            <table width="100" height="100" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <td><div align="center">
                    <table width="350" align="center" cellpadding="0" cellspacing="0">
                      <tr>
                        <td width="50"> <div align="center">
                            <p align="center"><span class="bodyCopy"><font color="#646466" face="Georgia, Times New Roman, Times, serif">name</font></span><br>
                              <input name="Name" type="text" id="Name2" size="26">
    						  <input name="source_page" type="hidden"  id="source_page" value="<%=Request.ServerVariables("HTTP_REFERER")%>">
                            </p>
                          </div></td>
                      </tr>
                      <tr>
                        <td height="50"> <div align="center">
                            <p align="center"><span class="bodyCopy"><font color="#646466" face="Georgia, Times New Roman, Times, serif">email address</font></span><br>
                              <input name="Email" type="text" id="Email" size="26">
                            </p>
                          </div></td>
                      </tr>
                      <tr>
                        <td width="100"> <div align="center">
                            <p align="center"><span class="bodyCopy"><font color="#646466"><font face="Georgia, Times New Roman, Times, serif">comments</font></font></span><br>
                              <textarea name="Comments" cols="26" rows="4" wrap="PHYSICAL" id="Comments"></textarea>
                              <input name="send_email" type="hidden"  id="send_email" value="true">
                              <br>
                              <input type="submit" name="Submit" value="Submit">
                            </p>
                          </div></td>
                      </tr>
                    </table>
                  </div>
                  <p align="center"> 
                    <input name="pageinfo" type="hidden"  id="pageinfo" value="Products page">
                  </p>
                  <p align="center" class="bodyCopy"><font color="#646466" face="Georgia, Times New Roman, Times, serif">thank you</font></p>
                  <p align="center" class="bodyCopy"><font color="#646466" face="Georgia, Times New Roman, Times, serif">comments 
                    may take some time to appear on the website.</font><br>
                    please close this window after you have submitted.</p>
                  <p align="center">&nbsp;</p>
                  <p align="center" class="bodyCopy">made possible by, and with thanks
                    to<font size="2">:<br>
                    <a href="http://www.fenka.co.uk" target="_blank" 
    onMouseOver="MM_swapImage('Image1','','images/fenka.jpg',1)" 
    onMouseOut="MM_swapImgRestore()"><img src="images/fenka.jpg" name="Image1" 
    width="101" height="134" border="0"></a></font></p>
                  </td>
              </tr>
            </table>
          </td>
          <td width="4" background="images/sides.jpg">&nbsp;</td>
        </tr>
      </table>
    </form>
    </body>
    </html>
    He thinks it's something to do with windows 2003 preferring CDO over CDONTS...?

  12. #52
    ? tonytryout's Avatar
    Join Date
    Oct 2001
    Location
    Somewhere out there
    Posts
    864
    well it is recommended that we start using CDOSYS instead of CDONTS (going absolute) but as I don't have Windows 2003, I didn't realise it was that soon!

    but then again why did it work in the first place?

  13. #53
    Senior Member littleMatt's Avatar
    Join Date
    Apr 2004
    Posts
    1,148
    Quote Originally Posted by tonytryout
    but then again why did it work in the first place?
    f00ked if I know lol

    He did say he was surprised it did work the first time. It's all foreign to me though, hats off to people that can put code together

  14. #54
    ? tonytryout's Avatar
    Join Date
    Oct 2001
    Location
    Somewhere out there
    Posts
    864
    at least it works now!

    btw, just seen your site -- you sure have an eye for design -- would you be interested in colloborating? either PM or email me.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center