Specifications
FIGURE 14.2
When users enter incorrect details, we need to give them an error message. On a real site, you might want to give a
somewhat friendlier message.
If these parameters are present and correct, it will display the secret content. Our test content is
shown in Figure 14.3.
E-commerce and Security
P
ART III
306
FIGURE 14.3
When provided with correct details, our script will display content.
The code to create the functionality shown in Figures 14.1, 14.2, and 14.3 is shown in
Listing 14.1.
LISTING 14.1 secret.php—PHP and HTML to Provide a Simple Authentication Mechanism
<?
if(!isset($name)&&!isset($password))
{
//Visitor needs to enter a name and password
?>
<h1>Please Log In</h1>
This page is secret.
18 7842 CH14 3/6/01 3:35 PM Page 306










