<?php require "php/cabecera3.inc";
	
	if(isset($_SESSION['usuario'])){
		echo "<META HTTP-EQUIV='Refresh' CONTENT='0; URL=index.php?IDS=$IDS'>";
		exit();
	}
	
	$form="<br><CENTER><h1>Información</h1><br><br><TABLE><form action='pp.php' method='post'>
	<TR><TD><span style='float:right'>* Email </span></td><td><input type='text' name='ema' required='required' maxlength='30' value='$_POST[ema]'></TD></TR>	
	<TR><TD><span style='float:right'>* Nombre </span></td><td><input type='text' name='nom' required='required' maxlength='100' value='$_POST[nom]'></TD></TR>	                                  
	<TR><TD><span style='float:right'>* Teléfono </span></td><td><input type='text' name='tel' required='required' maxlength='20' value='$_POST[tel]'></TD></TR>
	<TR><TD><span style='float:right'>* Calle </span></td><td><input type='text' name='calle' required='required' maxlength='50' value='$_POST[calle]'></TD></TR>
	<TR><TD><span style='float:right'>* Número exterior</span></td><td><input type='text' name='nex' required='required' maxlength='10' value='$_POST[nex]'></TD></TR>
	<TR><TD><span style='float:right'>* Colonia </span></td><td><input type='text' name='col' required='required' maxlength='50' value='$_POST[col]'></TD></TR>
	<TR><TD><span style='float:right'>* Código Postal</span></td><td><input type='text' name='cp' required='required' maxlength='10' value='$_POST[cp]'></TD></TR>
	<TR><TD><span style='float:right'>* Ciudad </span></td><td><input type='text' name='mun' required='required' maxlength='30' value='$_POST[mun]'></TD></TR>
	<TR><TD><span style='float:right'>* Estado</span></td><td><input type='text' name='est' required='required' maxlength='20' value='$_POST[est]'></TD></TR>
	<TR><TD><span style='float:right'>* País</span></td><td><input type='text' name='pais' required='required' maxlength='20' value='$_POST[pais]' ></TD></TR>
	<TR><TD><span style='float:right'>RFC </span></td><td><input type='text' name='rfc' maxlength='50' value='$_POST[rfc]'></TD></TR>
	
	<input type='hidden' name='IDS' value='$IDS'>
	<input type='hidden' name='respuesta' value='1'>
	<TR><TD colspan='2'><CENTER><input type='submit' class='btn' STYLE='float:center;' value='Ok'><CENTER></TD></TR>		
	</form></TABLE></CENTER>";
	
	if(isset($_POST['respuesta'])){
		
		$val=true;
		$msg = "";
		if((!filter_var($_POST['ema'], FILTER_VALIDATE_EMAIL))){$val=false;$msg=$msg."Email inválido.\\n";}
		
		if(!$val){echo "<script>alert('$msg')</script>";echo $form;}		
		else{
			echo "<FORM id='formx' ACTION='check.php' method='POST'>";
			foreach($_POST as $key => $value){
			echo "<INPUT TYPE='HIDDEN' NAME='$key' VALUE='$value'/>";}
			echo "<INPUT TYPE='HIDDEN' NAME='IDS' VALUE='$IDS'/>";
			echo "</FORM><SCRIPT>document.getElementById(\"formx\").submit();</SCRIPT>";
		}
	}
	else{
		echo $form;
	}
	
	require "php/pie.inc";
?>