PLEASE note: These pages are here solely for historic purposes. New articles have not been written since 2001; many links in the index are broken; and most ahref.com email addresses will now bounce. Try visiting ep Productions, Incorporated, the web programming and development company behind this site.

Tip: Having problems with this site? Please report them to the webmaster.

web index ahref.com: a community space for web developers------ -----
IndexToolsCareersTalk
ahref.com > Guides > Technology

Technology Guide

Building a Site Submission Program, Continued

Input Validation

In lines 24-35, the program does some basic checking on the URL and email address which were passed in. If either does not pass the test, it assigns an error message to the variable $output_string, shows that output, and exits the program. For the URL, the program checks to make sure that it starts with "http://". A stricter program might actually try to access the URL, and generate an error if the page is inaccessible. For the email address, the program checks for an @ sign in the address.

 24 if ($input_url !~ /^http:\/\//) {
 25   $output_string = "<BLOCKQUOTE><H3>Invalid URL</H3>\n";
 26   $output_string .= "<P>You input an invalid URL - try again!</BLOCKQUOTE>";
 27   &show_output ($output_string);
 28   exit;
 29 }
 30 if ($input_email !~ /@/) {
 31   $output_string = "<BLOCKQUOTE><H3>Invalid Email Address</H3>\n";
 32   $output_string .= "<P>You input an invalid email address - try again!</BLOCKQUOTE>";
 33   &show_output ($output_string);
 34   exit;
 35 }
continue reading >>>
or jump to a topic:

Introduction
Preliminaries
Input Validation
Defining the Search Engines
More Variable Setup
Making the Submissions
Finishing Up
Things to Keep in Mind


view a printable version of this article


To suggest a topic, please email guides@ahref.com.

 


HOME ||| ABOUT AHREF.COM ||| ADVERTISE ||| FEEDBACK ||| SEARCH THIS SITE ||| CONTRIBUTE

© 1998-1999 ep Productions, Inc. All rights reserved. Terms of use.