/
home
/
u839856410
/
domains
/
frajuuconnect.online
/
public_html
/
Upload File
HOME
<?php session_start(); if(!isset($_SESSION['agent_id'])) { header("Location: login.php"); exit(); } include 'db_connection.php'; // Make sure this path is correct $agent_id = $_POST['agent_id'] ?? 0; $full_name = $conn->real_escape_string($_POST['full_name']); $email = $conn->real_escape_string($_POST['email']); $phone = $conn->real_escape_string($_POST['phone']); $password = $_POST['password']; // If password is not empty, hash it if(!empty($password)){ $password_hashed = password_hash($password, PASSWORD_DEFAULT); $sql = "UPDATE agents SET full_name='$full_name', email='$email', phone='$phone', password='$password_hashed' WHERE id='$agent_id'"; } else { $sql = "UPDATE agents SET full_name='$full_name', email='$email', phone='$phone' WHERE id='$agent_id'"; } if($conn->query($sql)){ // Update session so dashboard shows new info $_SESSION['agent_name'] = $full_name; $_SESSION['agent_email'] = $email; $_SESSION['agent_phone'] = $phone; header("Location: settings.php?msg=success"); exit(); } else { header("Location: settings.php?msg=error"); exit(); }