ok

Mini Shell

Direktori : /home/u243902267/domains/holyhimalayayatra.com/public_html/admin/
Upload File :
Current File : /home/u243902267/domains/holyhimalayayatra.com/public_html/admin/profile.php

<?php 
include('include/header.php');
include('include/sidebar.php');

$show = $conn->query("SELECT * FROM admin");
$admindata = $show->fetch_assoc();

if (isset($_POST['user_submit'])) {
  $username=$_POST['username'];
  $useremail=$_POST['useremail'];
  $userphone=$_POST['userphone'];
  $password=md5($_POST['password']);
  if ($show->num_rows > 0) {
   $sql="UPDATE admin SET username='$username',email='$useremail',contact='$userphone'";
 }else{
  $sql = "INSERT INTO admin(username,contact,email,password) VALUES('$username','$userphone','$useremail','$password')";
}
if ($conn->query($sql)) {
  echo '<script>alert("Save Changes Successfully");location.href="profile";</script>';
}
else {
  echo '<script>alert("Something Wrong");</script>';
}
}

if (isset($_POST['setting'])) {
  $brand_name=$_POST['brand_name'];
  $contact=$_POST['contact'];
  $alt_contact=$_POST['alt_contact'];
  $email=$_POST['email'];
  $address=$_POST['address'];
  $alt_address=$_POST['alt_address'];
  $about_company=$_POST['about_company'];
  $id=$_POST['setting_id'];
  $logo = $_FILES['logo']['name'];
  if ($logo!='') {
    $path = 'uploads/'.time().$logo;
    unlink($logo);
  }else{
    $path=$_POST['brand_logo'];
  }
  if ($id!='') {
   $sql="UPDATE settings SET brand_name='$brand_name',email='$email',contact='$contact',alt_contact='$alt_contact',address='$address',alt_address='$alt_address',about_company='$about_company',logo='$path'";
 }else{
  $sql = "INSERT INTO settings(brand_name,logo,contact,contact,email,address,alt_address,about_company) VALUES('$brand_name','$path','$contact','$alt_contact','$email','$address','$alt_address','$about_company')";
}
if ($conn->query($sql)) {
  move_uploaded_file($_FILES['logo']['tmp_name'], $path);
  echo '<script>alert("Save Changes Successfully");location.href="profile";</script>';
}
else {
  echo '<script>alert("Something Wrong");</script>';
}
}
?>
<!--start content-->
<main class="page-content">
  <div class="row">
    <div class="col-12 col-lg-8">
      <div class="card shadow-sm border-0">
        <div class="card-body">
          <h5 class="mb-0">My Account</h5>
          <hr>
          <div class="card shadow-none border">
            <div class="card-header">
              <h6 class="mb-0">USER INFORMATION</h6>
            </div>
            <div class="card-body">
              <form class="row g-3" method="post">
               <div class="col-md-6">
                <label class="form-label">Username</label>
                <input type="text" class="form-control" name="username" value="<?=$admindata['username'];?>" required>
              </div>
              <div class="col-md-6">
                <label class="form-label">Email address</label>
                <input type="email" class="form-control" name="useremail" value="<?=$admindata['email'];?>" required>
              </div>
              <div class="col-md-6">
                <label class="form-label">Phone Number</label>
                <input type="number" class="form-control" name="userphone" value="<?=$admindata['contact'];?>" required>
              </div>
              <?php if ($show->num_rows==0) { ?>
                <div class="col-md-6">
                  <label class="form-label">Password</label>
                  <input type="text" class="form-control" name="password" required>
                </div>
              <?php } ?>
              <div class="col-md-12">
                <button type="submit" class="btn btn-primary px-4" name="user_submit"  value="1">Save Changes</button>
              </div>
            </form>
          </div>
        </div>
        <div class="card shadow-none border">
          <div class="card-header">
            <h6 class="mb-0">CONTACT INFORMATION</h6>
          </div>
          <div class="card-body">
            <form class="row g-3" method="post" enctype="multipart/form-data">
              <div class="col-md-6">
                <label class="form-label">Brand Name</label>
                <input type="hidden" name="setting_id" value="<?=$setting['id']; ?>">
                <input type="text" name="brand_name" class="form-control" value="<?=$setting['brand_name']; ?>">
              </div>
              <div class="col-md-6">
                <label class="form-label">Brand Logo</label>
                <input type="hidden" class="form-control" name="brand_logo" value="<?=$setting['logo']; ?>">
                <input type="file" class="form-control" onchange="readURL(this);" name="logo" accept="image/*">
              </div>
              <div class="col-md-4">
                <label class="form-label">Contact</label>
                <input type="number" class="form-control" name="contact" value="<?=$setting['contact']; ?>">
              </div>
              <div class="col-md-4">
                <label class="form-label">Alt Contact</label>
                <input type="number" class="form-control" name="alt_contact" value="<?=$setting['alt_contact']; ?>">
              </div>
              <div class="col-md-4">
                <label class="form-label">Email</label>
                <input type="email" class="form-control" name="email" value="<?=$setting['email']; ?>">
              </div>
              <div class="col-md-12">
                <label class="form-label">Address</label>
                <textarea class="form-control" rows="4" cols="4" placeholder="Address" name="address"><?=$setting['address']; ?></textarea>
              </div>
              <div class="col-md-12">
                <label class="form-label">Address 2</label>
                <textarea class="form-control" rows="4" cols="4" placeholder="Address" name="alt_address"><?=$setting['alt_address']; ?></textarea>
              </div>
              <div class="col-md-12">
                <label class="form-label">About Company</label>
                <textarea class="form-control" rows="4" cols="4" placeholder="Write..." name="about_company"><?=$setting['about_company']; ?></textarea>
              </div>
              <div class="col-md-6">
                <button type="submit" name="setting" value="1" class="btn btn-primary px-4">Save Changes</button>
              </div>
            </form>
          </div>
        </div>
      </div>
    </div>
  </div>
  <div class="col-12 col-lg-4">
    <div class="card shadow-sm border-0 overflow-hidden">
      <div class="card-body">
        <div class="profile-avatar text-center">
          <img id="preview" src="<?=$setting['logo']; ?>" class="rounded-circle shadow" width="120" height="120" alt="">
        </div>
        <div class="text-center mt-4">
          <h4 class="mb-1"><?=$setting['brand_name']; ?></h4>
          <p class="mb-0 text-secondary"><?=$setting['address']; ?></p>
          <p class="mb-0 text-secondary"><?=$setting['alt_address']; ?></p>
          <div class="mt-4"></div>
        </div>
        <hr>
        <div class="text-start">
          <h5 class="">About</h5>
          <p class="mb-0"><?=$setting['about_company']; ?>
          </div>
        </div>
        <ul class="list-group list-group-flush">
          <li class="list-group-item d-flex justify-content-between align-items-center bg-transparent border-top">
            Contact
            <span class="badge bg-primary rounded-pill"><?=$setting['contact']; ?></span>
          </li>
          <li class="list-group-item d-flex justify-content-between align-items-center bg-transparent border-top">
           Alt Contact
            <span class="badge bg-primary rounded-pill"><?=$setting['alt_contact']; ?></span>
          </li>
          <li class="list-group-item d-flex justify-content-between align-items-center bg-transparent">
            Email
            <span class="badge bg-primary rounded-pill"><?=$setting['email']; ?></span>
          </li>
        </ul>
      </div>
    </div>
  </div><!--end row-->

</main>
<!--end page main-->
<?php include('include/footer.php');?>

Zerion Mini Shell 1.0