Help converting short php script to ASP

J

Johnny Carson

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");
?>
 
R

Ray at

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
 
J

Johnny Carson

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
 
R

Ray at

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
 
J

Johnny Carson

<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>

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...
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top