:: **Zploit** v1.0 | Current Path: **/home/kreativepixelz/tdrbazaar.com/crm/**
:: Editing File: functions.php
<?php /** * Log an administrative notification when a lead changes stages. * * @param mysqli $conn Database connection variable * @param int $lead_id The unique ID of the updated lead * @param string $dealer_name The name of the deal/lead/client * @param string $old_stage The previous stage title * @param string $new_stage The updated stage title * @return bool Returns true on success, false on failure */ function insertAdminNotification($conn, $lead_id, $dealer_name, $old_stage, $new_stage) { // Sanitize inputs to prevent SQL Injection $lead_id = intval($lead_id); $dealer_name = mysqli_real_escape_string($conn, $dealer_name); $old_stage = mysqli_real_escape_string($conn, $old_stage); $new_stage = mysqli_real_escape_string($conn, $new_stage); // Construct the structured title and descriptive text payload[cite: 2] $title = "Lead Stage Updated"; $message = "{$dealer_name} moved from {$old_stage} to {$new_stage}."; // Insert into database with current timestamp (is_read defaults to 0)[cite: 2] $sql = "INSERT INTO admin_notifications (lead_id, dealer_name, old_stage, new_stage, title, message, created_at, is_read) VALUES ($lead_id, '$dealer_name', '$old_stage', '$new_stage', '$title', '$message', NOW(), 0)"; return mysqli_query($conn, $sql); } ?>