<?php

$user = new User($conn);
$oneUser = json_decode($user->getById($_GET['id']));

if($oneUser && count($oneUser) > 0){
    $username = $oneUser[0]->username;
    $role = $oneUser[0]->role;
    $avatar = $oneUser[0]->avatar;

?>

<div class="row">
    <div class="col s12 m12">
      <div class="card profile__card">
        <div class="card-image" style="background-image: url(<?php print $avatar?>);">
          <a class="btn-floating halfway-fab waves-effect waves-light grey profile__img">
              <img style="height: 100%;" src="<?php print $avatar?>">
          </a>
        </div>
        <div class="card-content">
            <div class="row no-margin">
                <div class="col offset-s3">
                   <h4><?php print $username?></h4>
                   <h5><?php print $role?></h5>
                </div>
                <div class="col s4">
                    <?php 
                    if ($username === $_SESSION['username']) {
                        require_once '/../../imageUploadFile.php' ;
                    }
                    ?>
                </div>
            </div>
        </div>
      </div>
    </div>
  </div>

<?php    
}else{
    print '<h1 class="by">User Not Found</h1>';
}

?>