Source code:
<?php
include ('include_pet_fns.php');
// The shopping cart needs sessions, so start one
session_start();
// some session variables
$old_usera = $HTTP_SESSION_VARS['admin_user']; // store to test if they *were* logged in
$old_usern = $HTTP_SESSION_VARS['normal_user']; // store to test if they *were* logged in
//some $_GET variables
$logout = $_GET['logout'];
// some $_POST variables
$register = $_POST['register'];
$forgotten = $_POST['forgotten'];
$deleting = $_POST['deleting'];
$username = $_POST['username'];
$password = $_POST['password'];
$repassword = $_POST['repassword'];
$email = $_POST['email'];
$name = $_POST['name'];
$address = $_POST['address'];
$city = $_POST['city'];
$zip = $_POST['zip'];
$phone = $_POST['phone'];
$country = $_POST['country'];
// get species out of database
$sp_array = get_species();
if(isset($logout)) {
unset($HTTP_SESSION_VARS['admin_user']);
unset($HTTP_SESSION_VARS['normal_user']);
session_destroy();
}
if(isset($deleting)) {
unset($HTTP_SESSION_VARS['normal_user']);
session_destroy();
}
do_html_header();
/*
if (!get_magic_quotes_gpc()) {
echo '<b>You do not have magic qotes active!</b>';
} else {
echo '<b>Your magic quotes are active!</b>';
}
*/
// if filled out
echo '<div align="right">';
if(isset($register)) {
if(!filled_out($_POST)) {
echo '<b class="species"> You did not fill in all the fields, please try again. </b>';
} else if(!valid_email($email)) {
echo '<b class="species"> Your email is invalid. </b>';
} else if(!insert_users($_POST)) {
} else {
echo '<b class="species">Yor account was created. Thank you! </b><br />';
}
}
if(isset($forgotten)) {
$userloser = $_POST['userloser'];
$passwd = reset_password($userloser);
if(notify_password($userloser, $passwd)) {
echo '<b class="species">Your new password has been emailed to you.</b>';
} else {
echo '<b class="species">Your password could not be reset - please try again later.</b>';
}
}
if(isset($logout)) {
if (!empty($old_usera) || !empty($old_usern)){
echo '<b class="species">Logged out.</b><br />';
} else {
// if they weren't logged in but came to this page somehow
echo '<b class="species">You were not logged in, and so have not been logged out.</b><br />';
}
}
if(isset($deleting)) {
$theusername = $HTTP_POST_VARS['username'];
$thepassword = $HTTP_POST_VARS['repassword'];
if(delete_account($theusername, $thepassword)){
echo '<b class="species">The account was deleted.</b>';
} else {
echo '<b class="species">The account could not be deleted.</b>';
}
}
echo '</div>';
echo '<table border="0" cellspacing="0" cellpadding="0" width="750">';
echo '<tr>';
echo '<td style="padding-left:20px;padding-top:25px">';
echo '<img alt="Welcome (6K)" src="images/Welcome-back.gif" height="50" width="400" />';
echo '</td>';
echo '<td>';
// if logged in as admin, show add, delete, edit cat links
if(isset($_SESSION['normal_user'])) {
display_button('admin.php', 'admin-menu', 'Admin Menu');
}
if(check_logged_in()) {
if(isset($_SESSION['normal_user'])){
$user=$_SESSION['normal_user'];
} else if(isset($_SESSION['admin_user'])){
$user=$_SESSION['admin_user'];
}
echo "<h4>Hello ".output($user)."!</h4>";
} else {
display_button('register_form.php', 'get-an-account', 'Get an Account');
display_button('login.php', 'log-in', 'Login');
}
echo '</td>';
echo '</tr>';
echo '<tr>';
echo '<td valign="top" style="padding-left:20px;padding-top:25px" >';
echo '<img alt="garfieldHome1 (16K)" id="image1" align="top" src="images/garfieldHome1.gif" height="150" width="110" />';
echo '<p><b class="species">Garfield as Cato the Elder</b><br />Carthago delenda est. - Carthage must be destroyed. <br />Da mi basia mille, deinde centum, deinde mille altera, deinde centum. - GIve me a thousand kisses, then a hundred, then another thousand, then a second hundred.
Lugete, O Veneres Cupidinesque - Mourn, O Cupids and Venuses
Odi et amo! - I love and I hate!
Vivamus, mea Lesbia, atque amemus - Let us love, my Lesbia, and let us love</p>';
echo '</td>';
echo '<td>';
// display as links to sp pages
display_species($sp_array);
echo '</td>';
echo '</tr>';
echo '<tr>';
echo '<td valign="top" style="padding-left:20px;padding-top:25px">';
echo '<img alt="odie_cupidHome1 (5K)" id="image1" src="images/odie_cupidHome1.gif" height="150" width="165" />';
echo '<p><b class="species">Odie as Vergil</b><br />Arma virumque cano. - I sing of arms and a man.
Aspirat primo Fortuna labori. - Fortune favors upon one\'s first effort.
Audentes fortuna iuvat. - Fortune favors the bold.
Fama volat. - Rumor flies.
Fata viam invenient. - The Fates will find a way.
Labor omnia vincit. - Work overcomes all things.
Mirabile dictu. - Remarkable to say.
Ne cede malis. - May you not give way to evil things.
Non omnes possumus omnia. - We cannot all do everything.
Quidquid id est, timeo Danaos et dona ferentes. - Whatever it is, I fear Greeks bearing gifts.</p>';
echo '</td>';
echo '<td>';
echo '<b>Too much of a good thing is...</b>';
echo '<div align="center">';
echo '<a href="http://www.garfieldmovie.com" target="_blank">';
echo '<img alt="the movie" src="images/garfield_the_movie2.jpg" border="0" height="160" width="120" /></a>';
echo '</div>';
echo "<div align=\"right\"><b>... even better !</b></div>";
echo '</td>';
echo '</tr>';
echo '<tr>';
echo '<td> </td><td> </td>';
echo '</tr>';
echo '</table>';
do_html_footer();
?>