Exemplo n.º 1
0
                if ($admin_user->update()) {
                    $session->message("Success! The password was updated. ");
                    redirect_to('public-view-profile.php');
                } else {
                    $session->message("Error! The user details could not be updated. ");
                }
            } else {
                $session->message("Error! The existing password did not match. ");
            }
        }
        if (isset($_POST['upload'])) {
            $photo = new Photograph();
            $photo->commuter_id = $user->id;
            $photo->photo_type = 9;
            // photo_type 9 is "User Profile"
            $photo->attach_file_commuter($_FILES['file_upload'], $user->id, $user->first_name, $user->last_name);
            if ($photo->save()) {
                $session->message("Success! The photo was uploaded successfully. ");
                redirect_to('public-view-profile.php');
            } else {
                $message = join("<br />", $photo->errors);
            }
        }
    } else {
        //everyone else
        $session->message("Error! You do not have sufficient priviledges to view the requested page. ");
        redirect_to("index.php");
    }
} else {
    //not logged in... GTFO!
    $session->message("Error! You must login to view the requested page. ");