Are You Wasting Time?
I wasted about 3 years when I first started on the internet.
The first website I built was on free web hosting. Never got more than 2 visitors a day and never made a penny.
Then I tried a web host that I didn't know anything about. OOPS! A BIG mistake and another waste of valuable time. My website was down half the time and when I tried to leave they stole my domain name.
I don't want you to make the same mistakes I made. That's why I only recommend top quality, dependable web hosting providers.
I recommend 3 in different price ranges:
Yahoo SB $11.95 to $39.95
HostPapa

$5.95 to $7.95
CafW Hosting
$4.19 to $10.95
I recommend all 3 for quality and dependability.
|
CGI Scripts to Create a Website with Interactive Features
Post a Message to Board
This exercise includes an HTML form for posting a message, and a CGI script for processing the form. The HTML form should be saved in the htdocs directory. The CGI script should be saved in the cgi-bin directory.
message_brd.html
A simple HTML Form for adding a message to the board.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Message Board</title>
<meta name="DESCRIPTION" content="description of page">
<meta name="KEYWORDS" content="keywords, for, search engines">
<style type="text/css">
h2{font-family: Arial;font-style : normal ;font-size : 12pt; font-weight :bold;text-align :center }
h3{ font-family: Arial;font-style : normal ;font-size : 10pt; font-weight :bold;text-align :center}
form{ font-family: Arial;font-style : normal ;font-size : 10pt; font-weight :normal}
p{font-family: Arial;font-style : normal ;font-size : 10pt; font-weight :normal;text-align :center;padding-left : 3em;padding-right : 3em }
</style>
</head>
<body>
<div align="center">
<h2>Post New Message</h2>
<form method="GET" action="cgi-bin/post_message.pl" name="general_message">
Your Name: <input type="text" name="yourname" size="20">
Email: <input type="text" name="email" size="20"><br>
<br>
Subject: <input type="text" name="subject" size="40"><br>
<hr>
<h3>How to Post a Message</h3>
<p>Enter your message in the text box provided below. Do not use the return key. Some browsers interpret the return key as a click of the submit button. Click Submit when you are finished. If you want to receive responses by email, provide a valid email address above.</p>
<p>Enter Message</p>
<textarea name="message" cols="40" rows="8"></textarea>
<br>
<input type="submit" value="Submit"><input type="reset">
</div>
</form>
</body>
</html>
Try the Scripts
post_message.pl
This script parses the data entered on the form saves it to the message_board.txt file, reopens the file and displays the contents to the screen. Note: Some code added to parsing routine to remove illegal and unwanted characters from Query String.
#!/usr/bin/perl
#post_message.pl
$buffer=$ENV{'QUERY_STRING'};
$buffer =~ tr/+/ /;
$buffer =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
$buffer =~ s/<!--(.|\n)*-->/ /g;
$buffer =~ tr/\\|[|]|<|!|"|$|{|}|*|#|'|>|||;|%/ /;
@pairs = split(/&/,$buffer);
foreach $pair(@pairs){
($key,$value)=split(/=/,$pair);
$formdata{$key}.="$value";
}
$yourname=$formdata{'yourname'};
$email=$formdata{'email'};
$subject=$formdata{'subject'};
$message=$formdata{'message'};
open(INFO, ">>message_board.txt"); # Open for appending
print INFO "$yourname|$email|$subject|$message\n";
close (INFO);
open(INFO, "message_board.txt"); # Open db for reading and display
@array=<INFO>;
close (INFO);
print "Content-type:text/html\n\n"; #Follow with blank line
print "<html>\n";
print "<head><title>Message Board</title>\n";
print "<style type="text/css">\n";
print "h2\{font-family: Arial;font-style : normal ;font-size : 12pt; font-weight :bold;text-align :center\}\n";
print "td\{font-family: Arial;font-style : normal ;font-size : 10pt; font-weight :normal \}\n";
print "p\{ font-family: Arial;font-style : normal ;font-size : 10pt; font-weight :normal;text-align :left; width : 40em \}\n";
print "</style>\n";
print "</head>\n";
print "<body>\n";
print "<div align=\"center\">\n";
print "<h2>Message Board</h2>\n";
print "<table width=\"550\" cellpadding=\"5\" cellspacing=\"0\" border=\"1\">\n";
foreach $line (@array){
($yourname,$email,$subject,$message)=split(/\|/,$line);
print "<tr><td>\n";
print "Posted by: $yourname <a href="mailto:$email">Return Message by Email</a><br>\n";
print "Subject:$subject<br>\n";
print "<br>\n";
print "Message:<br>\n";
print "<p>$message</p>\n";
print "</td></tr>\n";
}
print "</table>\n";
print "<br><br>\n";
print "<a href=\"./message_brd.html\">Post a New Message</a>\n";
print "</div>\n";
print "</body>\n";
print "</html>\n";
|

Home
Free Websites
MoonFruit
LIVE JOURNAL
CalgaryPlanet
More websites
Free Website Builders
Web Hosting Services
Web Hosting FAQ
Recommended Web Hosts
|