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

  <body class="nav-md">
    <div class="container body">
      <div class="main_container">
	  
	  
	   <?php 
			$user = $dat['company'];
			$qry=mysql_query("select * from airtime_admin where username='$user' and account='Mobisky' ");
			
			if(mysql_num_rows($qry) > 0){
				?>
				<div class="col-md-3 left_col">
          <div class="left_col scroll-view">
            <!--div class="navbar nav_title" style="border: 0;">
              <a href="index.html" class="site_title">
			    <div class="profile_pic" style="margin-top:-10px;">
					<img src="../images/mlogo.png" alt="" class="img-circle profile_img" />
			    </div>
			        <span>Instant Airtime </span>
            </div>
            <div class="clearfix"></div-->
            
            <!-- menu profile quick info -->
            <div class="profile">
              <div class="profile_pic">
			    <?php 
			  if($img == ""){
				  ?>
				   <img src="../profileimages/noimage.gif" alt="..." class="img-circle profile_img">
				  <?php
			  }else{
				?>
				 <img src="<?php echo $photo ?>" alt="..." class="img-circle profile_img" width="40px;" height="60px;">
            <?php				
			  }
			  ?>
              </div>
              <div class="profile_info">
                <span>Mobisky Admin </span>
				<h2> <?php $fname = $dat['fname']; $lname = $dat['lname']; echo $fname." ".$lname ?> </h2>
             <!--   <h2>John Doe</h2> -->
              </div>
            </div>
            <!-- /menu profile quick info -->
            <br/>	
				  <!-- sidebar menu -->
            <div id="sidebar-menu" class="main_menu_side hidden-print main_menu">
              <div class="menu_section">
			  
                <h3>General</h3>
                <ul class="nav side-menu">
                  <li class="active"><a  href="adminpage.php" ><i class="fa fa-home"></i>  Home <span class="fa fa-chevron-right"></span></a> </li>
                  <li><a href="viewadmins.php">System Users <span class="fa fa-chevron-right"></span></a> </li>
                  <li><a href="requests.php">Topup Requests  <span class="fa fa-chevron-right"></span> </a>   </li>
				   <li><a href="sendinghistory.php"> Topup History  <span class="fa fa-chevron-right"></span></a>   </li>
                </ul>
              </div>
            </div>
			<!--end side menubar -->
			</div>
        </div>
		
		 <?php include("admintopmenubar.php"); ?>
		 
			<?php	
			}
			
			else{
				?>
				 <div class="col-md-3 left_col">
          <div class="left_col scroll-view">
            <!--div class="navbar nav_title" style="border: 0;">
              <a href="index.html" class="site_title">
			   <div class="profile_pic" style="margin-top:-10px;">
					<img src="../images/mlogo.png" alt="" class="img-circle profile_img" />
			    </div>
			        <span>Instant Airtime </span>
            </div>

            <div class="clearfix"></div-->

            <!-- menu profile quick info -->
            <div class="profile">
              <div class="profile_pic">
			  <?php 
			  if($img == ""){
				  ?>
				   <img src="../profileimages/noimage.gif" alt="..." class="img-circle profile_img">
				  <?php
			  }else{
				?>
				 <img src="<?php echo $photo ?>" alt="..." class="img-circle profile_img">
            <?php				
			  }
			  ?>
               
              </div>
             <div class="profile_info">

                <span>Welcome,</span>
				<h2> <?php $cid = $dat['customer_id']; $fname = $dat['fname']; $lname = $dat['lname']; echo $fname." ".$lname ?> </h2>
             <!--   <h2>John Doe</h2> -->
              </div>
            </div>
            <!-- /menu profile quick info -->

            <br />

            <!-- sidebar menu -->
              <div id="sidebar-menu" class="main_menu_side hidden-print main_menu">
              <div class="menu_section">
			  
                <h3>General</h3>
                <ul class="nav side-menu">
                  <li class="active"><a  href="adminpage.php" ><i class="fa fa-home"></i>  Home <span class="fa fa-chevron-right"></span></a> </li>
                   <li><a href="#">  Users <span class="fa fa-chevron-down"></span></a> 
				  <ul class="nav child_menu">
					    <li ><a  href="adduser.php" ><i class="fa fa-bug"></i>Create User<span class="fa fa-chevron-right"></span></a> </li>
						<li><a  href="viewuser.php" ><i class="fa fa-edit"></i>View Users<span class="fa fa-chevron-down"></span></a> </li>
					   </ul>
				  </li>
                  <li><a href="contacts.php">  View Contacts <span class="fa fa-chevron-right"></span> </a> </li>
                  <li><a href="groups.php"> View Groups  <span class="fa fa-chevron-right"></span> </a>   </li>
                 
				   <!--li><a> Reports <span class="fa fa-chevron-down"></span></a>  
					   <ul class="nav child_menu">
					    <li><a  href="buyinghistory.php" > Purchase History <span class="fa fa-chevron-right"></span> </a> </li>
						<li><a  href="sendinghistory.php" > Sending History <span class="fa fa-chevron-right"></span> </a></li>
					   </ul>
				   </li-->
                </ul>
              </div>

            </div>
			 </div>
        </div>
		
		<?php include("topmenubar.php");  ?>
				
			<?php	
			}
	?>
       
		 
		 
		 <!-- page content -->
        <div class="right_col" role="main">
		  <!-- /top navigation -->
		    <div class="row">
              <!-- top tiles -->
			<div class="row tile_count">
				<div class="col-md-2 col-sm-4 col-xs-6 tile_stats_count">
					<p>Airtime Portal </p>
				</div>
            
			</div>
			</div>
          <!-- /top tiles -->
		 
			<div class="row">
					<div class="x_title">
						<div style="margin-left:80px;" > <h2> Admin Profile  </h2> </div>
							<div class="clearfix"></div>
					</div>
					
					 <div style="margin-left:80px;position:relative" >
						<table border="0" >
							<tr>
								<td> Full Names: </td> <td> &nbsp;&nbsp; <b> <?php  $n=$dat['fname']; $l=$dat['lname']; echo $n." ".$l  ?> </b> </td>
							</tr>
							</table>
							<br/>
							<table border="0" >
							<tr>
								<td>  Username:  </td> <td> &nbsp;&nbsp; <b> <?php  $u=$dat['username']; echo $u ?> </b> </td>
							</tr>
							</table>
							<br/>
							<table border="0" >
							<tr>
								<td>  Contact: </td> <td> &nbsp;&nbsp; <b> <?php  $c=$dat['phone']; echo $c  ?> </b> </td>
							</tr>
							</table>
							<br/>
							<table border="0" >
							<tr>
								<td>   Email:   </td> <td> &nbsp;&nbsp; <b> <?php    $e=$dat['email']; echo $e ?> </b> </td>
							</tr>
							</table>
						 <br/>  <br/>
						
						 

							 <a rel="tooltip" title="Update Profile" id="<?php echo $id ?>" href="#updatecontact<?php echo $id ?>" data-toggle="modal"  >
							   <button  class="btn btn-primary"> Update Info </button> </a>
								<?php include("../updateprof.php") ?>
								
								<a rel="tooltip" title="Reset Password" id="<?php echo $id ?>" href="#resetpassword<?php echo $id ?>" data-toggle="modal"  >
							   <button  class="btn btn-info"> Reset Password</button> </a>
								<?php include("../resetpassword.php") ?>
							
					 <br/>  <br/>
					
					 </div>
					 <br/><br/>
					 
						 <div style="margin-left:550px;margin-top:-260px;position:absolute;" >
						 <a rel="tooltip" title="Upload Profile Picture"  data-toggle="modal" >       
						  <?php 
							if($img == ""){
							?>  <div class="profile">
									<div class="profile_pic">
										<img src="profileimages/noimage.gif" alt="..."  class="img-circle profile_img">
									</div>
								</div>
							<?php
								}else{
								?>
								<div class="profile">
									<div class="profile_pic">
										<img src="<?php echo $photo ?>" alt="..." class="img-circle profile_img" height="120px"> 
									</div>
								</div>
								<?php				
								}
							?> 
							</a>
							<form method="post" enctype="multipart/form-data" >
								<div style="margin-top:10px;margin-bottom:20px;position:absolute;" > 
									<table border="0" >
										<tr>
											<td> <input type="hidden" name="size" value="350000" /> <input type="file" name="img" id="image" /> </td>
											<td><button  type="submit" name="upload_photo" class="btn btn-info"> Upload Profile Picture</button> </td>
										</tr>
									</table>
								</div>
							</form>
						 </div>
					
				 <br/>  <br/>
		 
			</div>
			
				<?php
			if(isset($_POST['upload_photo'])){
				   $filename = $_FILES["img"]["name"]; 
				   $filetype = $_FILES["img"]["type"];
                   $filesize = ($_FILES["img"]["size"]) / 10;
				   $filetempLoc = $_FILES["img"]["tmp_name"];  
				   
				    $file_info = getimagesize($_FILES['img']['tmp_name']);
			   if(empty($file_info)){
				   ?>
				   <script>
				   alert("Error! No Image Selected. Select Your Profile image to upload.");
				   window.location="adminprofile.php";
				   </script>
				   <?php
			   }else{
				      $target = '../profileimages/';
					   $img_name=$session_id."_".$filename;
				       move_uploaded_file($filetempLoc, $target.$img_name);
					   $img_name=$session_id."_".$filename;
						
						$query = mysql_query("update airtime_customer set image='$img_name' where customer_id='$session_id' ");
							
							if(!$query){
								die('Error: ' . mysql_error());
							}
							else{
								$qry = mysql_query("select * from airtime_logs where id='$session_lid' ");
									$sdata=mysql_fetch_array($qry);	
										$actions = $sdata['user_actions'];
										mysql_query("update airtime_logs set user_actions='$actions Updated your account profile picture.' where id='$session_lid'  ");
								echo 
								"<script type=\"text/javascript\">
									alert(\"Profile Picture Successfully Uploaded.\");
									window.location='adminprofile.php';
								</script>";	
							}
					}
			   
			}
			?>
		  
		 </div>
	</div>
</div>	
		  
		          <!-- /page content. End of main -->

      <?php include("footerlinks.php"); ?>
 <!-- jQuery -->
    <script src="../vendors/jquery/dist/jquery.min.js"></script>
    <!-- Bootstrap -->
    <script src="../vendors/bootstrap/dist/js/bootstrap.min.js"></script>
    <!-- FastClick -->
    <script src="../vendors/fastclick/lib/fastclick.js"></script>
    <!-- NProgress -->
    <script src="../vendors/nprogress/nprogress.js"></script>
    <!-- Datatables -->
    <script src="../vendors/datatables.net/js/jquery.dataTables.min.js"></script>
    <script src="../vendors/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
    <script src="../vendors/datatables.net-buttons/js/dataTables.buttons.min.js"></script>
    <script src="../vendors/datatables.net-buttons-bs/js/buttons.bootstrap.min.js"></script>
    <script src="../vendors/datatables.net-buttons/js/buttons.flash.min.js"></script>
    <script src="../vendors/datatables.net-buttons/js/buttons.html5.min.js"></script>
    <script src="../vendors/datatables.net-buttons/js/buttons.print.min.js"></script>
    <script src="../vendors/datatables.net-fixedheader/js/dataTables.fixedHeader.min.js"></script>
    <script src="../vendors/datatables.net-keytable/js/dataTables.keyTable.min.js"></script>
    <script src="./vendors/datatables.net-responsive/js/dataTables.responsive.min.js"></script>
    <script src="../vendors/datatables.net-responsive-bs/js/responsive.bootstrap.js"></script>
    <script src="../vendors/datatables.net-scroller/js/datatables.scroller.min.js"></script>
    <script src="../vendors/jszip/dist/jszip.min.js"></script>
    <script src="../vendors/pdfmake/build/pdfmake.min.js"></script>
    <script src="../vendors/pdfmake/build/vfs_fonts.js"></script>
		  
		  