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j '  'P$a ( `D$Na L?u80e J,K˷NI'0eݷ(NI'؀ 2ipIIKp`:O'`ʤxB8Ѥx Ѥx $ $P6 :vRNb 'p,>NB 'P]-->P T+*^h& p '‰a ‰ (ĵt#u33;Nt̵'ޯ; [3W ~]0KH1q@8]O2]3*̧7# *p>us p _6]/}-4|t'|Smx= DoʾM×M_8!)6lq':l7!|4} '\ne t!=hnLn (~Dn\+‰_4k)0e@OhZ`F `.m1} 'vp{F`ON7Srx 'D˸nV`><;yMx!IS钦OM)Ե٥x 'DSD6bS8!" ODz#R >S8!7ّxEh0m$MIPHi$IvS8IN$I p$O8I,sk&I)$IN$Hi$I^Ah.p$MIN$IR8I·N "IF9Ah0m$MIN$IR8IN$I 3jIU;kO$ɳN$+ q.x* tEXtComment

Viewing File: /home/u423589436/domains/kingshomeandcomfort.com/public_html/customers/profile.php

<?php session_start(); ?>
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <meta content="width=device-width, initial-scale=1.0" name="viewport">

  <title>Profile - Dashboard</title>
  <meta content="" name="description">
  <meta content="" name="keywords">

 <?php include("header-links.php"); ?>

</head>

<body>

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

  <main id="main" class="main">



     <!-- STATUS MESSAGE -->
<style>
    .centered {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        text-align: center;
        background-color: whitesmoke;
        color: green;
        border-radius: 6px;
        padding: 10px;
        font-weight: bolder;
        font-size: 25px;
        z-index: 10000;
    }

    .cancel-button {
        margin-top: 10px;
        background-color: whitesmoke;
        border: none;
        font-weight: bolder;
        color: red;
    }

    span.msg{
        color: black;
    }


   

</style>

     <!-- SUCCESS MESSAGE -->
<?php if (isset($_REQUEST['status'])) { ?>
    <?php if ($_REQUEST['status'] == 'success') { ?>
        <div class="centered p-3">
             <?php echo "<script>alert('Updated successfully')</script>"; ?>
        </div>
    <?php } ?>
<?php } ?>



    <div class="pagetitle">
      <h1>Profile</h1>
      <nav>
        <ol class="breadcrumb">
          <li class="breadcrumb-item"><a href="../index.php">Home</a></li>
          <li class="breadcrumb-item active">Profile</li>
        </ol>
      </nav>
    </div><!-- End Page Title -->

    <?php
                   include("../connection.php");
                   $select_user_details="SELECT * FROM users WHERE username='$_SESSION[username]'";
                   $query_select_user_details=mysqli_query($conn, $select_user_details);
                   $row=mysqli_fetch_array($query_select_user_details);
                   
                   $username=$row["username"];
                   $password=$row["password"];
                   $phone=$row["phone"];
                   $full_name=$row["full_name"];
                   $shipping_address=$row["shipping_address"];
                   $email=$row["email"];
                   $date_registered=$row["date_registered"];

                  ?>


    <section class="section profile">
      <div class="row">
        <div class="col-xl-4">

          <div class="card">
            <div class="card-body profile-card pt-4 d-flex flex-column align-items-center">

              <img src="https://media.istockphoto.com/id/1337144146/vector/default-avatar-profile-icon-vector.jpg?s=612x612&w=0&k=20&c=BIbFwuv7FxTWvh5S3vB6bkT0Qv8Vn8N5Ffseq84ClGI=" alt="Profile" class="rounded-circle">
              <h2><?php echo $username; ?></h2>             
              <h6 class="mt-1">Administrator</h6>             

            </div>
          </div>

        </div>

        <div class="col-xl-8">

          <div class="card">
            <div class="card-body pt-3">
              <!-- Bordered Tabs -->
              <ul class="nav nav-tabs nav-tabs-bordered">

                <li class="nav-item">
                  <button class="nav-link active" data-bs-toggle="tab" data-bs-target="#profile-overview">Overview</button>
                </li>

                <li class="nav-item">
                  <button class="nav-link" data-bs-toggle="tab" data-bs-target="#profile-edit">Edit Profile</button>
                </li>

                <li class="nav-item">
                  <button class="nav-link" data-bs-toggle="tab" data-bs-target="#profile-change-password">Change Password</button>
                </li>

              </ul>
              <div class="tab-content pt-2">

                <div class="tab-pane fade show active profile-overview" id="profile-overview">
                 
                  <h5 class="card-title" style="color: black; font-weight: bolder;">Profile Details</h5>

                
                  <div class="row">
                    <div class="col-lg-3 col-md-4 label " style="color: black;">User Name</div>
                    <div class="col-lg-9 col-md-8"><?php echo $username; ?></div>
                  </div>

                  <div class="row">
                    <div class="col-lg-3 col-md-4 label" style="color: black;">Phone</div>
                    <div class="col-lg-9 col-md-8"><?php echo $phone; ?></div>
                  </div>

                  <div class="row">
                    <div class="col-lg-3 col-md-4 label" style="color: black;">Full Name</div>
                    <div class="col-lg-9 col-md-8"><?php echo $full_name; ?></div>
                  </div>

                  <div class="row">
                    <div class="col-lg-3 col-md-4 label" style="color: black;">Email</div>
                    <div class="col-lg-9 col-md-8"><?php echo $email; ?></div>
                  </div>

                  <div class="row">
                    <div class="col-lg-3 col-md-4 label" style="color: black;">Shipping Address</div>
                    <div class="col-lg-9 col-md-8"><?php echo $shipping_address; ?></div>
                  </div>

                
                </div>

                <div class="tab-pane fade profile-edit pt-3" id="profile-edit">

                  <!-- Profile Edit Form -->
                  <form action="" method="POST">
                   
                    <div class="row mb-3">
                      <label for="fullName" class="col-md-4 col-lg-3 col-form-label" style="color: black;">User Name</label>
                      <div class="col-md-8 col-lg-9">
                        <input name="username" type="text" class="form-control" id="fullName" value="<?php echo $username; ?>">
                      </div>
                    </div>

                    <div class="row mb-3">
                      <label for="company" class="col-md-4 col-lg-3 col-form-label" style="color: black;">Phone</label>
                      <div class="col-md-8 col-lg-9">
                        <input name="phone" type="text" class="form-control" id="email" value="<?php echo $phone; ?>">
                      </div>
                    </div>

                    <div class="row mb-3">
                      <label for="company" class="col-md-4 col-lg-3 col-form-label" style="color: black;">Full Name</label>
                      <div class="col-md-8 col-lg-9">
                        <input name="full_name" type="text" class="form-control" id="email" value="<?php echo $full_name; ?>">
                      </div>
                    </div>

                    <div class="row mb-3">
                      <label for="company" class="col-md-4 col-lg-3 col-form-label" style="color: black;">Email</label>
                      <div class="col-md-8 col-lg-9">
                        <input name="email" type="text" class="form-control" id="email" value="<?php echo $email; ?>">
                      </div>
                    </div>

                    <input type="hidden" name="shipping_address" value="<?php echo $shipping_address; ?>">
                    <input type="hidden" name="password" value="<?php echo $password; ?>">
                    <input type="hidden" name="date_registered" value="<?php echo $date_registered; ?>">

                    <div class="text-center">
                      <button type="submit" name="updation_btn" class="btn btn-danger">Save Changes</button>
                    </div>
                  </form><!-- End Profile Edit Form -->

                </div>

            

                <div class="tab-pane fade pt-3" id="profile-change-password">
                  <!-- Change Password Form -->
                 
                  <!-- Change Password Form -->
                  <form action="" method="post">

                  <div class="mb-3">
                     <b>You will be logged out after changing password</b>
                    </div>

                    <div class="row mb-3">
                      <label for="currentPassword" class="col-md-4 col-lg-3 col-form-label" style="font-size: 15px;">Current Password</label>
                      <div class="col-md-8 col-lg-9">
                        <input name="current_password" type="password" required style="font-size: 15px" class="form-control" id="currentPassword">
                      </div>
                    </div>

                    <div class="row mb-3">
                      <label for="newPassword" class="col-md-4 col-lg-3 col-form-label" style="font-size: 15px;">New Password</label>
                      <div class="col-md-8 col-lg-9">
                        <input name="newpassword" type="password" required style="font-size: 15px" class="form-control" id="newPassword">
                      </div>
                    </div>

                    <div class="text-center">
                      <button type="submit" class="btn btn-danger" name="changePassword">Change Password</button>
                    </div>

                  


                  </form><!-- End Change Password Form -->

                </div>

              </div><!-- End Bordered Tabs -->

            </div>
          </div>

        </div>
      </div>
    </section>

  </main><!-- End #main -->

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

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

</body>

</html>

<?php

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

  include("connection.php");

  $username = $_POST['username'];
  $password = $_POST['password'];
  $phone = $_POST['phone'];
  $full_name=$_POST["full_name"];
  $shipping_address=$_POST["shipping_address"];
  $email=$_POST["email"];
  $date_registered=$_POST["date_registered"];


$sql="UPDATE `users` SET username='$_POST[username]', password='$_POST[password]', phone='$_POST[phone]', full_name='$full_name', shipping_address='$shipping_address', email='$email', date_registered='$date_registered' WHERE username='$_SESSION[username]'";
$result=mysqli_query($conn,$sql);

if ($result) {
    
    echo "<script>alert('Updated successfully')</script>";

}else{
    echo "
    <div class='alert-danger p-2' style='position: fixed; bottom: 100px; left: 10px; width: 20%; font-weight: bolder; z-index: 2' id='failure_div2'>Something Went Wrong! <i style='float: right; cursor: pointer' class='mdi mdi-close' id='close_btn3'></i></div>
    "; 
}

}


?>
<!-- CHANGE PASSWORD -->

<?php

if(isset($_POST["changePassword"])){

include("../connection.php");

$current_password=$_POST["current_password"];

$select_logged_in_user_password="SELECT * FROM users WHERE username='$_SESSION[username]'";
$query=mysqli_query($conn,$select_logged_in_user_password);
$row=mysqli_fetch_array($query);
$password=$row["password"];

$newpassword=$_POST["newpassword"];

if($current_password=="$password"){

    $update="UPDATE `users` SET password='$_POST[newpassword]' WHERE username='$_SESSION[username]'";

    $update_query=mysqli_query($conn,$update);

 
      if($update_query){

    echo "<script>window.location='logout.php'</script>";
      }
       //session_destroy();

    }

    else{
        echo "<script>alert('Something went wrong. Enter correct password.')</script>";

        }  
}

?>


<script>
 $(".cancel-button").click(function(){
  $(".centered").hide()
 })
</script>
Back to Directory=ceiIENDB`