professional-sql-01-public-files-main.php / php
<?php // include shared code include '../lib/common.php'; include '../lib/db.php'; include '../lib/functions.php'; include '../lib/User.php'; // 401 file referenced since user should be logged in to view this page //include '401.php'; // generate user information form <form action="<?php echo htmlspecialchars(_SERVER['PHP_SELF']); ?>" method="post"> <table> <tr> <td><label>Username</label></td> <td><input type="text" name="username" disabled="disabled" readonly="readonly"value="<?php echo </td> </tr><tr> <td><label for="email">Email Address</label></td> <td><input type="text" name="email" id="email" value="<?php echo (isset(_POST['email']))? htmlspecialchars( user->emailAddr; ?>"/></td> </tr><tr> <td><label for="password">New Password</label></td> <td><input type="password" name="password1" id="password1"/></td> </tr><tr> <td><label for="password2">Password Again</label></td> <td><input type="password" name="password2" id="password2"/></td> </tr><tr> <td> </td> <td><input type="submit" value="Save"/></td> <td><input type="hidden" name="submitted" value="1"/></td> </tr><tr> </table> </form> <?php GLOBALS['TEMPLATE']['content'] = // show the form if this is the first time the page is viewed if (!isset(_POST['submitted'])) { form; } // otherwise process incoming data else { // validate password _POST['password1']) && _POST['password1']) : password2 = (isset(_POST['password2']) ? sha1(user->password; password1 == password1 : ''; // update the record if the input validates if (User::validateEmailAddr(password) { _POST['email']; password; GLOBALS['TEMPLATE']['content'] = '<p><strong>Information ' . 'in your record has been updated.</strong></p>'; } // there was invalid data else { <p><strong>You provided some ' . 'invalid data.</strong></p>'; GLOBALS['TEMPLATE']['content'] .= // 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.