Exemple #1
0
require_once "requires/datasource.php";
if (!isLoggedIn()) {
    redirectTo("login.php");
} else {
    include "headers/adminheader.php";
    if (isset($_SESSION["currentUser"])) {
        $username = $_SESSION["currentUser"];
        // if the current session has a logged in user
        // and the update info button was submitted, update
        // their information
        if (isset($_POST["updateinfosubmit"])) {
            $firstName = escapeValue(trim($_POST["firstname"]));
            $lastName = escapeValue(trim($_POST["lastname"]));
            $phoneNumber = escapeValue(trim($_POST["phone"]));
            $emailAddress = escapeValue(trim($_POST["email"]));
            DataSource::updateUser($username, $firstName, $lastName, $emailAddress, $phoneNumber);
            // else get current information about the username in the
            // database to display
        } else {
            $result = DataSource::getUser("username = '******'");
            $row = $result->fetch_assoc();
            $firstName = $row["firstName"];
            $lastName = $row["lastName"];
            $emailAddress = $row["emailAddress"];
            $phoneNumber = $row["phoneNumber"];
        }
        // get the reviews for the username from the database to
        // display
        $reviewResult = DataSource::getUserReviews($username);
        $reviews = array();
        if ($reviewResult) {