Results 1 to 3 of 3

Thread: Hide Email Address In img src

  1. #1
    Join Date
    Apr 2006
    Posts
    30
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Hide Email Address In img src

    I have an email address list that is dynamically genereated from an SQL Database. I want to write the address into a MAILTO: image using javascript, but can't figure out how to incorporate my ASP into the code.

    I am using the JS here http://javascript.internet.com/page-...ermeasure.html

    Here is my code but it doesn't work:

    Code:
    'receive value from DB
    <%= oRs.Fields("email") %>
    
    '=========================
    
    <script language="JavaScript"><!--
    
    // hide script
    <% Dim email as String
    email= oRs.Fields("email")
    if(email.IndexOf("@")>0){
    %>
        var sb_domain = "<%=email.Substring(email.IndexOf("@") + 1)%>";
        var sb_user = "<%=email.Substring(0, (email.IndexOf("@") + 1))%>";
        var sb_recipient = sb_user + sb_domain;
        var sb_url = "mailto:" + sb_recipient;
        document.write('<a href="'+sb_url+'"><img src="http://somesite.com/email1.jpg" border="0"/> </a>');
    <%}%> 
    // --></script>

    can someone help me write this, I getting loads of Microsoft VBScript errors. OR does anyone have a script that already functions?

    Thanks!!!!

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    This is silly. Using javascript to generate something means that the email is accessible to the user, just by looking at the source code.

    If you really wanted to hide it, create the image dynamically using PHP (not sure if ASP has a similar option, though one might exist) and then write the text onto that image.
    Just dynamically generating the SRC only creates javascript-dependance and doesn't really stop someone who wants to harvest the emails.
    If you'd like, I can write a PHP script (sorry, I don't know ASP) that would harvest them from your pages to give you an example.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Feb 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    djr33 it's sounds like you may have the solution to my problem.

    I am using a series of images on a page and I want to be able to hide the image source from a user if they view my source code.

    Can I do this?

    I don not want to hide / scramble my source code. I dont want to prevent right click or save images as.

    It's just that a user logs into my site. once logged in it displays their picture. If a user views source code and copies the image source path they can paste it into the address bar and change the url slightly and it will then display someone elses picture.

    eg <img src="http://www.site.com/folder1/folder2/$username.jpg"> in actual code, which becomes

    <img src="http://www.site.com/folder1/folder2/mickeymouse.jpg"> when viewing source code, cut and paste to address bar

    change to

    http://www.site.com/folder1/folder2/bettyboop.jpg and they can then see betty boops picture.

    so can I hide this somehow?

    Many thanks

    p.s Sorry for the post hijack.
    Last edited by Hip_Hip_Array; 03-02-2007 at 09:25 AM.

Bookmarks

Posting Permissions

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