
        <div class="container-fluid">
            <div class="row clearfix">
                <div class="col-xs-12 col-sm-3">
                    <div class="card profile-card">
                        <div class="profile-header">&nbsp;</div>
                        <div class="profile-body" >
                            <div class="image-area" >
                               <?php if($_SESSION['img_profile']<>''){
				echo '<img src="'.$_SESSION['img_profile'].'" width="100" height="100" alt="User" />';
				} else {?>
                    <img src="images/logo.png" width="100" height="100"   alt="User" />
                <?php }?>
                            </div>
                            <div class="content-area">
                                <h3><?php echo $_SESSION['user_nama'];?></h3>
                                <p><?php echo $_SESSION['email'];?></p>
                                <p><?php echo $_SESSION['user_kategori'];?></p>
                            </div>
                        </div>
                        <div class="profile-footer">
                           <a href="logout.php" onClick="return confirm('Yakin.. Keluar Aplikasi?'); ">
                            <button class="btn btn-primary btn-lg waves-effect btn-block"> <i class="material-icons" >exit_to_app</i>  Log Out</button>
							</a>
                        </div>
                    </div>

                   
                </div>
                <div class="col-xs-12 col-sm-9">
                    <div class="card">
                        <div class="body">
                            <div>
                                <ul class="nav nav-tabs" role="tablist">
                                    <li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">Home</a></li>
                                    <li role="presentation"><a href="#profile_settings" aria-controls="settings" role="tab" data-toggle="tab">Profile Settings</a></li>
                                    <li role="presentation"><a href="#change_password_settings" aria-controls="settings" role="tab" data-toggle="tab">Change Password</a></li>
									<li role="presentation"><a href="#change_pin_settings" aria-controls="pins" role="tab" data-toggle="tab">Change PIN</a></li>
                                </ul>
<?php 
if(isset($_POST['submit_profile'])){
$nama=noninjection($koneksi,$_POST['NameSurname']);
$email=noninjection($koneksi,$_POST['Email']);
$phone=noninjection($koneksi,$_POST['InputPhone']);
$koneksi_host=open_connection2();
if(isset($_POST['terms_condition_check'])){
if(($nama<>'')  and ($phone<>'') and ($email<>'')){
			$res=mysqli_query($koneksi,"UPDATE tb_user SET  `nama`='".$nama."', `phone`='".$phone."', `email`='".$email."' WHERE id='".$_SESSION['iduser']."'");
				$res=mysqli_query($koneksi_host,"UPDATE tbregistrasi SET nama_siswa='".$nama."' WHERE (nis='".$_SESSION['iduser']."') AND (npns='".$_SESSION['npsn']."')");
			if($res){
			echo '<div class="alert bg-green alert-dismissible" role="alert">
                                <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                <strong>Well done!</strong> Update Password Data Sukses.
                            </div>';
			}
			}else {
			echo '<div class="alert bg-pink alert-dismissible" role="alert">
                                <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                               <strong>Warning!</strong> Input dengan Lengkap.
                            </div>';
			}
} else {
echo '<div class="alert bg-pink alert-dismissible" role="alert">
                                <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                               <strong>Warning!</strong> Belum ceklist persetujuan.
                            </div>';
}
   
}
if(isset($_POST['submit_password'])){
$email=noninjection($koneksi,$_POST['Email']);
$OldPassword=noninjection($koneksi,$_POST['OldPassword']);
$NewPassword=noninjection($koneksi,$_POST['NewPassword']);
$NewPasswordConfirm=noninjection($koneksi,$_POST['NewPasswordConfirm']);
	$task="34567fghjkl;FGHJK09865fghjs12345@#$@#$!@#";
$OldPassword=md5($OldPassword);
$OldPassword=md5($OldPassword.$email.$task);

if(($email<>'') and ($OldPassword<>'') and ($NewPassword<>'') and ($NewPasswordConfirm<>'')){
$qry_pin=mysqli_query($koneksi,"SELECT * FROM `tb_user` WHERE (email='".$_SESSION['email']."') AND (password='".$OldPassword."') AND (id='".$_SESSION['iduser']."')  ");
	$N_pin=mysqli_num_rows($qry_pin);
	if($N_pin<>0)
	{
	
	if($NewPassword==$NewPasswordConfirm){
			$NewPassword=md5($NewPassword);
			$NewPassword=md5($NewPassword.$email.$task);
			$res=mysqli_query($koneksi,"UPDATE tb_user SET `email`='".$email."',`password`='".$NewPassword."' WHERE id='".$_SESSION['iduser']."'");
				$koneksi_host=open_connection2();
				$res=mysqli_query($koneksi_host,"UPDATE tbregistrasi SET `email`='".$email."',`password`='".$NewPassword."' WHERE (nis='".$_SESSION['iduser']."') AND (npns='".$_SESSION['npsn']."')");
			if($res){
			echo '<div class="alert bg-green alert-dismissible" role="alert">
                                <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                <strong>Well done!</strong> Updata PIN Sukses.
                            </div>';
			}
			} else {
					echo '<div class="alert bg-pink alert-dismissible" role="alert">
                         <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                         <strong>Warning!</strong> Input "New Password" dan "New Password (Confirm)" tidak sama.
                         </div>';
					}
	} else {
			echo '<div class="alert bg-pink alert-dismissible" role="alert">
                  <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                  <strong>Warning!</strong> Password lama tidak sesuai.
                  </div>';
			}
} else {
		echo '<div class="alert bg-pink alert-dismissible" role="alert">
        <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <strong>Warning!</strong> Input Data Dengan Lengkap.
        </div>';
		}
}



if(isset($_POST['submit_pin'])){

$OldPIN=noninjection($koneksi,$_POST['OldPIN']);
$NewPIN=noninjection($koneksi,$_POST['NewPIN']);
$NewPINConfirm=noninjection($koneksi,$_POST['NewPINConfirm']);
	$task="34567fghjkl;FGHJK09865fghjs12345@#$@#$!@#";
$OldPIN=md5($OldPIN);
$OldPIN=md5($OldPIN.$task);
					
if( ($OldPIN<>'') and ($NewPIN<>'') and ($NewPINConfirm<>'')){
$qry_pin=mysqli_query($koneksi,"SELECT * FROM `tb_user` WHERE (pin='".$OldPIN."') AND (id='".$_SESSION['iduser']."')  ");
	$N_pin=mysqli_num_rows($qry_pin);
	if($N_pin<>0)
	{
	
	if($NewPIN==$NewPINConfirm){
			$NewPIN=md5($NewPIN);
			$NewPIN=md5($NewPIN.$task);
			$res=mysqli_query($koneksi,"UPDATE tb_user SET `pin`='".$NewPIN."' WHERE id='".$_SESSION['iduser']."'");
			if($res){
			echo '<div class="alert bg-green alert-dismissible" role="alert">
                                <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                <strong>Well done!</strong> Edit Data Sukses.
                            </div>';
			}
			} else {
					echo '<div class="alert bg-pink alert-dismissible" role="alert">
                         <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                         <strong>Warning!</strong> Input "New PIN" dan "New PIN (Confirm)" tidak sama.
                         </div>';
					}
	} else {
			echo '<div class="alert bg-pink alert-dismissible" role="alert">
                  <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                  <strong>Warning!</strong> PIN lama tidak sesuai.
                  </div>';
			}
} else {
		echo '<div class="alert bg-pink alert-dismissible" role="alert">
        <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <strong>Warning!</strong> Input Data Dengan Lengkap.
        </div>';
		}
}
?>
                                <div class="tab-content">
                                    <div role="tabpanel" class="tab-pane fade in active" id="home">
                                        <div class="panel panel-default panel-post">
                                            <div class="panel-heading">
                                                <div class="media">
                                                    <div class="media-left">
                                                        
														<?php if($_SESSION['img_profile']<>''){
				echo '<img src="'.$_SESSION['img_profile'].'" width="60" height="60" alt="User" />';
				} else {?>
                    <img src="images/logo.png" width="60" height="60" alt="User" />
                <?php }?>
                                                    </div>
                                                    <div class="media-body">
                                                        <h4 class="media-heading">
                                                            <?php echo $_SESSION['user_nama'];?>
                                                        </h4>
                                                       <?php echo $_SESSION['email'];?>
													   <br><?php echo $_SESSION['user_kategori'];?>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="panel-body">
                                                <div class="post" style="padding:20px;">

							
							<?php 

			$qry_cari=mysqli_query($koneksi,"SELECT * FROM `tb_user` WHERE id='".$_SESSION['iduser']."'");
			$row=mysqli_fetch_array($qry_cari);
			$kategori=$row['kategori'];
			$idmember=$row['id'];
			
			$nama=$row['nama'];
			
			$phone=$row['phone'];
			$status=$row['status'];
			$email=$row['email'];
			$pin=$row['pin'];
			$password=$row['password'];
?>
                                                  
						<div class="row" >
  							<div class="col-sm-4">ID Member</div>
 							 <div class="col-sm-8"><?php echo $idmember;?></div>
							</div> 
							
							<div class="row" >
  							<div class="col-sm-4">Kategori</div>
 							 <div class="col-sm-8"><?php echo $kategori;?></div>
							</div> 
							
							
							
							<div class="row"  >
  							<div class="col-sm-4">Nama</div>
 							 <div class="col-sm-8"><?php echo $nama;?></div>
							</div> 
							
							
							
							<div class="row"  >
  							<div class="col-sm-4">Phone</div>
 							 <div class="col-sm-8"><?php echo $phone;?></div>
							</div> 
							
						
							<div class="row" >
  							<div class="col-sm-4">eMail</div>
 							 <div class="col-sm-8"><?php echo $email;?></div>
							</div> 
							
							<div class="row" >
  							<div class="col-sm-4">Password</div>
 							 <div class="col-sm-8"><?php echo $password;?></div>
							</div> 
							
							<div class="row" >
  							<div class="col-sm-4">PIN</div>
 							 <div class="col-sm-8"><?php echo $pin;?></div>
							</div>
							
							<div class="row"  >
  							<div class="col-sm-4">Status</div>
 							 <div class="col-sm-8"><?php echo $status;?></div>
							</div>
							
                                                </div>
                                            </div>
                                            <div class="panel-footer">
                                                <ul>
                                                    <li>
                                                        
                                                    </li>
                                                    <li>
                                                        
                                                    </li>
                                                    <li>
													 
                                                        <a href="logout.php" onClick="return confirm('Yakin.. Keluar Aplikasi?');">
                                                            <i class="material-icons">exit_to_app</i>
                                                            <span>Log Out</span>
                                                        </a>
                                                    </li>
                                                </ul>

                                               
                                            </div>
                                        </div>

                                    </div>
                                    <div role="tabpanel" class="tab-pane fade in" id="profile_settings">
                                        <form class="form-horizontal" method="post" action="index.php?profile">
                                            <div class="form-group">
                                                <label for="NameSurname" class="col-sm-2 control-label">Nama Lengkap</label>
                                                <div class="col-sm-10">
                                                    <div class="form-line">
                                                        <input type="text" class="form-control" id="NameSurname" name="NameSurname" placeholder="Name Surname" value="<?php echo $_SESSION['user_nama'];?>" required>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label for="Email" class="col-sm-2 control-label">Email</label>
                                                <div class="col-sm-10">
                                                    <div class="form-line">
                                                        <input type="email" class="form-control" id="Email" name="Email" placeholder="Email" value="<?php echo $_SESSION['email'];?>" required>
                                                    </div>
                                                </div>
                                            </div>
                                           
                                            <div class="form-group">
                                                <label for="InputSkills" class="col-sm-2 control-label">Phone</label>

                                                <div class="col-sm-10">
                                                    <div class="form-line">
                                                        <input type="text" class="form-control" id="InputPhone" name="InputPhone" placeholder="Phone" value="<?php echo $phone;?>">
                                                    </div>
                                                </div>
                                            </div>

                                            <div class="form-group">
                                                <div class="col-sm-offset-2 col-sm-10">
                                                    <input type="checkbox" id="terms_condition_check" name="terms_condition_check" class="chk-col-red filled-in" />
                                                    <label for="terms_condition_check">I agree to the <a href="#">terms and conditions</a></label>
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <div class="col-sm-offset-2 col-sm-10">
                                                    <button type="submit" name="submit_profile" class="btn btn-danger">SUBMIT</button>
                                                </div>
                                            </div>
											
                                        </form>
                                    </div>
                                    <div role="tabpanel" class="tab-pane fade in" id="change_password_settings">
                                        <form class="form-horizontal" method="post" action="index.php?profile">
										  <div class="form-group">
                                                <label for="Email" class="col-sm-2 control-label">Email</label>
                                                <div class="col-sm-10">
                                                    <div class="form-line">
                                                        <input type="email" class="form-control" id="Email" name="Email" placeholder="Email" value="<?php echo $_SESSION['email'];?>" required>
                                                    </div>
                                                </div>
                                            </div>
											
                                            <div class="form-group">
                                                <label for="OldPassword" class="col-sm-3 control-label">Old Password</label>
                                                <div class="col-sm-9">
                                                    <div class="form-line">
                                                        <input type="password" class="form-control" id="OldPassword" name="OldPassword" placeholder="Old Password" required>
                                                    </div> 
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label for="NewPassword" class="col-sm-3 control-label">New Password</label>
                                                <div class="col-sm-9">
                                                    <div class="form-line">
                                                        <input type="password" class="form-control" id="NewPassword" name="NewPassword" placeholder="New Password" required>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label for="NewPasswordConfirm" class="col-sm-3 control-label">New Password (Confirm)</label>
                                                <div class="col-sm-9">
                                                    <div class="form-line">
                                                        <input type="password" class="form-control" id="NewPasswordConfirm" name="NewPasswordConfirm" placeholder="New Password (Confirm)" required>
                                                    </div>
                                                </div>
                                            </div>

                                            <div class="form-group">
                                                <div class="col-sm-offset-3 col-sm-9">
                                                    <button type="submit" name="submit_password" class="btn btn-danger">SUBMIT</button>
                                                </div>
                                            </div>
                                        </form>
                                    </div>
									
									 <div role="tabpanel" class="tab-pane fade in" id="change_pin_settings">
                                        <form class="form-horizontal" method="post" action="index.php?profile">
                                            <div class="form-group">
                                                <label for="OldPassword" class="col-sm-3 control-label">Old PIN</label>
                                                <div class="col-sm-9">
                                                    <div class="form-line">
                                                        <input type="password" class="form-control" id="OldPassword" name="OldPIN" placeholder="Old PIN" required>
                                                    </div>
                                                </div> 
                                            </div>
                                            <div class="form-group">
                                                <label for="NewPassword" class="col-sm-3 control-label">New PIN</label>
                                                <div class="col-sm-9">
                                                    <div class="form-line">
                                                        <input type="password" class="form-control" id="NewPassword" name="NewPIN" placeholder="New PIN" required>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label for="NewPasswordConfirm" class="col-sm-3 control-label">New PIN (Confirm)</label>
                                                <div class="col-sm-9">
                                                    <div class="form-line">
                                                        <input type="password" class="form-control" id="NewPasswordConfirm" name="NewPINConfirm" placeholder="New PIN (Confirm)" required>
                                                    </div>
                                                </div>
                                            </div>

                                            <div class="form-group">
                                                <div class="col-sm-offset-3 col-sm-9">
                                                    <button type="submit" name="submit_pin" class="btn btn-danger">SUBMIT</button>
                                                </div>
                                            </div>
                                        </form>
                                    </div>
									
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
 