E-mail Revision to Matt's "Free for All" links page script.

The following script changes add a required E-mail field to the submit form and also reformat the database.txt file to make a "comma" or "pipe" delimited file.  The database revision is optional. First add a form field in your "links.html" named "email"

In the columns below on the left will be the original script code and the revised portions will be on the right with the additions marked in "RED".

Download a text version of this page. emailinks.txt

 
 

Original Script

Revised script

Add E-mail Field Section
# Goto line # 51 

if ($FORM{'url'} eq 'http://' || $FORM{'url'} !~ /^(/spacer.gif)tp:\/\/\w+\.\w+/) {  
   &no_url;  
 
if (!($FORM{'title'})) { 
   &no_title; 
} 
 

# Add the 'email' field 

if ($FORM{'url'} eq 'http://' || $FORM{'url'} !~ /^(/spacer.gif)tp:\/\/\w+\.\w+/) {  
   &no_url;  
 
if (!($FORM{'title'})) { 
   &no_title; 
} 
if (!($FORM{'email'})) { 
   &no_email; 
} 
 

Database Section
# Goto line 121 

if ($database ne '') { 
   (DATABASE,">>$database"); 
    print DATABASE "$FORM{'url'}\n"; 
    close(DATABASE); 
} 
 

Revise the database to save the URL, Title & E-mail address to a  
delimited file. I used a "pipe" instead of a "comma" because some Page titles have "commas" in them. 

if ($database ne '') { 
   (DATABASE,">>$database"); 
    print DATABASE "$FORM{'url'}"; 
 print DATABASE "|";  
    print DATABASE "$FORM{'title'}";  
    print DATABASE "|";  
    print DATABASE "$FORM{'email'}\n"; 
    close(DATABASE); 
} 
 

Subroutine Section
# Goto line 127 
 
 
 

sub no_url { 
   print "Content-type: text/html\n\n"; 
   print "<html><head><title>ERROR: No URL</title></head>\n"; 
   print "<body bgcolor=#FFFFFF text=#000000><center>"; 
   print "<h1>No URL</h1></center>\n"; 
   print "You forgot to enter a url you wanted added to the Free for ";   
   print "all link page.  Another possible problem was that your link "; 
   print "was invalid.<p>\n"; 
   print "<form method=POST action=\"$linkscgi\">\n"; 
   print "<input type=hidden name=\"title\" value=\"$FORM{'title'}\">\n"; 
   print "<input type=hidden name=\"section\"";  
   print "value=\"$FORM{'section'}\">\n"; 
   print "URL: <input type=text name=\"url\" size=50><p>\n"; 
   print "<input type=submit> * <input type=reset>\n"; 
   print "<hr>\n"; 
   print "<a href=\"$linksurl\">$linkstitle</a>\n"; 
   print "</form></body></html>\n"; 

   exit; 
} 
 
 
 

sub no_title { 
   print "Content-type: text/html\n\n"; 
   print "<html><head><title>ERROR: No Title</title></head>\n"; 
   print "<body bgcolor=#FFFFFF text=#000000><center>"; 
   print "<h1>No Title</h1></center>\n"; 
   print "You forgot to enter a title you wanted added to the Free for "; 
   print "all link page.  Another possible problem is that you title "; 
   print "contained illegal characters.<p>\n"; 
   print "<form method=POST action=\"$linkscgi\">\n"; 
   print "<input type=hidden name=\"url\" value=\"$FORM{'url'}\">\n";  
   print "<input type=hidden name=\"section\""; 
   print "value=\"$FORM{'section'}\">\n"; 
   print "TITLE: <input type=text name=\"title\" size=50><p>\n"; 
   print "<input type=submit> * <input type=reset>\n"; 
   print "<hr>\n"; 
   print "<a href=\"$linksurl\">$linkstitle</a>\n"; 
   print "</form></body></html>\n"; 

   exit; 
} 
 

revise the subroutines no_url & no_title to include the addition of the 'email' variable. 
Add a no_email subroutine. 

sub no_url { 
   print "Content-type: text/html\n\n"; 
   print "<html><head><title>ERROR: No URL</title></head>\n"; 
   print "<body bgcolor=#FFFFFF text=#000000><center>"; 
   print "<h1>No URL</h1></center>\n"; 
   print "You forgot to enter a url you wanted added to the Free for ";   
   print "all link page.  Another possible problem was that your link "; 
   print "was invalid.<p>\n"; 
   print "<form method=POST action=\"$linkscgi\">\n"; 
   print "<input type=hidden name=\"title\" value=\"$FORM{'title'}\">\n"; 
   print "<input type=hidden name=\"email\" value=\"$FORM{'email'}\">\n"; 
   print "<input type=hidden name=\"section\"";  
   print "value=\"$FORM{'section'}\">\n"; 
   print "URL: <input type=text name=\"url\" size=50><p>\n"; 
   print "<input type=submit> * <input type=reset>\n"; 
   print "<hr>\n"; 
   print "<a href=\"$linksurl\">$linkstitle</a>\n"; 
   print "</form></body></html>\n"; 

   exit; 
} 

sub no_title { 
   print "Content-type: text/html\n\n"; 
   print "<html><head><title>ERROR: No Title</title></head>\n"; 
   print "<body bgcolor=#FFFFFF text=#000000><center>"; 
   print "<h1>No Title</h1></center>\n"; 
   print "You forgot to enter a title you wanted added to the Free for "; 
   print "all link page.  Another possible problem is that you title "; 
   print "contained illegal characters.<p>\n"; 
   print "<form method=POST action=\"$linkscgi\">\n"; 
   print "<input type=hidden name=\"url\" value=\"$FORM{'url'}\">\n"; 
   print "<input type=hidden name=\"email\" value=\"$FORM{'email'}\">\n";   
   print "<input type=hidden name=\"section\""; 
   print "value=\"$FORM{'section'}\">\n"; 
   print "TITLE: <input type=text name=\"title\" size=50><p>\n"; 
   print "<input type=submit> * <input type=reset>\n"; 
   print "<hr>\n"; 
   print "<a href=\"$linksurl\">$linkstitle</a>\n"; 
   print "</form></body></html>\n"; 

   exit; 
} 

sub no_email { 
   print "Content-type: text/html\n\n"; 
   print "<html><head><title>ERROR: No E-mail</title></head>\n"; 
   print "<body bgcolor=#FFFFFF text=#000000><center>"; 
   print "<h1>No E-mail</h1></center>\n"; 
   print "You forgot to enter your E-mail address. "; 
   print "  Another possible problem is that you title "; 
   print "contained illegal characters.<p>\n"; 
   print "<form method=POST action=\"$linkscgi\">\n"; 
   print "<input type=hidden name=\"title\" value=\"$FORM{'title'}\">\n"; 
   print "<input type=hidden name=\"url\" value=\"$FORM{'url'}\">\n";  
   print "<input type=hidden name=\"section\""; 
   print "value=\"$FORM{'section'}\">\n"; 
   print "E-mail: <input type=text name=\"email\" size=50><p>\n"; 
   print "<input type=submit> * <input type=reset>\n"; 
   print "<hr>\n"; 
   print "<a href=\"$linksurl\">$linkstitle</a>\n"; 
   print "</form></body></html>\n"; 

   exit; 
} 
 

 You are free to copy and use these script revisions as you like.  I don't warrant them to do anything but take up disk space.  I know that they are working on sereral servers at this time.  If you have any questions or improvements to add, please contact me, Jan Morell at Icon Designs. The original script is available at Matt's Script Archive.

If you would care to add an acknowledgement on your links page, I would appreciate it.

Return to Icon Designs.


Counter Since 02/06/98

Beautiful Graphics for the Internet Community Created by Artmaker Studio. Sitemap home7 8 9 0 2