Rev 121 | Rev 124 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?php
// Include Session Handling
require_once ('includes/session.php');
// Include config & login validate file
require_once 'includes/validateUser.php';
if (isset($_SESSION['sessData']['field_error'])) {
// Get form field error from session
$fieldError = $_SESSION['sessData']['field_error'];
// Remove field error data from session
unset($_SESSION['field_error']['sessData']);
}
?>
<!DOCTYPE html>
<html lang="en-US">
<head>
<!--head-->
<?php include_once 'elements/head.php'; ?>
<!--//head-->
</head>
<body>
<div class="main">
<!--header-->
<?php include_once 'elements/header.php'; ?>
<!--//header-->
<!--main-->
<div class="main-content">
<div class="wrapper-frm bg-light text-dark border shadow">
<div class="head-menu bg-primary menu-tle">
<h1>Edit Account</h1> </div>
<form action="<?php echo BASE_URL; ?>userAccount.php" method="post" enctype="multipart/form-data">
<div class="ucontent">
<div class="left-pnl"> <img class="img-fluid upicture" src="<?php echo $userPicture; ?>" alt="<?php echo $userName; ?>" />
<h2><?php echo $userName; ?></h2> </div>
<div class="right-pnl">
<?php echo !empty($statusMsg) ? '<p class="status-msg ' . $statusMsgType . '">' . $statusMsg . '</p>' : ''; ?>
<input type="hidden" name="sessionTab" value="<?php if (isset($_POST['sessionTab'])) echo $_POST['sessionTab']; ?>" />
<input type="hidden" name="searchTerm" value="<?php if (isset($_POST['searchTerm'])) echo $_POST['searchTerm']; ?>" />
<input type="hidden" name="nonce" value="<?php if (isset($_SESSION['nonce'])) echo $_SESSION['nonce']; ?>" />
<div class="custom-file frm-input">
<input type="file" class="custom-file-input file-in border" id="customFile" name="picture" />
<label class="custom-file-label" for="customFile"><img src="assets/images/uimg.png" alt="Default User Image" /> Optional user image</label>
</div>
<div class="frm-input <?php echo !empty($fieldError['first_name']) ? 'error' : ''; ?>">
<input type="text" name="first_name" class="user-in" placeholder="First name" aria-label="First Name" value="<?php echo !empty($userData['first_name']) ? $userData['first_name'] : ''; ?>" required="" />
<?php echo !empty($fieldError['first_name']) ? '<p>' . $fieldError['first_name'] . '</p>' : ''; ?>
</div>
<div class="frm-input <?php echo !empty($fieldError['last_name']) ? 'error' : ''; ?>">
<input type="text" name="last_name" class="user-in" placeholder="Last name" aria-label="Last Name" value="<?php echo !empty($userData['last_name']) ? $userData['last_name'] : ''; ?>" />
<?php echo !empty($fieldError['last_name']) ? '<p>' . $fieldError['last_name'] . '</p>' : ''; ?>
</div>
<div class="frm-input <?php echo !empty($sessData['field_error']['email']) ? 'error' : ''; ?>">
<input type="email" name="email" class="email-in" placeholder="Email" aria-label="Email Address" value="<?php echo !empty($userData['email']) ? $userData['email'] : ''; ?>" required="" />
<?php echo !empty($fieldError['email']) ? '<p>' . $fieldError['email'] . '</p>' : ''; ?>
</div>
<div class="frm-input">
<input type="text" name="zip" class="addr-in" placeholder="Zip" aria-label="Zip Code" value="<?php echo !empty($userData['zip']) ? $userData['zip'] : ''; ?>" /> </div>
</div>
</div>
<div class="clearfix"></div>
<div class="bg-dark text-light menu-tle my-3">
<h3>Layout</h3> </div>
<div class="text-center m-2">
<label>Color Theme:</label>
<select class="form-control" id="theme" name="theme" aria-label="Select color theme">
<?php
$themes = scandir("../css");
foreach ($themes as $themeLong) {
$themeLong = strtolower($themeLong);
if (strpos($themeLong, "theme-") === 0) {
$theme = substr($themeLong, 6, strpos($themeLong, '.') - 6);
echo "<option";
if (!empty($userData['theme']) && $userData['theme'] == $theme) {
echo " selected";
}
echo ">";
echo ucwords($theme);
echo "</option>";
}
}
?>
</select>
<div class="mt-3"> <span class="pr-2">Result View:</span>
<div class="form-check-inline">
<label class="form-check-label">
<input type="radio" class="form-check-input" name="cardView" value="0" <?php echo $userData['cardView'] ? "" : "checked"; ?> />Table </label>
</div>
<div class="form-check-inline">
<label class="form-check-label">
<input type="radio" class="form-check-input" name="cardView" value="1" <?php echo $userData['cardView'] ? "checked" : ""; ?> />Cards </label>
</div>
</div>
</div>
<div class="bg-dark text-light menu-tle my-3">
<h3>Search Filter Preferences</h3> </div>
<div class="card-group">
<div class="card m-2">
<div class="card-header font-weight-bold">Condition</div>
<div class="card-body ac-info">
<div class="form-check">
<label class="form-check-label">
<input name="filterConditionNew" type="checkbox" class="form-check-input" value="New" <?php echo ($userData["conditionNew"] ? "checked" : ""); ?> />New </label>
</div>
<div class="form-check">
<label class="form-check-label">
<input name="filterConditionUsed" type="checkbox" class="form-check-input" value="Used" <?php echo ($userData["conditionUsed"] ? "checked" : ""); ?> />Used </label>
</div>
</div>
</div>
<div class="card m-2">
<div class="card-header font-weight-bold">Media Type</div>
<div class="card-body ac-info">
<div class="form-check">
<label class="form-check-label">
<input name="filterMediaTypeCD" type="checkbox" class="form-check-input" value="CD" <?php echo ($userData["mediaCD"] ? "checked" : ""); ?> /><i class="<?php echo getMediaIconClass("CD", "material-text"); ?>"><?php echo getMediaIconAlias("CD"); ?></i> <?php echo getMediaIconText("CD"); ?>
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input name="filterMediaTypeRecord" type="checkbox" class="form-check-input" value="Record" <?php echo ($userData["mediaRecord"] ? "checked" : ""); ?> /><i class="<?php echo getMediaIconClass("Record", "material-text"); ?>"><?php echo getMediaIconAlias("Record"); ?></i> <?php echo getMediaIconText("Record"); ?>
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input name="filterMediaTypeDigital" type="checkbox" class="form-check-input" value="Digital" <?php echo ($userData["mediaDigital"] ? "checked" : ""); ?> /><i class="<?php echo getMediaIconClass("Digital", "material-text"); ?>"><?php echo getMediaIconAlias("Digital"); ?></i> <?php echo getMediaIconText("Digital"); ?>
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input name="filterMediaTypeBook" type="checkbox" class="form-check-input" value="Books" <?php echo ($userData["mediaBook"] ? "checked" : ""); ?> /><i class="<?php echo getMediaIconClass("Book", "material-text"); ?>"><?php echo getMediaIconAlias("Book"); ?></i> <?php echo getMediaIconText("Book"); ?>
</label>
</div>
</div>
</div>
</div>
<div class="clearfix"></div>
<div class="bg-dark text-light menu-tle my-3">
<h3>Wishlist</h3> </div>
<div class="text-center m-2">
<div class="mt-3"> <span class="pr-2">Email Price Checks:</span>
<div class="form-check-inline">
<label class="form-check-label">
<input type="radio" class="form-check-input" name="wlEmail" value="1" <?php echo $userData['wlEmailFlag'] ? "checked" : ""; ?> />Yes </label>
</div>
<div class="form-check-inline">
<label class="form-check-label">
<input type="radio" class="form-check-input" name="wlEmail" value="0" <?php echo $userData['wlEmailFlag'] ? "" : "checked"; ?> />No </label>
</div>
</div>
<div class="mt-3">
<label>Email Price Check Frequency:</label>
<select class="form-control" id="wlFreq" name="wlFreq" aria-label="Select wishlist email frequency">
<?php
$cnt = 0;
foreach ($wlFreqArr as $wlFreq) {
echo "<option value=\"" . $cnt . "\"";
if (!empty($userData['wlFreq']) && $userData['wlFreq'] == $cnt) {
echo " selected";
}
echo ">";
echo $wlFreq;
echo "</option>";
++$cnt;
}
?>
</select>
</div>
</div>
<div class="clearfix"></div>
<div class="mt-5">
<div class="frm-btn text-center">
<button type="submit" class="btn btn-success" name="updateProfile" value="Update">Update</button>
</div>
</div>
</form>
</div>
</div>
<!--//main-->
<!--footer-->
<?php include_once 'elements/footer.php'; ?>
<!--//footer-->
</div>
<script nonce="<?php echo base64_encode($_SESSION["nonce"]); ?>">
$(".custom-file-input").on("change", function() {
var fileName = $(this).val().split("\\").pop();
$(this).siblings(".custom-file-label").addClass("selected").html(fileName);
});
</script>
</body>
</html>