Friday, March 29, 2024

Goodies to Go ™
March 31, 2003– Newsletter #226


Goodies to Go ™
March 31, 2003–Newsletter #226

This newsletter is part of the internet.com network.
http://www.internet.com
 


Featured this week:

* Goodies Thoughts – Email Forms With
ASP

* Q & A Goodies
* News Goodies
* Goodies Peer Reviews

* Feedback Goodies  
* And Remember This

 


 

Goodies Announcement

Just in case you missed
it before, the new Beyond HTML Goodies book is now available!

 

Go beyond the basics
and learn how the pros add and use dynamic HTML features and advanced
JavaScript techniques. Beyond HTML Goodies demonstrates dozens of new and
different features readers can add to their existing Web pages using HTML and
JavaScript. The book starts with simple text and image tips, such as adding a
clock to a Web page or causing text to appear when the mouse moves over an
image. It gradually builds to more complex tricks, including manipulating forms
or working with cookies behind the scenes. Throughout the book, readers enjoy
Joe’s snappy style and “to the point” discussion of each “goody” in the book.

 

http://books.internet.com/books/0789727803

 

 


Goodies Thoughts
Email Forms With ASP



Last week I discussed ways to handle email forms using a couple of common
technologies. This week I present a solution using one more technology, namely
ASP. I have included a complete sample page with all code in place for you to
try out. In case you missed last week’s newsletter, you can find it in the
archive at http://www.htmlgoodies.com/letters/225.html This solution, being an
ASP solution, will only work for those of you who have your sites hosted on a
Microsoft platform.

First, let me add a little additional thought to the mix. I mentioned in the
introductory paragraph last week that email forms are frequently used to send
messages back to the webmaster and are sometimes used as a mechanism for
capturing data, bypassing the need for a local database. This is the point I’d
like to touch on again; it appears to have piqued the curiosity of more than a
few readers!

It is easy enough to imagine the kinds of data that can usefully be captured on
a form. "Tell me who you are", "tell me what you like", "tell me what I can do
for you", "tell me what you want from me"; these are all good examples. It is
very convenient to simply add this data to a local database, for whatever later
processing you have in mind, but it is not always that easy. Not every host will
make a database available to you, at least, not for free! If you could capture
the data another way, and get it back to your own computer where you could put
it into a database yourself, that might be a good workable solution.

If you format all the captured data into the body of an email and send it to
yourself, you could cut and paste the data either directly into a database
(depending on the capabilities of your database management system) or into a
text file for later import into your database (which almost every DBMS can do.)
Since you as the programmer are completely responsible for the format of your
email, you can determine how you need it to look. It’s also worth remembering
that when you capture your data in this way, your email box becomes a back-up
for your data!

This solution uses Microsoft’s Collaboration Data Objects (CDO) for NT Systems (CDONTS).
CDONTS is a library designed to enable SMTP (Simple Mail Transport Protocol —
email) messaging. It is usually installed on NT or W2K systems, but should it be
missing, it can be installed by adding the SMTP feature to the Internet
Information Services (IIS) on the server (your host will understand this – or at
least, they should!)

Here is the example:

<%@ Language=VBScript %>
<HTML>
<HEAD>
<%
Dim sEmailAddr, sMsg

On Error Resume Next

sEmailAddr = Request.Form("EmailAddress")
If Len(sEmailAddr) > 0 Then
If InStr(1,sEmailAddr,"@") > 0 Then
Call SendEmail
Else
sMsg = "Please enter a valid email address."
End If
End If
If Err.number <> 0 Then
sMsg = Err.Description
End If

Sub SendEmail()

Dim oMail

On Error Resume Next
Set oMail = Server.CreateObject("CDONTS.NewMail")
With oMail
.From = "Testing@TestDomain.com"
.To = sEmailAddr
.Subject = "Testing Website"
.Body = "This is only a test"
.Send
End With
Set oMail = Nothing

If Err.number <> 0 Then
sMsg = Err.Description
Err.Clear
End If

End Sub
%>
<Script Language="JavaScript">
<%If Len(sMsg) > 0 Then%>
window.alert("<%=sMsg%>");
<%End If%>
</Script>
</HEAD>
<BODY>

<form id="frmTest" name="frmTest" method="post" action="TestEmail.asp"> <P
align="center">
Enter your email address
<input id="EmailAddress" name="EmailAddress" type="text" size="30" maxlength="64"
value="<%=sEmailAddr%>">
<input id="btnSend" name="btnSend" type="submit" value="Send"> </P> </form>

<%If Len(sEmailAddr) > 0 And Len(sMsg) = 0 Then%>
<P align="center">
Your Email was sent successfully.
</P>
<%End If%>
</BODY>
</HTML>

That’s the whole thing! This one assumes it is in a file called "testemail.asp".
You can create a file with this name, copy it into a directory on your website
and try it out! If you choose to call the file something else, you will need to
change the action="TestEmail.asp" near the bottom to reflect the name you choose
(of course, it must end ".asp")

Around the middle, you see a line with :
.From = "Testing@TestDomain.com"
This is the address the email appears to be sent from. You can change this to ad
address suitable for your needs. It is also possible that your host’s email
service has some restrictions on the domain name that is used in this email
address. If you have doubt, or if you have problems, check with your hosting
company.

A full explanation of this code is far beyond the scope of this newsletter, but
if you read it carefully, you’ll probably get the idea of what it is doing. You
can get more information about ASP in our tutorials on
http://www.htmlgoodies.com 
Another way to exploit it is to first get it working on your site, then slowly
make changes to it, trying each change out to verify that it works, and slowly
evolving it into something you find useful.
 




Thanks for Reading!
– Vince Barnes


 

Top

Q & A Goodies


Questions are taken from submissions to our Community Mentors. You can ask a Mentor a question by going to

http://www.htmlgoodies.com/mentors
.



Q. I have created two pages one for high res and other for low
resolutions, and want to create a "splash" page that will show some content
while redirect the user to the correct resolution main page. This is the code
I4m using to redirects the user to the correct res page. I need to add a delay
of X seconds so the user can see the content of "splash" page before being
redirected. How can i do this?
<script>
<!–
if (screen.width<=640)
top.location.href="index640.html";
if (screen.width<=800)
top.location.href="index800.html";
if (screen.width<=1024)
top.location.href="index1024.html";
top.location.href="index1280.html";
//–>
</script>

A. You could use setTimeout() to perform a function to redirect after so
many milliseconds. Here is an example that will redirect to the specified link
after 2000 milliseconds (2 seconds):
<script>
<!–
function Redirect(linkid)
{
top.location.href=linkid
}
if (screen.width<=640)
setTimeout(‘Redirect("index640.html")’,2000);
if (screen.width<=800)
setTimeout(‘Redirect("index800.html")’,2000);
if (screen.width<=1024)
setTimeout(‘Redirect("index1024.html")’,2000)
top.location.href="index1280.html";
//–>
</script>

Q. (Re. Search Engine Submissions) I typically submit my sites using the
tool provided by my web host. That’s not because I want to, but more because I’m
confused by all the ‘services’ out there that offer site submission – from
$24.95/month to $500 one time fee for software that promises to submit, analyze
and everything else in between other than fixing my breakfast. Before spending
money on anything that I’m solicited to via email and ads on sites that I visit,
I wonder if anyone might have a suggestion on a site submission tool that is
really worth the money spent.

A. I am not a search engine/marketing guru be any means. I tell my
clients up front that I do not guarantee a good placement in any search engine.
There are people that do just website marketing and get paid very well. I do,
however use this site to submit the websites of my clients:
http://selfpromotion.com 
Another site I use for information is:
http://www.sitepoint.com 
It has a lot of information about web sites from coding to marketing. I don’t
know if you are interested in PPC (Pay Per Click) marketing, but I suggest you
take a look at
http://www.overture.com
  It has a really nice tool for seeing the
amount of times a certain keyword was searched for in the previous month. It may
help your META tags.
[There is a lot of information about all aspects of Search Engines, including a
submission service, at

http://www.searchenginewatch.com
  – Ed.]

Q. I saw a script on your site for random quotes. I’ve been searching
your site and the rest of the net for this script, but haven’t been able to find
it. I need a script where I can have 26 random quotes.

A. Its done with JavaScript here is a link to the code:

http://www.jsmadeeasy.com/javascripts/Messages/Random%20Life%20Quotes/

Q. I would like to set up a code that scans a directory on my computer
for all possible Mp3 files… (questioner also supplied a "work in progress"
JavaScript code snippet)


A. JavaScript will not read files or folders – it has no built in support
or third party support to do this. If you want to read the current contents of a
file or folder, you will need to use PHP or PERL for CGI. To use these, you will
have to setup something like IIS or Apache on your system and install support
for CGI. In either case the file in a ZIP file or tell the user to right click
and choose "Save target as…"

Q. I am using a simple dropdown box to select a page on my site:
<SELECT NAME="year">
<OPTION SELECTED>2002
<OPTION>1953
<OPTION>1954
<OPTION>1955
<OPTION>1956
etc…..
</SELECT>
what I want to do is have it go to the selected page (eg. 2002.htm) when an
option is selected. I would prefer a "Go" button when selection is made.

A. Just add the input tag with a submit button at the bottom of your
select box code:
<form>
<SELECT NAME="year">
<OPTION SELECTED>2002
<OPTION>1953
<OPTION>1954
<OPTION>1955
<OPTION>1956
etc…..
</SELECT>
<input type="submit" value="GO"></input>
</form>

 

 

 

 

Top

News Goodies


Stocks: A Weak End To The Week
[03/28/03 – 06:00 PM]
Stocks fell again Friday on fears of terrorism and a protracted
war in Iraq.

Click
here to read the article

 

Game Market Watch – The Gathering
[March 31, 2003] Jupitermedia’s inaugural gamer’s conference takes a deep
look into the crystal ball of the industry and sees nothing but dollar
signs.

Click
here to read the article

 




Red Hat Unveils 9
[March 31, 2003] The company releases Red Hat Linux 9, positioning it
as an ideal Linux platform for students, home computing and technology
enthusiasts.

Click here to read the article

 

 

 

Lawmaker Wants to Ax E-Rate Program
[March 31, 2003] Colorado congressman calls fee to provide discounted
Internet service to schools and libraries an ‘unfair, unauthorized’ tax.

Click here to read the article

 

 



Microsoft Beefs Up Wi-Fi Security in XP
[March 31, 2003] Microsoft releases a free XP download with support for
Wi-Fi Protected Access, an alternative to the WEP protocol.

Click here to read the article

 



 

Trial Date Nears in eBay Patent Case
[March 31, 2003] After a series of motions and hearings, the infringement
case filed by MercExchange appears likely to be aired in court; eBay’s 10-K
treats the potential outcome as a serious business risk.

Click here to read the article

 

 

AOL Launches Enhanced Broadband Service
[March 31, 2003] ISP launches new effort to coax more high-speed subscribers
over to its service by dangling a bundle of exclusive content, software
services and integrated messaging.

Click here to read the article

 

 

More Headaches for Sendmail
[March 31, 2003] A remotely exploitable vulnerability in the open source
message transfer agent leaves the Sendmail organization scrambling over the
weekend to prevent attacks on unpatched servers.

Click here to read the article

 

 

AOL May Have to Restate $400 Million
[March 29, 2003] More trouble out of AOL Time Warner’s online unit
related to how it accounted for advertising deals with media company
Bertelsmann.

Click here to read the article

 

 

 

Microsoft to Send Server 2003 to Manufacturers
[March 28, 2003] UPDATE: After delaying the product for more than a
year and a half, the company ships its new server operating system
to manufacturers.

Click here to read the article

 

 

 

 

Top


Goodies Peer Reviews


 

Every week a site selected each week for review. Each week,
reviews of the previous week’s selected site are chosen for
publication on the HTML Goodies website.

 

The current week’s selected site is published in Goodies To
Go and in the Peer Reviews section of the website. 
Current contact email addresses for submitting your site and
for submitting reviews are published in Goodies To Go.

If you would like to have your site reviewed, sign up for
the Goodies To Go newsletter in the Navigation Bar on the
left side of this page. 

For full details about this program, see

http://www.htmlgoodies.com/peerreviews

 

 

 

Top

Feedback
Goodies


Did you ever wish your newsletter was an easy two way communications medium?
Ploof! It now is!
If you would like to comment on the newsletter or expand/improve on something
you have seen in here, you can now send your input to:

mailto:nlfeedback@htmlgoodies.com

We already receive a lot of email every day. This address will help us sort out
those relating specifically to this newsletter from all the rest. When you send
email to this address it may wind up being included in this section of the
newsletter, to be shared with your fellow readers.
Please don’t send your questions to this address.
They should be sent to our mentors: see
http://www.htmlgoodies.com/mentors/

Iain Truskett wanted to respond to my reference to Matt’s
formmail.pl script. He (and a few other writers) expressed
concern because they know that there is a better version of
formmail.pl available from the nms project. I did mention
the concerns for the exploits of the script, which Matt also
recognizes, but I hadn’t realized that the latest version is
not available on his site – I try to give credit to the
actual (original) author wherever possible. Thanks to Iain
and to all who wrote in to point out the location of the
latest versions. To share the info, it’s at:

http://nms-cgi.sourceforge.net/

Matthew Dingley also wanted you to know that a PHP solution
is also possible. He has written a program that can help
with this. He as it on a website at

http://www.matthewdingley.co.uk/programs/contact/index.ph
 
— I’ve not tried it out myself, but I’m sure Matthew will
be happy to help you out if you need more info.

 

 

 

 

Top
And Remember This . . .

On this day in…

1889 Eiffel Tower Opens
Gustave Eiffel himself presided over the ceremony to
dedicate and open the famous Paris landmark. He designed the
tower as his entry (the winner, obviously) in a competition
for the design of a monument to commemorate the hundredth
anniversary of the French Revolution. Eiffel, a bridge
builder and master of metal construction, was also the
designer of the frame of the Statue of Liberty which had
been given to the United States and placed in the entrance
to New York Harbor. Twenty years later, the lease on the
land on which it stood expired and the tower was to be
dismantled. It was spared, however, only because it was
useful as a tower for radio antennas. It has remained almost
unchanged ever since.

Born today were: in 1735, the composer ("Father of
the Symphony") Franz Josef Haydn; 1935, band leader
and trumpet player Herb Alpert – and on the same day, actor
Richard Chamberlain; 1943, actor Christopher Walken;
1948, former US Vice President Al Gore and on the
same day, actress Rhea Perlman
 

 




Thanks for reading Goodies to Go!


 



Archive Home Page.


Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Popular Articles

Featured