HEX
Server: Apache
System: Linux iad1-shared-e1-19 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User: austral3d (14892361)
PHP: 5.6.40
Disabled: NONE
Upload Files
File: /home/austral3d/fourdplan.com/php/insertarcg.php
<?php
require('conexion2.php');
$assembly_id = $_POST['assembly_id'];
$estados = unserialize($_POST['estados']);
$fechainicio = $_POST['fechainicio'];
$fechafin = $_POST['fechafin'];
$consulta = mysql_query("select * from Cartagantt where assembly_id = '".$assembly_id."'");
$resultado = mysql_fetch_array($consulta);
if(!$resultado){
	$a = count($estados);
	$b = 0;
	$c=0;
	while($a > $b){
		if($fechainicio[$b] == ""){
			$c+=1;
		}
		if($fechafin[$b] == ""){
			$c+=1;
		}	
		$b+=1;
	}
	if($c!=0){	
		echo '<script>
				alert("Debe llenar todos los campos")
				location.href="ingresar_fecha_cg.php?asse='.$assembly_id.'";
			</script>';		
	}else{	
		$d = 0;
		while($a > $d){
			mysql_query("INSERT INTO Cartagantt VALUES ('','$assembly_id','$estados[$d]','$fechainicio[$d]','$fechafin[$d]')");
			$d+=1;
		}
		echo '<script>
				alert("Fechas ingresadas correctamente.")
				location.href="cartagantt.php";
			</script>';
	}
}else{
	echo '<script>
			alert("Esta assebly ya tiene fechas.")
			location.href="cartagantt.php";
		</script>';
}
?>