示例#1
0
require_once './contactDAO.php';
include 'header.php';
session_start();
session_regenerate_id(false);
?>

<div id="content" class="clearfix">
  <?php 
$websiteUser = new WebsiteUser();
echo 'Session ID: ' . session_id() . '<br>';
echo 'Admin ID: ' . $websiteUser->getInfo($_SESSION['username'], $_SESSION['password'])[0] . '<br>';
echo 'Last Login: '******'username'], $_SESSION['password'])[1] . '<br>';
//This section will display an HTML table containing all
//the customer in the mailingList table.
//
$contactDAO = new contactDAO();
$mailingList = $contactDAO->getContacts();
if ($mailingList) {
    //We only want to output the table if we have customer.
    //If there are none, this code will not run.
    echo '<div id="contactInfo">';
    echo '<table border=\'1\'>';
    echo '<tr><th>Customer ID</th><th>Name</th><th>Phone Number</th><th>Email</th><th>Referral</tr>';
    foreach ($mailingList as $contact) {
        echo '<tr>';
        echo '<td>' . $contact->getId() . '</td>';
        echo '<td>' . $contact->getName() . '</td>';
        echo '<td>' . $contact->getphone() . '</td>';
        echo '<td>' . $contact->getEmail() . '</td>';
        echo '<td>' . $contact->getRefer() . '</td>';
        echo '</tr>';
示例#2
0
                        <h2>Mailing Address</h2>
                        <h3>XXXX Woodroffe Ave<br>
                            Ottawa, ON K4C1A4</h3>
                        <h2>Phone Number</h2>
                        <h3>(613)XXX-XXXX</h3>
                        <h2>Fax Number</h2>
                        <h3>(613)XXX-XXXX</h3>
                        <h2>Email Address</h2>
                        <h3>info@wpeatery.com</h3>
                </aside>
                <div class="main">
                    <h1>Sign up for our newsletter</h1>
                    <p>Please fill out the following form to be kept up to date with news, specials, and promotions from the WP eatery!</p>
					 <?php 
try {
    $contactDAO = new contactDAO();
    //Tracks errors with the form fields
    $hasError = false;
    //Array for our error messages
    $errorMessages = array();
    //Ensure all four values are set.
    //They will only be set when the form is submitted.
    if (isset($_POST['customerName']) || isset($_POST['phoneNumber']) || isset($_POST['emailAddress']) || isset($_POST['referral'])) {
        if ($_POST['customerName'] == "") {
            $errorMessages['customerNameError'] = 'Please enter a customer name.';
            $hasError = true;
        }
        if (!is_numeric($_POST['phoneNumber']) || $_POST['phoneNumber'] == "") {
            $errorMessages['phoneNumberError'] = "Please enter a phone number.";
            $hasError = true;
        }