Databases Reference
In-Depth Information
echo "\n<h3>Gift editing page</h3>";
// Show the existing gifts for editing
showgiftsforedit($connection);
?>
</body>
</html>
Example A-5. index.php
<?php
// index.php: Show the user the login screen for the application, or
// log in a user with correct authentication details.
// Include database parameters and related functions
require_once("db.php");
// Connect to the MySQL DBMS and use the wedding database -
// credentials are in the file db.php
if(!($connection= @ mysqli_connect(
$DB_hostname, $DB_username, $DB_password, $DB_databasename)))
showerror($connection);
// Pre-process the authentication data from the form for security
// and assign the username and password to local variables
if(count($_POST))
{
$username = clean($_POST["username"], 30);
$password = clean($_POST["password"], 30);
}
// Pre-process the message data for security
if(count($_GET))
{
$message = clean($_GET["message"], 128);
}
// If no username or password has been entered, or there's a message
// to display, show the login page
if( empty($username) ||
empty($password) ||
isset($message) )
{
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Jack and Jill's Wedding Gift Registry</title>
</head>
<body bgcolor='LIGHTBLUE'>
<h2>Jack and Jill's Wedding Gift Registry</h2>
<?php
// If an error message is stored, show it...
if (isset($message))
echo "<h3><font color=\"red\">{$message}</font></h3>";
 
Search WWH ::




Custom Search