www.webdeveloper.com
Page 2 of 2 FirstFirst 12
Results 16 to 24 of 24

Thread: help using a javascript fuction to hide email in a form

  1. #16
    Join Date
    Mar 2012
    Posts
    202
    Kind of straying away from the topic of JavaScript, but hopefully nobody minds. I think you'll want to look at this page. Only problem I could foresee is that the HTTP_REFERER header isn't always reliable (depends on the client's browser). Are you able to make use of PHP or another server-side language? If so, I'll gladly help if you want to post a new thread in the appropriate forum topic.

  2. #17
    Join Date
    Jun 2004
    Location
    Tampa, Florida
    Posts
    77
    I am able to use PHP, excpt for one little issue.. I never have composed PHP myself, having done nothing bust static sites for such a long time. In fact i did start a thread about my less than ideal Form mail situation, which is apparently due to an issue with the PHP code my hosting company provides me. That thread is here... http://www.webdeveloper.com/forum/sh...deal-form-mail

    That issue is even more important to me, because that deal with my form email, which I'm, sure will get used far more often than my alternate (non scriptable ) email. And I think some help there would educate me a LOT more about actually using PHP, and maybe set me on my way to being able to write my own. For the alternate, I'm content using the HTTP_REFERRER and my easily changeable email forwarder address. But I'm still having trouble understanding the RIGHT syntax to make that variable work for me.
    Randy (PeterPan)
    * * *
    * *
    ... Second Star to the Right, and Straight on Till Morning!
    * * *

  3. #18
    Join Date
    Mar 2012
    Posts
    202
    You'll be way better off using PHP for this task, as PHP not only allows you to completely hide the email you're sending to (doesn't get sent to the client at all), but will also overcome any cross-domain referencing issues (aka "Same-origin policy") which I can see as possibly being problematic in this case. My next reply will be in the existing thread that you've just provided a link to. I'll need you to check if you have cURL installed and operational on your server, as hopefully that's what we'll be utilizing with the PHP code. If you do have cURL capabilities, kindly let me know either through a PM or just reply here. Thanks!
    Last edited by Gray1989; 01-10-2014 at 11:56 AM.

  4. #19
    Join Date
    Jun 2004
    Location
    Tampa, Florida
    Posts
    77
    OK... i think I've got this HTTP_REFERER thing working. maybe some of you could test for me? The first test is very easy. Just point your browser to

    http://elfintechnologies.com/private/mailpage2.html

    It should display a 404 error, which is currently handled by wordpress for now.

    If you want to help me test further, its more of a pain, but if its not too much trouble turn javascript OFF (since the page is meant to be accessed only when javascript is not available) then go to http://elfintechnologies.com/testpage004.html and click the CONTACT link on the right side of my top menu. If javascript is ON, you'll get a page with form-mail. If javascript is OFF, now you should see the "mailpage2.html" page that was hidden before.


    Since I've been warned that HTTP_REFERER is browser dependent, if you don't get the 404 for the first test, please let me know what browser you used. I do know that once you do the second test, you won't be able to do the first one again in some browsers because the "refere" is now in your cache. But I can live with that! :-)
    Randy (PeterPan)
    * * *
    * *
    ... Second Star to the Right, and Straight on Till Morning!
    * * *

  5. #20
    Join Date
    Mar 2012
    Posts
    202
    Everything seems to work as expected!

  6. #21
    Join Date
    Jun 2004
    Location
    Tampa, Florida
    Posts
    77
    Quote Originally Posted by Gray1989 View Post
    I'll need you to check if you have cURL installed and operational on your server, as hopefully that's what we'll be utilizing with the PHP code. If you do have cURL capabilities, kindly let me know either through a PM or just reply here. Thanks!
    I don't think I do. I couldn't find it in my Cpanel, and when I plugged "curl into the company site's (hostmonster.com) search, it came up dry.

    I'm really getting sick of hostmonster. Its not a FREE host, its support is in the toilet, and its help agents don't have a clue about anything. Anyway, as i said... if I do use any scripting right now, it will be to help with that form mail proble, Please look at that thread, at http://www.webdeveloper.com/forum/sh...deal-form-mail Maybe there's some way i can download the PHP that handles the form (apparently at http://www.hostmonster.com/monstermail ), and maybe I'll be able to fix it and install my own copy, in my cgi-bin directory. Or maybe it will be easier to just find another form mail script that already works, and doesn't have the problems I described with losing text line breaks.
    Randy (PeterPan)
    * * *
    * *
    ... Second Star to the Right, and Straight on Till Morning!
    * * *

  7. #22
    Join Date
    Jun 2004
    Location
    Tampa, Florida
    Posts
    77
    @Gray1989 Thanks a heap! I did none to prevent hot links to my graphics too. I need to get my brain back into gear with this and other .htaccess features I haven't messed with in ages.
    Randy (PeterPan)
    * * *
    * *
    ... Second Star to the Right, and Straight on Till Morning!
    * * *

  8. #23
    Join Date
    Mar 2012
    Posts
    202
    No problem, I replied in the thread you linked (http://www.webdeveloper.com/forum/sh...deal-form-mail), you can test out the script I made. Hopefully you have cURL and it works for you. You use it in the exact same way you use your existing form mailer, just omit the "sendtoemail" variable and make sure that you change the email "myemail@mydomain.com" to the correct one. Let me know if you have any issues.

  9. #24
    Join Date
    Mar 2012
    Posts
    202
    I use HostGator by the way, I really like their service and support. It is, however, the only hosting company that I have any experience with. If you're looking to switch it up, they're definitely not a bad choice. Probably not the cheapest option to go with but I'm definitely happy.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles