<?php 
include("header.php");
include("sidebar.php");

//echo'<pre>';print_r($_POST);
$sql=mysql_query("select * from admin_login where aid='".$_SESSION['aid']."'");
$res=mysql_fetch_assoc($sql);

if(isset($_POST['update']))
{
	$name=$_POST['name'];
	$email=$_POST['email'];
	
	if(isset($_FILES['photo']))
	{
		$fname=$_FILES['photo']['name'];
		
		if($fname!=="")
		{
			move_uploaded_file($_FILES['photo']['tmp_name'],"assets/portraits/".$_FILES['photo']['name']);
			$insertp=mysql_query("update admin_login set aimage='".$_FILES['photo']['name']."' where aid='".$_SESSION['aid']."'");
		}
		
		
	}
	$insertp=mysql_query("update admin_login set aname ='".$name."',aemail='".$email."' where aid='".$_SESSION['aid']."'");
}

?>


  <!-- Page -->
  <div class="page animsition">
    <div class="page-content container-fluid">
      <div class="row">
        <div class="col-md-3">
          <!-- Page Widget -->
          <div class="widget widget-shadow text-center">
            <div class="widget-header">
              <div class="widget-header-content">
                <a class="avatar avatar-lg" href="javascript:void(0)">
                  <img src="assets/portraits/<?php echo $res['aimage'];?>" alt="...">
                </a>
                <div class="profile-user"><?php echo $res['aname'];?></div>
               <!-- <div class="profile-job">Art director</div>
                <p>Hi! I'm Adrian the Senior UI Designer at AmazingSurge. We hope
                  you enjoy the design and quality of Social.</p>
                <div class="profile-social">
                  <a class="icon bd-twitter" href="javascript:void(0)"></a>
                  <a class="icon bd-facebook" href="javascript:void(0)"></a>
                  <a class="icon bd-dribbble" href="javascript:void(0)"></a>
                  <a class="icon bd-github" href="javascript:void(0)"></a>
                </div>
                <button type="button" class="btn btn-primary">Follow</button>-->
              </div>
            </div>
            <!--<div class="widget-footer">
              <div class="row no-space">
                <div class="col-xs-4">
                  <strong class="profile-stat-count">260</strong>
                  <span>Follower</span>
                </div>
                <div class="col-xs-4">
                  <strong class="profile-stat-count">180</strong>
                  <span>Following</span>
                </div>
                <div class="col-xs-4">
                  <strong class="profile-stat-count">2000</strong>
                  <span>Tweets</span>
                </div>
              </div>
            </div>-->
          </div>
          <!-- End Page Widget -->
        </div>

        <div class="col-md-9">
          <!-- Panel -->
          <div class="page-content container-fluid">
      <div class="row">
        <div class="col-sm-12">
          <!-- Panel Static Lables -->
          <div class="panel">
            <div class="panel-heading">
              <h3 class="panel-title">Admin Details</h3>
            </div>
            <div class="panel-body container-fluid">
              <form autocomplete="off" method="post" enctype="multipart/form-data">
                <div class="form-group form-material">
                  <label class="control-label" for="inputText">Name</label>
                  <input type="text"  class="form-control" id="inputText" name="name" placeholder="Text" value="<?php echo $res['aname'];?>"
                  />
                </div>
                <div class="form-group form-material">
                  <label class="control-label" for="inputEmail">Email</label>
                  <input type="email" class="form-control" id="inputEmail" name="email" placeholder="Email" value="<?php echo $res['aemail'];?>"
                  />
                </div>
               
                <div class="form-group form-material">
                  <img src="assets/portraits/<?php echo $res['aimage'];?>" height="50" width="50">
                  <label class="control-label" for="inputFile">Change Photo</label>
                  <input type="text" class="form-control" placeholder="Browse.." readonly="" />
                  <input type="file" id="inputFile" name="photo" multiple="" />
                </div>
                <div class="form-group form-material">
                <button type="submit"  class="btn btn-block btn-success" name="update">Update</button>
                </div>
               
              </form>
            </div>
          </div>
          <!-- End Panel Static Lables -->
        </div>

        
      </div>
    </div>
          <!-- End Panel -->
        </div>
      </div>
    </div>
  </div>
  <!-- End Page -->


 <?php include("footer.php");?>