All pastes #467985 Raw Edit

Untitled

public php v1 · immutable
·published 2007-05-02 20:49 UTC
rendered paste body
<?require("includes/ConfigFile.php");require("includes/DBClass.php");$objDb=new DBClass($appConfig["HOST"],$appConfig["USUARIO"],$appConfig["PASSWORD"],$appConfig["DATABASE"]);$objDb->Conectar();if (isset($_POST['send'])) {	if($_POST['send']<>""){         $strSqlQuery="SELECT * FROM autor where ".chr(34)."Id_autor".chr(34)."='".$_POST['textid']."'";	 $objrscategoria=$objDb->GetSelect($strSqlQuery); 	 if($objrscategoria->get_recordcount()>0){ ?>		<script>	        alert("Error el ID digitado ya existe en el sistema");		history.back();		</script>       <?  die();		}                $arrayDatosForm=array(		0=>stripslashes($_POST["textid"]),		1=>stripslashes($_POST["textnom"]),		2=>stripslashes($_POST["textapell"]),		3=>stripslashes($_POST["textnac"]),		4=>stripslashes($_POST["textfech"]),                );		$strCampos=chr(34)."Id_autor".chr(34)."||".chr(34)."Nombre_autor".chr(34)."||".chr(34)."Apellido_autor".chr(34)."||".chr(34)."Nacionalidad_autor".chr(34)."||".chr(34)."Ano_nacimiento_autor".chr(34);		$strNombreTabla="autor";		$strValores="'".addslashes($arrayDatosForm[0]).					"'||'".addslashes($arrayDatosForm[1]).					"'||'".addslashes($arrayDatosForm[2]).					"'||'".addslashes($arrayDatosForm[3]).					"'||'".addslashes($arrayDatosForm[4])."'";		$objDb->Insertar($strNombreTabla, $strCampos, $strValores);	header("Location: manautor.php");	}}	 $strSqlQuery="select  (max(".chr(34)."Id_autor".chr(34).")+1) as maximo from autor";	 $objmax =$objDb->GetSelect($strSqlQuery);	if ($objmax->get_recordcount()>0){	 $idautor=$objmax->field("maximo");	}else{	 $idautor=1;		}?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><script language="javascript">	function validate(me){		if ((me.textnom.value=="")){			alert(" Error, Nombre es un campo requerido.");			me.textnom.focus();			return false;		}		if ((me.textapell.value=="")){			alert("Error, Apellido es un campo requerido .");			me.textapell.focus();			return false;		}		if ((me.textnac.value=="")){			alert("Error,la nacionalidad es un campo requerido.");			me.textnac.focus();			return false;		}		if ((me.textfech.value=="")){   			alert(" Error, fecha de nacimiento un campo requerido.");			me.textfech.focus();			return false;		}	return (true)	}</script><title>administrar</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head><body bgcolor="SILVER"><FORM action="manautor.php" method="POST" name="inautor" onSubmit="return validate(this);"><h2 align="center">ADMINISTRACION BASE DE DATOS</h2><hr align="center"><br><br><table align="center"><tr><th colspan="3" bgcolor="9999FF">TABLA AUTOR</th></body><Tr><TD align="center" bgcolor="gray" width="215">Id Autor: </TD><td><input type="text" name="textid" align="bottom" value="<?=$idautor?>" readonly="true"></td><td bgcolor="gray" width="215"></td></Tr><Tr><TD align="center" bgcolor="gray" width="215">Nombre Autor: </TD><td><input type="text" name="textnom" align="bottom"></td><td bgcolor="gray" width="215"></td></Tr><Tr><TD align="center" bgcolor="gray" width="215">Apellido Autor: </TD><td><input type="text" name="textapell" align="bottom"></td><td bgcolor="gray" width="215"></td></Tr><Tr><TD align="center" bgcolor="gray" width="215">Nacionalidad Autor: </TD><td><input type="text" name="textnac" align="bottom"></td><td bgcolor="gray" width="215"></td></Tr><Tr><TD align="center" bgcolor="gray" width="215">A&ntilde;o de Nacimiento: </TD><td><input type="text" name="textfech" align="bottom" maxlength="4"></td><td bgcolor="gray" width="215"></td></Tr><tr><TD align="center"><input type="submit" name="insertar" value="Insertar"></TD><TD align="center"><input type="submit" name="consultar" value="Consultar"><input type="hidden" name="consult" value="enviar"></TD><TD align="center"><input type="reset" name="limpiar" value="Borrar"><input type="hidden" name="send" value="enviar"></TD></tr></table>                          </FORM><?if (isset($_POST['consult'])){$strSqlQuery ="SELECT * FROM autor";echo $strSqlQuery;$objrscategoria=$objDb->GetSelect($strSqlQuery);	if ($objrscategoria->get_recordcount()>0){?><table align="center" width="450"><tr><TD>ID AUTOR</TD><TD>NOMBRE AUTOR</TD><TD>APELLIDO AUTOR</TD><TD>NACIONALIDAD</TD><TD>ANO NACIMINETO</TD></tr> <?        while (!$objrscategoria->EOF()){ ?><TR><TD><?=$objrscategoria->field("Id_autor")?></TD><TD><?=$objrscategoria->field("Nombre_autor")?></TD><TD><?=$objrscategoria->field("Apellido_autor")?></TD><TD><?=$objrscategoria->field("Nacionalidad_autor")?></TD><TD><?=$objrscategoria->field("Ano_nacimiento_autor")?></TD><TD><a href="carretilla.php?idautor=<?=$objrscategoria->field("Id_autor")?>">CARRETILLA</a></TD></TR><?$objrscategoria->movenext();       }        ?></table><?		 }else{?><table width="300" align="center"><td>la busqueda no devolvio resultados</td></table><?}                    }?></body></html>