Make your own free website on

Personal info CV Services Scripts Search

Personal Info

About me, my sample sites and contact Information.

My Resume

Website Design
CGI scripts

Search my site

CGI scripts

Free scripts


New updated scripts!!

I've added a new subcribe script to my site. This script is really simple. It gets the email entered in to a form, writes it in to a text file on the server, and takes the user to a thank you page where the user proceeds browsing through the site. The script is shown below;

#!/usr/bin/perl             #Normal line for cgi scripts

$txt="data.txt";           #Specify location of text file

read(STDIN, $data, $ENV{'CONTENT_LENGTH'});           #get the input

# Split the name-value pairs

@pairs = split(/&/, $data);

foreach $pair (@pairs)
($name, $value) = split(/=/, $pair);

# Convert the HTML encoding $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s///g;

# Convert HTML stuff as necessary.
$value =~ s/<([^>]|\n)*>//g;
$FORM{$name} = $value;

# Verify that the required data has been received.

&missing_email unless $FORM{'Email'};

#write to the text file

open TXT, ">>$txt" or die "Cannot open $out for append :$!";

print TXT "\n\n\n";

foreach $x (keys %FORM) {

print TXT "$x: $FORM{$x}\n";

#say thanks and exit

print "<HTML><HEAD><TITLE>Thank you for your interest in my
print "<FONT SIZE=5 COLOR=#999900><B>Explore my
print "<BLOCKQUOTE>Thank you<B> $FORM{'FirstName'} </B>for your
interest!. Make sure you check out our newest collection of contemporary CD
collection online.....</BLOCKQUOTE>\n";


sub missing_email
print "<HTML><HEAD><TITLE>Missing Email</TITLE></HEAD>\n";
print "<FONT SIZE=5 COLOR=#999900><B>Email field is
print "<BR><BR>Please fill in your email address.<P>\n";
print 'Return to the <a href="../signup.htm">Sign up Form</a>.';
print "</BODY></HTML>\n";

The above script can be tested by using the subscribe tool in the home page. Click here to download the zipped file.

Reflector Script
This script actually does just that: It reflect's what a user enter's in to a form in to your web page. The code is really short.


$input=$ENV{'QUERY_STRING'};    #get the query string

@plus=split(/&/, $input);
foreach (@plus) {        #for each parameter
($name, $value) = split(/=/); #get the name and value
$name=~s/\+/ /g; #convert characters
$value=~s/\+/ /g;
#put them in %args }

#The heart of this short script

print "content-type:text/html\n\n";
foreach $x (keys %args) {
print "$x is $args{$x}\n
"; }

Click here to see it in action.

Hello Wolrld Script
My First script definately deserves a spot. Here the 3 line code:


print "Hello, World...\n";

That's it. My current world of CGI. Come back soon to download the best of CGI.


©Maina James Online. All rights reserved.