Server IP : 103.53.40.154 / Your IP : 13.59.87.145 Web Server : Apache System : Linux md-in-35.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 User : ppcad7no ( 715) PHP Version : 8.2.25 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home2/ppcad7no/comfortaircon.co/assets/../../.subaccounts/../shsindia.com/crm/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php include_once('include/config.php'); if (!isLoggedIn()) { $_SESSION['msg'] = "You must log in first"; header('location: login.php'); } if (!isAdmin()) { $_SESSION['msg'] = "You are not Admin"; header('location: login.php'); } if(isset($_POST['submit'])) { $profile = $_FILES['profile']['name']; $name = $_POST['name']; $email = $_POST['email']; $phone = $_POST['phone']; $tech_name = $_POST['tech_name']; $tech_email = $_POST['tech_email']; $tech_phone = $_POST['tech_phone']; $bank_name = $_POST['bank_name']; $bank_number = $_POST['bank_number']; $bank_ifsc = $_POST['bank_ifsc']; $bank_branch = $_POST['bank_branch']; $gst = $_POST['gst']; $address = $_POST['address']; $username = $_POST['username']; $password = $_POST['password']; $about_u = $_POST['about_u']; // Handle image uploads $allowed_extensions = ['jpg', 'jpeg', 'png']; // Check and upload profile image if($profile != '') { $profile_extension = pathinfo($profile, PATHINFO_EXTENSION); if (in_array($profile_extension, $allowed_extensions)) { $profile_new_name = 'profile_' . date('YmdHis') . '.' . $profile_extension; move_uploaded_file($_FILES['profile']['tmp_name'], 'images/' . $profile_new_name); } else { die("Invalid profile image file format. Allowed formats are jpg, jpeg, png"); } } // Check if an existing profile image needs to be removed $sql_select = "SELECT profile FROM login_tbl WHERE id='2'"; $result_select = mysqli_query($db, $sql_select); $row = mysqli_fetch_assoc($result_select); $existing_profile = $row['profile']; if($profile != '' && isset($existing_profile)) { // Delete the existing profile image unlink('images/' . $existing_profile); } // Construct the SQL update query $sql = "UPDATE `login_tbl` SET `name`='$name', `email`='$email', `phone`='$phone', `gst`='$gst', `address`='$address', `username`='$username', `password`='$password', `tech_name`='$tech_name', `tech_phone`='$tech_phone', `tech_email`='$tech_email', `bank_name`='$bank_name', `bank_number`='$bank_number', `bank_branch`='$bank_branch', `bank_ifsc`='$bank_ifsc', `about_u`='$about_u'"; // Add profile image field only if it is updated if(isset($profile_new_name)) $sql .= ", `profile`='$profile_new_name'"; // Close the SQL query with Company WHERE clause $sql .= " WHERE id='2'"; $result = mysqli_query($db, $sql) or die("Query unsuccessful"); if($result){ echo ("<script> window.alert('Successfully Updated'); window.location.href='manage-company.php'; </script>"); mysqli_close($db); } else { echo "Error"; } } ?> <?php $sqlprof = "SELECT * FROM login_tbl WHERE id='2'"; $runprof = mysqli_query($db,$sqlprof) or die("Query Not run"); $dataprof = mysqli_fetch_assoc($runprof); ?> <!DOCTYPE html> <html lang="en"> <head> <?php include "top-links.php";?> </head> <body> <!-- Begin page --> <div class="wrapper"> <?php include "header.php";?> <?php include "sidebar.php";?> <div class="content-page"> <div class="content"> <!-- Start Content--> <div class="container-fluid"> <!-- start page title --> <div class="row"> <div class="col-sm-12"> <div class="profile-bg-picture" style="background-image:url('assets/images/bg-profile.jpg'); display: none;"> <span class="picture-bg-overlay"></span> <!-- overlay --> </div> <!-- meta --> <div class="profile-user-box" style="margin-top: 0px;"> <div class="row"> <div class="col-sm-6"> <div class="profile-user-img"> <img src="images/<?php echo $dataprof['profile'];?>" alt="" style="background: #1a2942;"> <!--<img src="" alt="" class="avatar-lg rounded-circle">--> </div> <div class=""> <h4 class="mt-4 fs-17 ellipsis"><?php echo $dataprof['name'];?></h4> <!--<p class="font-13"> User Experience Specialist</p>--> <!--<p class="text-muted mb-0"><small>California, United States</small></p>--> </div> </div> <!--<div class="col-sm-6">--> <!-- <div class="d-flex justify-content-end align-items-center gap-2">--> <!-- <button type="button" class="btn btn-soft-danger">--> <!-- <i class="ri-settings-2-line align-text-bottom me-1 fs-16 lh-1"></i>--> <!-- Edit Profile--> <!-- </button>--> <!-- <a class="btn btn-soft-info" href="#"> <i class="ri-check-double-fill fs-18 me-1 lh-1"></i> Following</a>--> <!-- </div>--> <!--</div>--> </div> </div> <!--/ meta --> </div> </div> <!-- end row --> <div class="row"> <div class="col-sm-12"> <div class="card p-0"> <div class="card-body p-0"> <div class="profile-content"> <ul class="nav nav-underline nav-justified gap-0"> <li class="nav-item"><a class="nav-link active" data-bs-toggle="tab" data-bs-target="#aboutme" type="button" role="tab" aria-controls="home" aria-selected="true" href="#aboutme">Update Company</a> <!--</li><li class="nav-item"><a class="nav-link" data-bs-toggle="tab" data-bs-target="#edit-profile" type="button" role="tab" aria-controls="home" aria-selected="true" href="#edit-profile">Settings</a></li>--> <!--<li class="nav-item"><a class="nav-link" data-bs-toggle="tab" data-bs-target="#projects" type="button" role="tab" aria-controls="home" aria-selected="true" href="#projects">Projects</a></li>--> </ul> <div class="tab-content m-0 p-4"> <div class="tab-pane active" id="aboutme" role="tabpanel" aria-labelledby="home-tab" tabindex="0"> <form action="<?php $_PHP_SELF?>" method="POST" enctype="multipart/form-data"> <div class="row row-cols-sm-2 row-cols-1"> <div class="card-header col-md-12"> <h4 class="header-title">General Details</h4> </div> <div class="mb-2"> <img src="images/<?php echo $dataprof['profile'];?>" width="90px;"> </div> <div class="mb-2"> <label class="form-label" for="FullName">Company Logo</label> <input type="file" class="form-control" name="profile"> </div> <div class="mb-2"> <label class="form-label" for="FullName">Company Name</label> <input type="text" name="name" value="<?php echo $dataprof['name'];?>" class="form-control"> </div> <div class="mb-3"> <label class="form-label" for="Email">Company Email</label> <input type="email" name="email" value="<?php echo $dataprof['email'];?>" class="form-control"> </div> <div class="mb-3"> <label class="form-label" for="web-url">Company Phone Number</label> <input type="text" name="phone" value="<?php echo $dataprof['phone'];?>" class="form-control"> </div> <div class="mb-3"> <label class="form-label" for="web-url">GST No.</label> <input type="text" name="gst" value="<?php echo $dataprof['gst'];?>" class="form-control"> </div> <div class="col-sm-12 mb-3"> <label class="form-label" for="web-url">Registered Office Address</label> <textarea name="address" style="height: 100px;" class="form-control"><?php echo $dataprof['address'];?></textarea> </div> <div class="col-sm-12 mb-3"> <label class="form-label" for="AboutMe">About Company</label> <textarea name="about_u" style="height: 125px;" class="form-control"><?php echo $dataprof['about_u'];?></textarea> </div> <div class="card-header col-md-12"> <h4 class="header-title">Technical Person Details</h4> </div> <div class="mb-2"> <label class="form-label" for="FullName">Technical Person Name</label> <input type="text" name="tech_name" value="<?php echo $dataprof['tech_name'];?>" class="form-control"> </div> <div class="mb-3"> <label class="form-label" for="Email">Technical Person Email</label> <input type="email" name="tech_email" value="<?php echo $dataprof['tech_email'];?>" class="form-control"> </div> <div class="mb-3"> <label class="form-label" for="web-url">Technical Person Phone Number</label> <input type="text" name="tech_phone" value="<?php echo $dataprof['tech_phone'];?>" class="form-control"> </div> <div class="card-header col-md-12"> <h4 class="header-title">Account Details</h4> </div> <div class="col-md-6 mb-3"> <label class="" for="userName">Bank Name</label> <div> <input type="text" class="form-control" id="userName" name="bank_name" value="<?php echo $dataprof['bank_name']?>"> </div> </div> <div class="col-md-6 mb-3"> <label class="" for="userName">Account Number</label> <div> <input type="text" class="form-control" id="userName" name="bank_number" value="<?php echo $dataprof['bank_number']?>"> </div> </div> <div class="col-md-6 mb-3"> <label class="" for="userName">Branch Name</label> <div> <input type="text" class="form-control" id="userName" name="bank_branch" value="<?php echo $dataprof['bank_branch']?>"> </div> </div> <div class="col-md-6 mb-3"> <label class="" for="userName">IFSC Code</label> <div> <input type="text" class="form-control" id="userName" name="bank_ifsc" value="<?php echo $dataprof['bank_ifsc']?>"> </div> </div> <div class="card-header col-md-12"> <h4 class="header-title">Login Details</h4> </div> <div class="col-sm-6 mb-3"> <label class="form-label" for="Username">Username</label> <input type="text" name="username" value="<?php echo $dataprof['username'];?>" class="form-control"> </div> <div class="col-sm-6 mb-3"> <label class="form-label" for="Password">Password</label> <span><i id="password-toggle" class="ri-eye-off-line fs-22" onclick="togglePasswordVisibility()"></i></span> <input id="password" type="password" name="password" value="<?php echo $dataprof['password'];?>" class="form-control"> </div> </div> <button class="btn btn-primary" type="submit" name="submit"><i class="ri-save-line me-1 fs-16 lh-1"></i> Save</button> </form> </div> <!-- about-me --> </div> </div> </div> </div> </div> </div> <!-- end page title --> </div> <!-- end row --> </div> <!-- container --> </div> </div> <script> function togglePasswordVisibility() { var passwordField = document.getElementById('password'); var passwordToggle = document.getElementById('password-toggle'); if (passwordField.type === 'password') { passwordField.type = 'text'; passwordToggle.className = 'ri-eye-line fs-22'; } else { passwordField.type = 'password'; passwordToggle.className = 'ri-eye-off-line fs-22'; } } </script> <?php include "footer.php";?> </body> </html>