Subversion Repositories cheapmusic

Rev

Rev 124 | 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 header">
                                                        <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='data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24" viewBox="0 0 24 24" width="24"><rect fill="none" height="24" width="24"/><path d="M3,4V1h2v3h3v2H5v3H3V6H0V4H3z M6,10V7h3V4h7l1.83,2H21c1.1,0,2,0.9,2,2v12c0,1.1-0.9,2-2,2H5c-1.1,0-2-0.9-2-2V10H6z M13,19c2.76,0,5-2.24,5-5s-2.24-5-5-5s-5,2.24-5,5S10.24,19,13,19z M9.8,14c0,1.77,1.43,3.2,3.2,3.2s3.2-1.43,3.2-3.2 s-1.43-3.2-3.2-3.2S9.8,12.23,9.8,14z"/></svg>' 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>