Ejemplo n.º 1
0
<?php

//check login
if ($session->is_logged_in()) {
    if ($session->object_type == 5) {
        //admin user
        $user = $admin_user_object->find_by_id($_SESSION['id']);
        $profile_picture = $photo_object->get_profile_picture($session->object_type, $user->id);
        $admin_levels = AdminLevel::find_all();
        if (isset($_POST['submit'])) {
            $user->username = $_POST['username'];
            $user->first_name = $_POST['first_name'];
            $user->last_name = $_POST['last_name'];
            $user->email_address = $_POST['email_address'];
            $user->admin_level = $_POST['admin_level'];
            if ($user->update()) {
                $session->message("Success! Your details were updated. ");
                redirect_to('admin_view_profile.php');
            } else {
                $session->message("Error! Your details could not be updated. ");
            }
        }
        if (isset($_POST['update'])) {
            if ($_POST['old_password'] == $user->password) {
                $user->password = $_POST['new_password'];
                if ($user->update()) {
                    $session->message("Success! Your password was updated. ");
                    redirect_to('admin_view_profile.php');
                } else {
                    $session->message("Error! Your password could not be updated. ");
                }
Ejemplo n.º 2
0
	        <td>User Name</td>
	        <td>Email Address</td>
	        <td>Admin Level</td>
	        <td>&nbsp;</td>
	        <td>&nbsp;</td>
	        </tr>

        	<?php 
for ($i = 0; $i < count($users); $i++) {
    if ($users[$i]->id != $user->id) {
        ?>

        		<tr align="center">
        		<td>
        		<?php 
        $admin_level = new AdminLevel();
        $pic = new Photograph();
        $user_profile_picture = $pic->get_profile_picture('5', $users[$i]->id);
        if (!empty($user_profile_picture->filename)) {
            echo '<img src="../../' . $user_profile_picture->image_path() . '" width="100" class="img-rounded" />';
        } else {
            echo '<img src="../img/default-prof-pic.jpg" width="100" class="img-rounded" alt="Please upload a profile picture" />';
        }
        ?>
        		</td>
        		<td><?php 
        echo $users[$i]->full_name();
        ?>
</td>
        		<td><?php 
        echo $users[$i]->username;