<?php
session_start();
include ('conexion/config.php');
include ('php/funciones.php');
include ('php/funciones_clientes.php');

if (CheckSesion($_SESSION, 'emailUser') == true) {

    $numContacto = UltimoNumContacto($con,$_GET["IdCli"]) + 1;
    

    $nombre = "'".$_GET["nombre"]."'";
    $movil = "'".$_GET["movil"]."'";
    $email = "'".$_GET["email"]."'";
    $idcli = $_GET["IdCli"];
    
    $queryInsertUser = ('INSERT INTO contactos(con_nombre,con_movil,con_email,con_idcli,con_orden)     
						 VALUES ('.$nombre.','.$movil.','. $email.','.$idcli.','.$numContacto.')');    
    echo $queryInsertUser;

    
    $resultInsertUser = mysqli_query($con, $queryInsertUser);
    
    $url_cliente = 'clientes.php?id=' . $_GET["IdCli"];

    header("Location:".$url_cliente);
    
} else {
    header("Location:login/login.php");
}