if (isset($_POST['inputNombreEmpresa']) and isset($_POST['inputDireccionEmpresa']) and isset($_POST['inputNumeroTelefono']) and isset($_POST['inputNombreRecl']) and isset($_POST['inputNumeroTelefonoRecl']) and isset($_POST['inputEmail']) and isset($_POST['inputApellidoRecl'])) {
     $nombreRecl = $_POST['inputNombreRecl'];
     $apellidoRecl = $_POST['inputApellidoRecl'];
     $numeroTelRecl = $_POST['inputNumeroTelefonoRecl'];
     $correo = $_POST['inputEmail'];
     $pass = $_POST['inputPassword'];
     $pass2 = $_POST['inputPassword2'];
     $nombreEmpresa = $_POST['inputNombreEmpresa'];
     $telEmpresa = $_POST['inputNumeroTelefono'];
     $web = $_POST['inputWeb'];
     $direccion = $_POST['inputDireccionEmpresa'];
     $logo = $_FILES['inputLogo'];
     $query = "INSERT INTO RECLUTADOR (RECL_NOMBRES, RECL_APELLIDOS, RECL_TELEFONO, RECL_EMAIL) \n\t\t\t\t\t\t\tVALUES ('{$nombreRecl}','{$apellidoRecl}','{$numeroTelRecl}','{$correo}')";
     if ($conexion->insert($query)) {
         $RECL_ID = $conexion->rowId();
         $fullPathImage = subirImagen($logo);
         if ($pass == $pass2) {
             $query = "INSERT INTO USUARIO(USUA_NOMBREUSUARIO, USUA_PASSWORD, PERF_ID, USUA_ESTADO) \n\t\t\t\t\t\t\t\t\tVALUES ('{$nombreRecl}','{$pass}',4,1)";
             if ($conexion->insert($query)) {
                 $usuaId = $conexion->rowId();
                 $query = "INSERT INTO EMPRESA(EMPR_ID, EMPR_NOMBREEMPRESA, EMPR_TELEFONO, EMPR_PAGINAWEB, EMPR_DIRECCION, EMPR_LOGO, RECL_ID) \n\t\t\t\t\t\t\t\t\t\tVALUES ({$usuaId},'{$nombreEmpresa}','{$telEmpresa}','{$web}','{$direccion}','{$fullPathImage}',{$RECL_ID})";
                 if ($conexion->insert($query)) {
                     echo '<script>window.location="EmpresaPrincipal.php"</script>';
                 } else {
                     echo "error al crear empresa";
                 }
             } else {
                 echo "Error al crear usuario";
             }
         } else {
             echo "las contraseñas no coinciden";
require_once '../../conexion/Conexion.php';
require_once '../../conexion/DatosConexion.php';
require_once '../SubirImagen.php';
session_start();
if (isset($_POST) and !empty($_POST)) {
    $conexion = new Conexion($hostname, $user, $password, $dataBase);
    if ($conexion->connect()) {
        if (isset($_POST['direccion']) and !empty($_POST['direccion']) and isset($_POST['telefono']) and !empty($_POST['telefono']) and isset($_POST['fechaNacimiento']) and !empty($_POST['fechaNacimiento']) and isset($_FILES['fotografia'])) {
            $estudianteId = $_SESSION['idUsuario'];
            $direccion = $_POST['direccion'];
            $telefono = $_POST['telefono'];
            $fechaNacimiento = $_POST['fechaNacimiento'];
            $fechaNacimiento = str_replace("/", "-", $fechaNacimiento);
            $fotografia = $_FILES['fotografia'];
            if (!empty($fotografia['tmp_name'])) {
                $fullPathImage = subirImagen($fotografia);
                if (!empty($fullPathImage)) {
                    $query = "UPDATE CURRICULO SET CURRI_FOTOGRAFIA='{$fullPathImage}', CURRI_DIRECCION='{$direccion}', CURRI_TELEFONO='{$telefono}' ,CURRI_FECHANACIMIENTO='{$fechaNacimiento}' WHERE ESTU_ID={$estudianteId}";
                }
            } else {
                $query = "UPDATE CURRICULO SET CURRI_DIRECCION='{$direccion}', CURRI_TELEFONO='{$telefono}' ,CURRI_FECHANACIMIENTO='{$fechaNacimiento}' WHERE ESTU_ID='{$estudianteId}'";
            }
            if ($conexion->update($query)) {
                echo "0";
            } else {
                echo "1";
            }
        } else {
            echo "2";
        }
        $conexion->close();