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-25 16:01:50 -05:00
|
|
|
$yaptc_pagename = lang('ACCOUNT');
|
2016-02-04 14:18:34 -05:00
|
|
|
$yaptc_pageicon = '<i class="fa fa-cog"></i> ';
|
2015-02-12 15:23:08 -05:00
|
|
|
require_once($yaptc_inc . "header.inc.php");
|
2015-02-20 01:57:34 -05:00
|
|
|
if (getSessionStatus() == false):
|
2015-02-19 11:02:13 -05:00
|
|
|
killSession();
|
2015-02-24 10:37:52 -05:00
|
|
|
else: ?>
|
2015-02-25 16:01:50 -05:00
|
|
|
<!-- ********** BEGIN CONTENT ********** -->
|
2015-02-20 01:57:34 -05:00
|
|
|
<?php
|
2015-02-25 16:01:50 -05:00
|
|
|
if (isset($_POST['saveprofile'])):
|
2015-02-23 03:09:15 -05:00
|
|
|
if (empty($_POST['password']) && empty($_POST['newpassword2'])):
|
2017-05-11 13:22:44 -04:00
|
|
|
setUserInfo($yaptc_db, $session_user["0"]["userid"], $_POST['firstname'], $_POST['lastname'], $_POST['email'], $session_user["0"]["usertypeid"], $session_user["0"]["password"]);
|
2015-02-23 03:09:15 -05:00
|
|
|
header('Location: ' . $_SERVER['PHP_SELF']);
|
2015-02-24 10:37:52 -05:00
|
|
|
elseif (strlen($_POST['password']) < $yaptc_min_password):
|
|
|
|
echo "Password must be at least $yaptc_min_password characters.";
|
|
|
|
elseif (!empty($_POST['password']) && empty($_POST['newpassword2'])):
|
|
|
|
echo "Please confirm password if you wish to change it";
|
|
|
|
elseif ($_POST['password'] != $_POST['newpassword2']):
|
|
|
|
echo "New passwords do not match";
|
|
|
|
elseif (!empty($_POST['password']) && ($_POST['password'] = $_POST['newpassword2'])):
|
|
|
|
// change pw
|
2015-02-20 01:57:34 -05:00
|
|
|
require_once($yaptc_lib . "phpass-0.3/PasswordHash.php");
|
2015-02-23 03:09:15 -05:00
|
|
|
$hasher = new PasswordHash(8, FALSE);
|
|
|
|
$password = $hasher->HashPassword($_POST['password']);
|
2017-05-11 13:22:44 -04:00
|
|
|
setUserInfo($yaptc_db, $session_user["0"]["userid"], $_POST['firstname'], $_POST['lastname'], $_POST['email'], $session_user["0"]["usertypeid"], $password);
|
2015-02-23 03:09:15 -05:00
|
|
|
header('Location: ' . $_SERVER['PHP_SELF']);
|
2015-02-24 10:37:52 -05:00
|
|
|
endif;
|
2015-02-23 03:09:15 -05:00
|
|
|
endif;
|
2015-02-26 12:44:21 -05:00
|
|
|
|
|
|
|
// Set up pagination
|
|
|
|
$page_num = 1;
|
|
|
|
if(!empty($_GET['pnum'])):
|
|
|
|
$page_num = filter_input(INPUT_GET, 'pnum', FILTER_VALIDATE_INT);
|
|
|
|
if(false === $page_num):
|
|
|
|
$page_num = 1;
|
|
|
|
endif;
|
|
|
|
endif;
|
2017-05-11 13:22:44 -04:00
|
|
|
$offset = ($page_num - 1) * $yaptc_rowsperpage;
|
|
|
|
$row_count = count(listPunches($yaptc_db, $session_user["0"]["userid"]));
|
2015-02-26 12:44:21 -05:00
|
|
|
$page_count = 0;
|
2017-05-11 13:22:44 -04:00
|
|
|
if (0 === $row_count): else: $page_count = (int)ceil($row_count / $yaptc_rowsperpage); if($page_num > $page_count): $page_num = 1; endif; endif;
|
2015-02-23 03:09:15 -05:00
|
|
|
?>
|
|
|
|
|
2015-02-25 16:01:50 -05:00
|
|
|
<h2 class="content-subhead"><?php echo lang('ACCOUNT_INFO_HEADER'); ?></h2>
|
|
|
|
<p><?php echo lang('ACCOUNT_INFO_DESC') . $yaptc_min_password; ?></p>
|
|
|
|
<form class="pure-form pure-form-stacked" action="profile.php" method="post">
|
|
|
|
<fieldset>
|
|
|
|
<div class="pure-g">
|
|
|
|
<div class="pure-u-1 pure-u-md-1-3">
|
|
|
|
<label for="username"><?php echo lang('USERNAME'); ?></label>
|
|
|
|
<input type="text" name="username" id="username" maxlength="50" value="<?php echo $session_user["0"]["username"]; ?>" readonly />
|
|
|
|
<label for="created"><?php echo lang('CREATED'); ?></label>
|
|
|
|
<input type="text" name="created" id="created" value="<?php echo $session_user["0"]["created"]; ?>" readonly />
|
|
|
|
<label for="usertype"><?php echo lang('USERTYPE'); ?></label>
|
|
|
|
<input type="text" name="usertype" id="usertype" maxlength="50" value="<?php echo $session_user["0"]["usertype"]; ?>" readonly />
|
|
|
|
</div>
|
|
|
|
<div class="pure-u-1 pure-u-md-1-3">
|
|
|
|
<label for="firstname"><?php echo lang('FIRSTNAME'); ?></label>
|
|
|
|
<input type="text" name="firstname" id="firstname" maxlength="50" value="<?php echo $session_user["0"]["firstname"]; ?>" />
|
|
|
|
<label for="lastname"><?php echo lang('LASTNAME'); ?></label>
|
|
|
|
<input type="text" name="lastname" id="lastname" maxlength="50" value="<?php echo $session_user["0"]["lastname"]; ?>" />
|
|
|
|
<label for="email"><?php echo lang('EMAIL'); ?></label>
|
|
|
|
<input type="text" name="email" id="email" maxlength="100" value="<?php echo $session_user["0"]["email"]; ?>" />
|
|
|
|
</div>
|
|
|
|
<div class="pure-u-1 pure-u-md-1-3">
|
|
|
|
<label for="password"><?php echo lang('NEW') . " " . lang('PASSWORD'); ?></label>
|
|
|
|
<input type="password" name="password" id="password" />
|
|
|
|
<label for="newpassword2"><?php echo lang('CONFIRM') . " " . lang('NEW') . " " . lang('PASSWORD'); ?></label>
|
|
|
|
<input type="password" name="newpassword2" id="newpassword2" />
|
|
|
|
</div>
|
|
|
|
<div class="pure-controls pure-u-1">
|
|
|
|
<button type="submit" name="saveprofile" id="saveprofile" class="pure-input-1 pure-button button-success "><?php echo lang('SAVE'); ?></button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</fieldset>
|
|
|
|
</form>
|
|
|
|
<h2 class="content-subhead"><?php echo lang('PUNCH_HISTORY_HEADER'); ?></h2>
|
|
|
|
<p><?php echo lang('PUNCH_HISTORY_DESC'); ?></p>
|
2015-02-26 12:44:21 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<table class="pure-table pure-table-striped">
|
2015-02-25 16:01:50 -05:00
|
|
|
<thead>
|
2015-02-26 12:44:21 -05:00
|
|
|
<tr><th colspan="4"><?php echo lang('PAGE') . ": "; for ($i = 1; $i <= $page_count; $i++): if ($i === $page_num): echo $i . ' '; else: echo '<a href="' . $_SERVER['PHP_SELF'] . '?pnum=' . $i . '">' . $i . '</a> '; endif; endfor; ?></th></tr>
|
2015-02-25 16:01:50 -05:00
|
|
|
<tr><th><?php echo lang('IN') . " / " . lang('OUT'); ?></th><th><?php echo lang('HOURS'); ?></th><th><?php echo lang('FLAG'); ?></th><th><?php echo lang('NOTES'); ?></th></tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
2017-05-11 13:22:44 -04:00
|
|
|
<?php foreach (listPunches($yaptc_db, $session_user["0"]["userid"], $yaptc_rowsperpage, $offset) as $row): ?>
|
2015-02-25 16:01:50 -05:00
|
|
|
<tr>
|
|
|
|
<td><?php echo $row['intime'] . " / " . $row['outtime']; ?></td><td><?php echo $row['punchhours']; ?></td><td><?php echo $row['modified']; ?></td><td><?php echo $row['notes']; ?></td>
|
|
|
|
</tr>
|
|
|
|
<?php endforeach; ?>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
2015-02-23 03:09:15 -05:00
|
|
|
|
2015-02-25 16:01:50 -05:00
|
|
|
<!-- ********** END CONTENT ********** -->
|
2015-02-24 10:37:52 -05:00
|
|
|
<?php endif; require_once($yaptc_inc . "footer.inc.php"); ?>
|