First commit ~0,10
This commit is contained in:
296
tmp/artistas.php
Normal file
296
tmp/artistas.php
Normal file
@ -0,0 +1,296 @@
|
||||
<?
|
||||
if ( $user_auth && $user_level <= -1 )
|
||||
{
|
||||
$blq1 ="Nombre,Apellido,Instrumento,url,comentario";
|
||||
$blq2 ="e_Mail,NIF,Calle,Localidad,Provincia,CP,Telefono1,Telefono2,FechaNacimiento";
|
||||
|
||||
$list = true;
|
||||
|
||||
if ( isset( $sins ) )
|
||||
{
|
||||
displayForm( "./?dgo=artistas.php&ins=new" );
|
||||
$list = false;
|
||||
}
|
||||
if ( isset( $smod ) )
|
||||
{
|
||||
$res = @mysql_query( "SELECT id,$blq1,$blq2 FROM artistas WHERE id=$smod", $conexion );
|
||||
$datos = @mysql_fetch_array( $res );
|
||||
|
||||
list( $db_id, $db_nombre,$db_apellidos,$db_instrumento,$db_url,$db_comentario,
|
||||
$db_email,$db_nif,$db_calle,$db_localidad,$db_provincia,$db_cp,$db_tlf1,$db_tlf1,$db_fechaN ) = $datos;
|
||||
|
||||
displayForm( "./?dgo=artistas.php&mod=$mod" );
|
||||
$list = false;
|
||||
}
|
||||
if ( isset( $mod ) )
|
||||
{
|
||||
$sql = "UPDATE artistas SET ".
|
||||
"Nombre='$db_nombre' ".
|
||||
",Apellido='$db_apellidos' ".
|
||||
",Instrumento='$db_instrumento' ".
|
||||
",url='$db_url' ".
|
||||
",comentario='".urlencode($db_comentario)."' ".
|
||||
|
||||
",e_Mail='$db_email' ".
|
||||
",NIF='$db_nif' ".
|
||||
",Calle='$db_calle' ".
|
||||
",Localidad='$db_localidad' ".
|
||||
",Provincia='$db_provincia' ".
|
||||
",CP='$db_cp' ".
|
||||
",Telefono1='$db_tlf2' ".
|
||||
",Telefono2='$db_tlf1' ".
|
||||
",FechaNacimiento='$db_ano/$db_mes/$db_dia' ".
|
||||
" WHERE id=$mod";
|
||||
$res = @mysql_query( $sql, $conexion );
|
||||
$list = true;
|
||||
}
|
||||
if( isset( $ins ) )
|
||||
{
|
||||
$sql = "INSERT INTO artistas (FAlta, $blq1,$blq2) VALUES (NOW(),'$db_nombre','$db_apellidos','$db_instrumento','$db_url','".urlencode($db_comentario).
|
||||
"','$db_email','$db_nif','$db_calle','$db_localidad','$db_provincia','$db_cp','$db_tlf1','$db_tlf1','$db_ano/$db_mes/$db_dia')";
|
||||
$res = @mysql_query( $sql, $conexion ) OR die( "Error<br>".@mysql_error($conexion) );
|
||||
echo "<h1>Artista insertado</h1><br><br><br>";
|
||||
echo "<p class=remark>ID asignado = ".@mysql_insert_id($conexion)."</p>";
|
||||
$list = true;
|
||||
}
|
||||
if( isset( $del ) )
|
||||
{
|
||||
$res = @mysql_query( "DELETE FROM artistas WHERE id=$del" );
|
||||
$list = true;
|
||||
}
|
||||
|
||||
if ( isset( $list ) && $list )
|
||||
{
|
||||
if ( !isset($orderBy) ) $orderBy ="id";
|
||||
if ( !isset($orderDir) ) $orderDir ="ASC";
|
||||
|
||||
displayList($conexion, $orderBy, $orderDir);
|
||||
}
|
||||
displayMenu();
|
||||
}
|
||||
|
||||
|
||||
function displayList($cnx, $orderBy, $orderDir)
|
||||
{
|
||||
$thisLOCATION = "./?dgo=artistas.php";
|
||||
$res = @mysql_query( "SELECT id, CONCAT(Apellido,', ',Nombre) Nombre, Telefono1, Telefono2 FROM artistas ORDER BY $orderBy $orderDir" );
|
||||
|
||||
echo "<table width=100%>";
|
||||
|
||||
echo "<td class=lmenuo>id <a href=\"$thisLOCATION&oderBy=id&orderDir=DESC\"><img src=\"images/actions/down.gif\" border=0></a><a href=\"$thisLOCATION&oderBy=id&orderDESC=ASC\"><img src=\"images/actions/up.gif\" border=0></a></td>".
|
||||
"<td class=lmenuo>Nombre <a href=\"$thisLOCATION&oderBy=Apellidos+Nombre&orderDir=DESC\"><img src=\"images/actions/down.gif\" border=0></a><a href=\"$thisLOCATION&oderBy=Apellidos+Nombre&orderDESC=ASC\"><img src=\"images/actions/up.gif\" border=0></a></td>".
|
||||
"<td class=lmenuo>Telefonos</td>".
|
||||
"<td class=lmenuo>Borrar</td>";
|
||||
while( $datos=@mysql_fetch_array($res) )
|
||||
{
|
||||
list ( $db_id, $db_nombre, $db_tlf1, $db_tlf2 )= $datos;
|
||||
echo "<tr><td><a href=\"./?dgo=artistas.php&smod=$db_id\">$db_id</a></td><td>$db_nombre</td><td>$db_tlf1 # $db_tlf2</td><td><a href=\"javascript::deleteUser($db_id)\"><img src=\"images/actions/cancel.gif\" border=0></a></td></tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
echo '<script language="JavaScript">
|
||||
function deleteUser( which )
|
||||
{
|
||||
var submitOK = confirm("Atencion: Esta a punto de eliminar al artista.");
|
||||
if ( submitOK )
|
||||
document.location.href = "'.$thisLOCATION.'&orderBy='.$orderBy.'&orderDir='.$orderDir.'&del="+which;
|
||||
}
|
||||
</script>';
|
||||
}
|
||||
|
||||
function displayMenu()
|
||||
{
|
||||
echo '<hr noshade color="#800000">';
|
||||
echo '<p align="center"><a href="./?dgo=artistas.php&sins=new">Insertar nuevo artista</a></p>';
|
||||
echo '<hr noshade color="#800000">';
|
||||
}
|
||||
|
||||
function displayForm( $form_action )
|
||||
{
|
||||
global $db_nombre, $db_apellidos, $db_instrumento, $db_url, $db_comentario;
|
||||
global $db_email, $db_nif, $db_calle, $db_localidad, $db_provincia, $db_cp, $db_tlf1, $db_tlf2, $db_fechaN;
|
||||
|
||||
// Dividimos la fecha de nacimiento en DIA/MES/A<>O
|
||||
$db_dia = substr($db_fechaN, 8, 2 );
|
||||
$db_mes = substr($db_fechaN, 5, 2 );
|
||||
$db_ano = substr($db_fechaN, 0, 4 );
|
||||
|
||||
echo '<form action="'.$form_action.'" method="POST" name="register" onsubmit="return validateform( this.form )">';
|
||||
echo '<p align="center"> </p><div align="center"><center><table border="0" cellpadding="0" cellspacing="0" width="100%">';
|
||||
echo '<tr>
|
||||
<td><h1>Datos del artista</h1>
|
||||
<p> </p>
|
||||
<table border="0" cellpadding="0" cellspacing="0"
|
||||
width="100%" bgcolor="#800000">
|
||||
<tr>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<table border="0" width="100%">
|
||||
<tr>
|
||||
<td width="30%">Nombre:</td>
|
||||
<td width="20%"><input type="text" size="15"
|
||||
name="db_nombre"
|
||||
value="'.$db_nombre.'"></td>
|
||||
<td valign="top" rowspan="5" width="50%"
|
||||
bgcolor="#B4CCE9" class="tdSuave"><strong>Informaci<63>n
|
||||
del artista</strong><p>Estos son los datos
|
||||
que cualquier usuario de la p<>gina puede
|
||||
consultar. <br>
|
||||
(Cuando Escoja un disco y/o se muestre la
|
||||
informaci<63>n de un Grupo, saldran sus
|
||||
componentes y esta es la informaci<63>n de cada
|
||||
uno de ellos).</p>
|
||||
<p>ATENCION: <20><> Se admiten controles HTML
|
||||
!!, por lo que aconsejamos sea muy cuidadoso
|
||||
con los mismos.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="30%">Apellidos:</td>
|
||||
<td width="20%"><input type="text" size="15"
|
||||
name="db_apellidos"
|
||||
value="'. $db_apellidos .'"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="30%">Instrumento:</td>
|
||||
<td width="20%"><input type="text" size="15"
|
||||
name="db_instrumento"
|
||||
value="'. $db_instrumento .'"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="30%">Fotografia:</td>
|
||||
<td width="20%"><input type="explorer" size="15"
|
||||
name="db_foto"
|
||||
value=""></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>url:</td>
|
||||
<td><input type="text" size="15"
|
||||
name="db_url" value="'.$db_url.'"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" width="30%">Comentarios
|
||||
adicionales:<p><textarea name="db_comentario" rows="5"
|
||||
cols="40">'.urldecode($db_comentario).'</textarea></p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr noshade color="#800000">
|
||||
<table border="0" width="100%">
|
||||
<tr>
|
||||
<td width="30%">email:</td>
|
||||
<td width="20%"><input type="text" size="15"
|
||||
name="db_email"
|
||||
value="'.$db_email.'"></td>
|
||||
<td valign="top" rowspan="9" width="50%"
|
||||
bgcolor="#B4CCE9" class="tdSuave"><strong>Informaci<63>n
|
||||
de contacto</strong><p>Estos datos solo son
|
||||
accesibles por el administrador/es de la p<>gina.
|
||||
Por lo que nadie mas tendr<64> acceso a los
|
||||
mismos.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="30%">NIF:</td>
|
||||
<td width="20%"><input type="text" size="15"
|
||||
name="db_nif"
|
||||
value="'.$db_nif.'"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="30%">Direcci<63>n:</td>
|
||||
<td width="20%"><input type="text" size="15"
|
||||
name="db_calle"
|
||||
value="'.$db_calle.'"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="30%">Localidad:</td>
|
||||
<td width="20%"><input type="text" size="15"
|
||||
name="db_localidad"
|
||||
value="'.$db_localidad.'"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="30%">Provincia:</td>
|
||||
<td width="20%"><input type="text" size="15"
|
||||
name="db_provincia"
|
||||
value="'.$db_provincia.'"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="30%">C<>d. Postal:</td>
|
||||
<td width="20%"><input type="text" size="15"
|
||||
name="db_cp" value="'.$db_cp.'"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="30%">Telefono</td>
|
||||
<td width="20%"><input type="text" size="15"
|
||||
name="db_nacionalidad"
|
||||
value="'.$db_tlf1.'"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Movil:</td>
|
||||
<td><input type="text" size="15"
|
||||
name="db_tlf2"
|
||||
value="'.$db_tlf2.'"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Cumplea<65>os:</td>
|
||||
<td><select name="db_dia" size="1">
|
||||
<option>Dia...</option>';
|
||||
for ( $i=1;$i<32; $i++)
|
||||
{
|
||||
echo "<option "; if ( $i==$db_dia ) echo " SELECTED "; echo ">$i"; echo "</option>";
|
||||
}
|
||||
echo ' </select>
|
||||
<br>
|
||||
<select name="db_mes" size="1">
|
||||
<option>Mes...</option>
|
||||
<option value="1"'.if($db_mes==1)echo" selected ".'>Enero</option>
|
||||
<option value="2"'.if($db_mes==2)echo" selected ".'>Febrero</option>
|
||||
<option value="3"'.if($db_mes==3)echo" selected ".'>Marzo</option>
|
||||
<option value="4"'.if($db_mes==4)echo" selected ".'>Abril</option>
|
||||
<option value="5"'.if($db_mes==5)echo" selected ".'>Mayo</option>
|
||||
<option value="6"'.if($db_mes==6)echo" selected ".'>Junio</option>
|
||||
<option value="7"'.if($db_mes==7)echo" selected ".'>Julio</option>
|
||||
<option value="8"'.if($db_mes==8)echo" selected ".'>Agosto</option>
|
||||
<option value="9"'.if($db_mes==9)echo" selected ".'>Septiembre</option>
|
||||
<option value="10"'.if($db_mes==10)echo" selected ".'>Octubre</option>
|
||||
<option value="11"'.if($db_mes==11)echo" selected ".'>Noviembre</option>
|
||||
<option value="12"'.if($db_mes==12)echo" selected ".'>Diciembre</option>
|
||||
</select><br>
|
||||
<select name="db_ano" size="1">
|
||||
<option>A<>o...</option>';
|
||||
for($i=2003;$i>1900;$i--)
|
||||
{
|
||||
echo "<option"; if ( $i==$db_ano ) echo " SELECTED "; echo ">$i";echo "</option>";
|
||||
}
|
||||
echo '</select></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr noshade color="#800000">
|
||||
<p align="center"><input type="button" name="btCancelar" value="Cancelar"><input
|
||||
type="submit" name="B2" value="Enviar >>"></p>
|
||||
<p><script language="JavaScript"><!--
|
||||
|
||||
function validateform(wf)
|
||||
{
|
||||
|
||||
if (document.register.db_nombre.value=="")
|
||||
{
|
||||
window.alert ("Por favor, introduce el nombre")
|
||||
return false;
|
||||
}
|
||||
if (document.register.db_nif.value=="")
|
||||
{
|
||||
window.alert ("Por favor, introduce el NIF")
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// --></script><br>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center></div>
|
||||
</form>';
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user