<?php 
include 'core/init.php';
admin_protect();
include 'includes/overall/header.php'; 
?>
 <center><h1>Welcome to Admin Page Modify User</h1></center>
<?php
if (isset($_GET['success']) === true && empty($_GET['success']) === true) {
echo 'Your Details have been updated! <br> <br>';
echo "<a href=admin.php>Back to Admin Page</a>";
} else {
if (empty($_POST) === false && empty($errors) === true) {
    $update_data = array(
        'first_name'    => $_POST['first_name'],
        'last_name'     => $_POST['last_name'],
        'gender'        => $_POST['gender'],
        'email'         => $_POST['email'],
        'dob_day'       => $_POST['dob_day'],
        'dob_month'     => $_POST['dob_month'],
        'dob_year'      => $_POST['dob_year'],
        'allow_email'   => $allow_email = ($_POST['allow_email'] == 'on') ? 1 : 0
    );
    update_user($session_user_id, $update_data);
    header('Location: admin_modify.php?success');
    exit();
} else if (empty($errors) === false) {
    echo output_errors($errors);
}
?>
<form action="" method="post">
    <ul>
        <li>
            First Name* : <br> <input type="text" name="first_name" value="<?php echo $user_data['first_name'];?>">
        </li>
        <li>
            Last Name : <br> <input type="text" name="last_name" value="<?php echo $user_data['last_name'];?>">
        </li>
            Gender*:<br>
                <select name="gender" >
                        <option><?php echo $user_data['gender']; ?></option>
                        <option>Male</option>
                        <option>Female</option>
                </select>
        <li>
            Email* : <br> <input type="text" name="email" value="<?php echo $user_data['email'];?>">
        </li>
        <li>
                Date of Birth*:<br>
                    <select name="dob_day">
                        <option><?php echo $user_data['dob_day'];?></option>
                            <?php
                                loop_date();
                            ?>
                    </select>
                    <select name="dob_month">
                        <option><?php echo $user_data['dob_month'];?></option>
                            <?php
                                loop_month();
                            ?>
                    </select>
                    <select name="dob_year">
                        <option><?php echo $user_data['dob_year'];?></option>
                            <?php
                               loop_year();
                            ?>
                    </select>
            </li>
        <li>
            <input type="checkbox" name="allow_email" <?php if ($user_data['allow_email'] == 1) {echo 'checked="checked"';}?> >Would you like to receive email from us?
        </li>
        <li>
            <input type="submit" value="Update">
        </li>
    </ul>
</form>
<?php
}
include 'includes/overall/footer.php' 
?>
<?php include 'includes/overall/footer.php' ?>
I am encountering problems when I want to modify or delete a user using the admin account. The problem is that the current session of the admin account is being recognized when you what to modify or delete it. How can I solve this problem? Thank you for all your help. :)
 
     
     
    