Mini Shell

Direktori : /home/rizant5/www/admin/
Upload File :
Current File : /home/rizant5/www/admin/profile.php

<?php require_once("function-file.php");
require_once("function-menu.php");
require_once("../config.php");
cookiecheck();
$userid=$_COOKIE["userid"];
$data=$conn->prepare("select * from userlog where user_id='$userid'");
$data->execute();$result=$data->fetch();
if(isset($_POST['save'])){
	$username=$_POST['username'];
	$log_name=$_POST['log_name'];
        $log_email=$_POST['log_email'];
        $log_phone=$_POST['log_phone'];
	$conn->exec("update userlog set username='$username',log_name='$log_name',log_email='$log_email',log_phone='$log_phone' where user_id='$userid'");
	header("location:profile.php");
}
if(isset($_POST['save2'])){
	$old_password=md5($_POST['old_password']);
	$db=$conn->prepare("select * from userlog where user_id='$userid' and log_pass='$old_password'");
	$db->execute();$nums=$db->rowcount();
	if($nums>0){
		$new_password=md5($_POST['new_password']);
		$conn->exec("update userlog set log_pass='$new_password' where user_id='$userid'");
		header("location:profile.php");
	}else{?><script>alert("Old password not match!!");</script>
	<?php }
}
?>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Your Profile</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <?php  cssfile();?>
  </head>
  <body class="hold-transition skin-blue layout-top-nav">
    <!-- Site wrapper -->
    <div class="wrapper">
<?php headermenu();?>
      <!-- =============================================== -->
      <!-- Content Wrapper. Contains page content -->
      <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <!-- Main content -->
        <div class="col-sm-6">
        <section class="content">
          <!-- Default box -->
          <div class="box">
            <div class="box-header with-border">
              <h3 class="box-title">User Profile</h3>
            </div>
            <div class="box-body">
              <form action="#" method="post" role="form" class="form-horizontal">
               <div class="form-group">
              		<div class="col-sm-12"><label>Your Name </label><input name="username" class="form-control" value="<?php echo $result['username'] ?>" required></div>
                </div>
                  <div class="form-group">
              		<div class="col-sm-12"><label>Login Name </label><input name="log_name" class="form-control" value="<?php echo $result['log_name'] ?>" required></div>
                </div>
                <div class="form-group">    
                    <div class="col-sm-12"><label>Your Phone No.</label><input name="log_phone" value="<?php echo $result['log_phone'] ?>" class="form-control"  required></div>
                 </div>
                 <div class="form-group">   
                     <div class="col-sm-12"><label>Your Email</label><input type="email" name="log_email" class="form-control" value="<?php echo $result['log_email'] ?>" required></div>
              </div>
               <div class="form-group">
              		<div class="col-sm-12" align="right">
                    <button  type="submit" name="save" class="btn btn-success" >Save</button></div>
              </div>
              </form>
            </div><!-- /.box-body -->
          </div><!-- /.box -->
        </section><!-- /.content -->
        </div>
       <div class="col-sm-6">
        <section class="content">
          <!-- Default box -->
          <div class="box" >
          <div class="box-header with-border">
              <h3 class="box-title">Change Password</h3>
            </div>
             <div class="box-body">
          <form action="#" method="post" role="form" class="form-horizontal" onsubmit="return myFunction()">
               <div class="form-group">
              		<div class="col-sm-12"><label>Old Password </label><input name="old_password" class="form-control"  required></div>
                </div>
                <div class="form-group">    
                    <div class="col-sm-12"><label>New Password</label><input name="new_password" id="password" class="form-control"  required></div>
                 </div>
                 <div class="form-group">   
                     <div class="col-sm-12"><label>Repeat Password</label><input  id="confirm_password" class="form-control" ></div> 
              </div>
              <div class="form-group"><div class="col-sm-12"><div id="message"></div></div></div>
               <div class="form-group">
              		<div class="col-sm-12" align="right">
                    <button  type="submit" name="save2" class="btn btn-success" >Save</button></div>
              </div>
              </form>
             </div> 
          </div><!-- /.box -->
        </section><!-- /.content -->
        </div>
      </div><!-- /.content-wrapper -->
     
    </div><!-- ./wrapper --> <?php footer();?>
   <?php jsfile();?>
   <script>
   $('#confirm_password').on('keyup', function () {
    if ($(this).val() == $('#password').val()) {
        $('#message').html('Matching').css('color', 'green');
    } else $('#message').html('Not matching').css('color', 'red');
});
function myFunction(){
	var message=$("#message").html();
	var ok = true;
	if(message=='Matching'){
		ok = true;
	}
	else{
		ok = false;
        alert("Password not Match!!!");
    }
    return ok;
}
</script>
  </body>
</html>

Zerion Mini Shell 1.0