Posted on April 17th, 2010
1133 views The Signup ScriptIf you're used to writing database-driven Web sites, then the signupscript should seem pretty straightforward. First we need to write acouple of snippets of code that will perform common functions likeconnecting to the database that will store the usernames and passwordsfor the site. These snippets will take the form of PHP functions storedin include files. We'll use one include file to house database-relatedfunctions ( First, here's the code for
<SCRIPT language='JavaScript1.1'SRC="http://ad.doubleclick.net/adj/N4270.SitePoint/B4315639.30;abr=!ie;sz=300x250;ord=1270982822.82?"> </SCRIPT> <NOSCRIPT> <ahref="http://adscluster.aws.sitepoint.com/openx/www/delivery/ck.php?oaparams=2__bannerid=268__zoneid=6__cb=ba4d97113c__oadest=http%3A%2F%2Fad.doubleclick.net%2Fjump%2FN4270.SitePoint%2FB4315639.30%3Babr%3D%21ie4%3Babr%3D%21ie5%3Bsz%3D300x250%3Bord%3D%7Btimestamp%7D%3F"target="_top"> <IMGSRC="http://ad.doubleclick.net/ad/N4270.SitePoint/B4315639.30;abr=!ie4;abr=!ie5;sz=300x250;ord=1270982822.82?"BORDER=0 WIDTH=300 HEIGHT=250 ALT="Click Here"></A> </NOSCRIPT>
The The second include file,
We'll use this error function to tell the user when he or she hasdone something wrong. It takes an error message as an argument, and thendisplays it in a JavaScript pop-up message before backing up to theprevious page. This function ends the script that calls it with the With these boring details out of the way, you can now turn yourattention to the signup script (
This assumes that the files in question are available in the includepath. Consider, for example, the following include path, which I use inmy
On a Unix server, it might look like this:
In either case, you can choose to put your include files in the samedirectory as the file(s) that use them, or place them in a directorylisted in the include path. The latter choice is a safer for filescontaining sensitive information like passwords, because if the PHPsupport in your Web server ever fails, the information in PHP files notstored below your server's Web root directory will not be exposed toprying eyes. Next, the script checks for the presence of a
Pages:
1 2
|