topical media & game development
professional-sql-01-public-files-forgotpass.php / php
<?php
// include shared code
include '../lib/common.php';
include '../lib/db.php';
include '../lib/functions.php';
include '../lib/User.php';
// construct password request form HTML
ob_start();
?>
<form action="<?php echo htmlspecialchars(_POST['username']))
echo htmlspecialchars(form = ob_get_clean();
// show the form if this is the first time the page is viewed
if (!isset(GLOBALS['TEMPLATE']['content'] = _POST['username']))
{
_POST['username']);
if (!GLOBALS['TEMPLATE']['content'] = '<p><strong>Sorry, that ' .
'account does not exist.</strong></p> <p>Please try a ' .
'different username.</p>';
form;
}
else
{
// generate new password
message = 'Your new password is: ' . user->emailAddr, 'New password', GLOBALS['TEMPLATE']['content'] = '<p><strong>A new ' .
'password has been emailed to you.</strong></p>';
// store the new password
password;
GLOBALS['TEMPLATE']['content'] .= '<p><strong>You did not ' .
'provide a valid username.</strong></p> <p>Please try ' .
'again.</p>';
form;
}
}
// display the page
include '../templates/template-page.php';
?>
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.