473,396 Members | 2,158 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Help converting short php script to ASP

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");
?>
Jul 19 '05 #1
4 3635
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" <jc*****@tonightshow.com> wrote in message
news:MP************************@msnews.microsoft.c om...
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");
?>

Jul 19 '05 #2
>
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
Jul 19 '05 #3
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'+'.c om');
</script>

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

Ray at work


"Johnny Carson" <jc*****@tonightshow.com> wrote in message
news:MP************************@msnews.microsoft.c om...

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

Jul 19 '05 #4
<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'+'.c om');
</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...
Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jim Hubbard | last post by:
I have some C# code that is supposed to wrap the defrag APIs and I am trying to convert it to VB.Net (2003). But, I keep having problems. The C# code is relatively short, so I'll post it...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
17
by: VM | last post by:
In my Windows app, I'm running a batch process that's composed of a FOR loop that'll run 15,000 times (datatable row count), copy cthe data of each row -3 fields- to a struct, and send the strct to...
9
by: B Vidyadhar Joshi | last post by:
I have converted a few C++ structures to C# structures. However, when I use them in the code, I get errors in "internal static BluetoothDeviceInfo Create()". I feel I'm doing something wrong while...
4
by: kelli | last post by:
i am new to c# so if this is a trivial problem, forgive me! i've searched the web and after 2 days still cannot solve it. i am converting a c++ application to c# - the problem code is listed...
5
by: Rob Panosh | last post by:
Could somebody please assist me in converting the following C#.Net code to VB.Net code? private static extern short SQLAllocHandle(short hType, IntPtr inputHandle, out IntPtr outputHandle); ...
36
by: Cap'n Ahab | last post by:
I have used VB3 - VB6, so learning all this OO stuff is reasonably new to me (although I looked at Java a few years ago). Anyway, I thought I would write a small class to begin with, with a...
0
by: tomwolfstein | last post by:
Hi. I am trying to write a wrapper for the standard VC1 decoder, and I need to resolve a "TypeLoadException" The decoder comes an an executable which I've turned into a .dll. This decoder has about...
2
by: IdlePhaedrus | last post by:
Hi, I have a FFT routine that I converted from C++ to VB in a module as follows: Const M_PI = 3.1415926535897931 ' Fast Fourier Transform Public Sub FFT(ByRef rex() As Single, ByRef imx() As...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.