2015-02-11 23:52:11 -05:00
|
|
|
<?php
|
2015-02-12 15:23:08 -05:00
|
|
|
session_start();
|
|
|
|
require_once("config.inc.php");
|
2015-02-20 05:16:28 -05:00
|
|
|
require_once($yaptc_inc . "functions.inc.php");
|
2015-02-12 15:23:08 -05:00
|
|
|
$yaptc_pagename = "Profile";
|
|
|
|
require_once($yaptc_inc . "header.inc.php");
|
|
|
|
require_once($yaptc_inc . "menu.inc.php");
|
2015-02-20 01:57:34 -05:00
|
|
|
if (getSessionStatus() == false):
|
2015-02-19 11:02:13 -05:00
|
|
|
killSession();
|
2015-02-20 01:57:34 -05:00
|
|
|
else:
|
|
|
|
//********** BEGIN CONTENT **********// ?>
|
2015-02-18 05:13:53 -05:00
|
|
|
|
2015-02-20 01:57:34 -05:00
|
|
|
<?php
|
|
|
|
require_once($yaptc_lib . "phpass-0.3/PasswordHash.php");
|
2015-02-18 05:13:53 -05:00
|
|
|
$query = "SELECT users.id, users.password, users.created, users.username, users.firstname, users.lastname, users.email, usertypes.typename AS usertype FROM users, usertypes WHERE users.id = :id";
|
2015-02-20 01:57:34 -05:00
|
|
|
$stmt = $yaptc_db->prepare($query);
|
2015-02-18 05:13:53 -05:00
|
|
|
$stmt->execute(array(':id' => $_SESSION['user_id']));
|
|
|
|
$user = $stmt->fetchObject();
|
|
|
|
?>
|
2015-02-20 01:57:34 -05:00
|
|
|
|
|
|
|
<?php if (isset($errors['update'])): ?>
|
|
|
|
<p class="error"><?php echo $errors['update']; ?></p>
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
<h2 class="content-subhead">Profile Information</h2>
|
2015-02-18 05:13:53 -05:00
|
|
|
<p>You may make changes to your user profile below if you wish. Updates will take effect immediately on pressing "Save".</p>
|
2015-02-20 01:57:34 -05:00
|
|
|
<p>PASSWORD CHANGE IS NOT CURRENTLY IMPLEMENTED</p>
|
|
|
|
<form class="pure-form pure-form-stacked" action="profile.php" method="post">
|
|
|
|
<fieldset id="update">
|
|
|
|
<div class="pure-g">
|
|
|
|
<div class="pure-u-1 pure-u-md-1-3">
|
2015-02-18 05:13:53 -05:00
|
|
|
<label for="username">Username</label>
|
|
|
|
<input type="text" name="username" maxlength="50" value="<?php echo $user->username; ?>" readonly>
|
|
|
|
<label for="created">Created</label>
|
|
|
|
<input type="text" name="created" value="<?php echo $user->created; ?>" readonly>
|
|
|
|
<label for="usertype">User Type</label>
|
|
|
|
<input type="text" name="usertype" maxlength="50" value="<?php echo $user->usertype; ?>" readonly>
|
|
|
|
</div>
|
2015-02-20 01:57:34 -05:00
|
|
|
<div class="pure-u-1 pure-u-md-1-3">
|
2015-02-18 05:13:53 -05:00
|
|
|
<label for="firstname">First Name</label>
|
|
|
|
<input type="text" name="firstname" maxlength="50" value="<?php echo $user->firstname; ?>">
|
|
|
|
<label for="lastname">Last Name</label>
|
|
|
|
<input type="text" name="lastname" maxlength="50" value="<?php echo $user->lastname; ?>">
|
|
|
|
<label for="email">Email</label>
|
|
|
|
<input type="text" name="email" maxlength="100" value="<?php echo $user->email; ?>">
|
|
|
|
</div>
|
2015-02-20 01:57:34 -05:00
|
|
|
<div class="pure-u-1 pure-u-md-1-3">
|
|
|
|
<label for="newpassword1">New Password</label>
|
|
|
|
<input type="password" name="newpassword1" maxlength="50" disabled>
|
|
|
|
<label for="newpassword2">Confirm Password</label>
|
|
|
|
<input type="password" name="newpassword2" maxlength="50" disabled>
|
|
|
|
<?php echo isset($errors['newpassword2']) ? $errors['newpassword2'] : ''; ?>
|
|
|
|
</div>
|
|
|
|
<div class="pure-controls pure-u-1">
|
|
|
|
<button type="submit" class="pure-input-1 pure-button button-success ">Save</button>
|
|
|
|
</div>
|
2015-02-18 05:13:53 -05:00
|
|
|
</div>
|
2015-02-20 01:57:34 -05:00
|
|
|
</fieldset>
|
|
|
|
</form>
|
2015-02-18 05:13:53 -05:00
|
|
|
|
|
|
|
<?php
|
2015-02-20 01:57:34 -05:00
|
|
|
if (!empty($_POST)):
|
|
|
|
if (empty($_POST['newpassword1']) && empty($_POST['newpassword2'])):
|
|
|
|
updateUserProfile($yaptc_db, $_SESSION['user_id'], $_POST['firstname'], $_POST['lastname'], $_POST['email'], $_POST['newpassword1'], $_POST['newpassword2']);
|
|
|
|
header('Location: ' . $_SERVER['PHP_SELF']);
|
|
|
|
elseif (!empty($_POST['newpassword1']) || !empty($_POST['newpassword2'])):
|
|
|
|
$errors['newpassword2'] = "New passwords do not match.";
|
|
|
|
elseif ($_POST['newpassword1'] != $_POST['newpassword2']):
|
|
|
|
$errors['newpassword2'] = "New passwords do not match.";
|
|
|
|
|
|
|
|
endif;
|
|
|
|
//otherwise what?
|
|
|
|
endif;
|
|
|
|
?>
|
2015-02-11 23:52:11 -05:00
|
|
|
|
2015-02-12 15:23:08 -05:00
|
|
|
|
|
|
|
|
2015-02-20 01:57:34 -05:00
|
|
|
<?php //********** END CONTENT **********//
|
|
|
|
endif;
|
2015-02-12 15:23:08 -05:00
|
|
|
require_once($yaptc_inc . "footer.inc.php");
|
2015-02-11 23:52:11 -05:00
|
|
|
?>
|