-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathingresarDatos.php
More file actions
25 lines (23 loc) · 810 Bytes
/
Copy pathingresarDatos.php
File metadata and controls
25 lines (23 loc) · 810 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
include("conexion.php");
if(!$conexion)
{
echo 'Error en la conexion';
}
else
{
echo 'Conectado a la base de datos <br>';
}
//para prevenir mysql injection
session_start();
$gas= mysqli_real_escape_string($conexion, $_POST['Gas']);
$temperatura= mysqli_real_escape_string($conexion, $_POST['Temperatura']);
$humedad= mysqli_real_escape_string($conexion, $_POST['Humedad']);
date_default_timezone_set("UTC");
$fecha= date("Y/m/j");
$idSiloEmpleado = $_SESSION['idSiloEmpleado'];
$sql_insert = "INSERT INTO registro (idSiloEmpleado,fecha,temperatura,humedad,gas)
VALUES ('$idSiloEmpleado','$fecha','$temperatura','$humedad','$gas');";
$query= mysqli_query($conexion,$sql_insert);
header("Location:index.php");
?>