Before moving on, a quick word about the "functions.php" file include()d in the script you just saw. "functions.php" is a separate file containing useful function definitions. Every time I write a function that might come in useful elsewhere in the application, I move it into "functions.php" and include that file in my script. An example of this is the validate_email() function used in the script above - here's what it looks like: Again, this is fairly simple - I'm using PHP's pattern matching capabilities to verify that the email address supplied conforms to the specified pattern. The function returns true or false depending on whether or not the match was successful.
blog comments powered by Disqus |