Help converting short php script to ASP

Discussion in 'ASP General' started by Johnny Carson, Jul 21, 2003.

  1. I've got this PHP script working on one of my sites and
    now need an ASP version for my intranet.

    I don't know ASP, can anyone help out?

    Know of anyway to NOT have a blank browser window open
    when clicking on the link or even a better solution to
    prevent spam harvesters?


    <?
    // email.php
    // usage:
    //
    // <A HREF="email.php?to=me&domain=mydomain.com">E-Mail Me</a>-->
    //
    //

    if (!isset($to))
    //if(!isset($_GET['to']))
    {
    // $_GET['to'] = "info";
    $to = "info";
    }

    if(!isset($domain))
    {
    //$_GET['domain'] = "mydomain.com";
    $domain = "mydomain.com";
    }

    // $to = $_GET['to'];
    // $domain = $_GET['domain'];

    $email_address = $to."@".$domain;

    // send email header to page
    header ("Location: mailto:$email_address");
    ?>
     
    Johnny Carson, Jul 21, 2003
    #1
    1. Advertising

  2. Johnny Carson

    Ray at Guest

    Try something like:

    If IsEmpty(sTo) Then sTo = Request.Querystring("to")
    If IsEmpty(sDomain) Then sDomain = Request.Querystring("domain")
    sEmailAddress = sTo & "@" & sDomain
    Response.Redirect "mailto:" & sEmailAddress

    I didn't do it with the lines commented out the way that you have it,
    though. You have the querystring lines commented out in your PHP code.

    I don't know of any way to not have a blank browser window return. I
    understand your pain about trying to hide e-mail addresses from spam
    crawlers...

    Ray at work


    "Johnny Carson" <> wrote in message
    news:...
    > I've got this PHP script working on one of my sites and
    > now need an ASP version for my intranet.
    >
    > I don't know ASP, can anyone help out?
    >
    > Know of anyway to NOT have a blank browser window open
    > when clicking on the link or even a better solution to
    > prevent spam harvesters?
    >
    >
    > <?
    > // email.php
    > // usage:
    > //
    > // <A HREF="email.php?to=me&domain=mydomain.com">E-Mail Me</a>-->
    > //
    > //
    >
    > if (!isset($to))
    > //if(!isset($_GET['to']))
    > {
    > // $_GET['to'] = "info";
    > $to = "info";
    > }
    >
    > if(!isset($domain))
    > {
    > //$_GET['domain'] = "mydomain.com";
    > $domain = "mydomain.com";
    > }
    >
    > // $to = $_GET['to'];
    > // $domain = $_GET['domain'];
    >
    > $email_address = $to."@".$domain;
    >
    > // send email header to page
    > header ("Location: mailto:$email_address");
    > ?>
     
    Ray at, Jul 21, 2003
    #2
    1. Advertising

  3. >
    > If IsEmpty(sTo) Then sTo = Request.Querystring("to")
    > If IsEmpty(sDomain) Then sDomain = Request.Querystring("domain")
    > sEmailAddress = sTo & "@" & sDomain
    > Response.Redirect "mailto:" & sEmailAddress
    >
    > I didn't do it with the lines commented out the way that you have it,
    > though. You have the querystring lines commented out in your PHP code.
    >
    > I don't know of any way to not have a blank browser window return. I
    > understand your pain about trying to hide e-mail addresses from spam
    > crawlers...
    >

    <SNIP>

    Thanks, that worked as do all your tips/suggestions/solutions ;-)

    I've tried munging but they can now decode those.

    I'm still looking for a better way. If I find something better, I'll
    be sure to post it here for you.

    JC
     
    Johnny Carson, Jul 21, 2003
    #3
  4. Johnny Carson

    Ray at Guest

    He he... Thanks...

    Yeah, the whole spam thing really just sucks a lot. I think this is why
    more and more sites have feedback forms instead of mailto e-mail addresses.
    You'll see many sites that also have things like:

    E-mail us at ray AT mydomain DOT com

    But for a professional site, you can't really do any nonsense like that. I
    think you may be able to use a client side solution like this:

    <script language="javascript">
    window.open('mail'+'to:'+'person'+'@'+'domain'+'.com');
    </script>

    You could split up that string as much as you like or encrypt and decrypt,
    etc.

    Ray at work




    "Johnny Carson" <> wrote in message
    news:...
    > >
    > > If IsEmpty(sTo) Then sTo = Request.Querystring("to")
    > > If IsEmpty(sDomain) Then sDomain = Request.Querystring("domain")
    > > sEmailAddress = sTo & "@" & sDomain
    > > Response.Redirect "mailto:" & sEmailAddress
    > >
    > > I didn't do it with the lines commented out the way that you have it,
    > > though. You have the querystring lines commented out in your PHP code.
    > >
    > > I don't know of any way to not have a blank browser window return. I
    > > understand your pain about trying to hide e-mail addresses from spam
    > > crawlers...
    > >

    > <SNIP>
    >
    > Thanks, that worked as do all your tips/suggestions/solutions ;-)
    >
    > I've tried munging but they can now decode those.
    >
    > I'm still looking for a better way. If I find something better, I'll
    > be sure to post it here for you.
    >
    > JC
     
    Ray at, Jul 21, 2003
    #4
  5. <SNIP>
    > <html>
    > <head>
    > <script>
    > function mailLink(username, domain, comthingy)
    > {
    > var sMailTo="mailto:";
    > var sAddress=username + "@" + domain + "." + comthingy;
    > window.open(sMailTo + sAddress);
    >
    > }
    > </script>
    > </head>
    > <body>
    > <a href="#" onclick="mailLink('bob','something','com');">TEST</a>
    > </body>
    > </html>
    >
    >

    <SNIP>
    > > think you may be able to use a client side solution like this:
    > >
    > > <script language="javascript">
    > > window.open('mail'+'to:'+'person'+'@'+'domain'+'.com');
    > > </script>
    > >
    > > You could split up that string as much as you like or encrypt and decrypt,
    > > etc.


    Yes but this won't work for clients with js disabled. I DID find a good one in
    PHP from http://rsscripts.tripod.com/scripts/securemaill.htm called SecurEmailL
    Very cool. I'd like to see it converted to ASP...
     
    Johnny Carson, Jul 22, 2003
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David Geering

    longs, long longs, short short long ints . . . huh?!

    David Geering, Jan 8, 2007, in forum: C Programming
    Replies:
    15
    Views:
    581
    Keith Thompson
    Jan 11, 2007
  2. Replies:
    4
    Views:
    857
    Kaz Kylheku
    Oct 17, 2006
  3. Ioannis Vranos

    unsigned short, short literals

    Ioannis Vranos, Mar 4, 2008, in forum: C Programming
    Replies:
    5
    Views:
    718
    Eric Sosman
    Mar 5, 2008
  4. Rajive Narain
    Replies:
    0
    Views:
    2,014
    Rajive Narain
    Sep 18, 2009
  5. Andre
    Replies:
    5
    Views:
    556
    Keith Thompson
    Jul 17, 2012
Loading...

Share This Page