%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/tjamichg/chatbot.tjamich.gob.mx/conexion/
Upload File :
Create Path :
Current File : /home/tjamichg/chatbot.tjamich.gob.mx/conexion/asesor.php

<?php
//session_start();
header("Access-Control-Allow-Origin: *");
header("Content-Type: application/json charset=utf-8");

require("conexion.php");

$input = json_decode(file_get_contents("php://input"), true);

if (!isset($input["telefono"]) || !isset($input["mensaje"])) {
    echo json_encode(["status" => "error", "msg" => "Faltan datos"]);
    exit;
}

$telefono = $input["telefono"];
$mensaje = $input["mensaje"];
$hora = $input["hora"] ?? date("Y-m-d H:i:s");

//guardar la solicitud
$sql = "INSERT INTO asesoramiento (telefono, mensaje, hora) VALUES (?, ?, ?)";
$stmt = $conexion->prepare($sql);
$stmt->bind_param("sss", $telefono, $mensaje, $hora);
$stmt->execute();
$stmt->close();
$conexion->close();

echo json_encode(["status" => "ok", "msg" => "Solicitud enviada al asesor"]);
?>

Zerion Mini Shell 1.0