97 lines
		
	
	
		
			4.1 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			97 lines
		
	
	
		
			4.1 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?
 | 
						|
  $thisLOCATION = "./?dgo=registro/list_user.php";
 | 
						|
  if ( $user_auth && $user_level == -2 )
 | 
						|
  {
 | 
						|
    if ( isset( $deleteUser ) )
 | 
						|
    {
 | 
						|
	if ( $usaCorreo ) 
 | 
						|
		echo "Abria que eliminar al usuario del correo aqui. <br><h1>Esto esta pendiente</h1><br>";
 | 
						|
	$res = mysql_query( "DELETE FROM users WHERE id=$deleteUser", $conexion ) OR die( "No puedo eliminar al usuario" );
 | 
						|
    }
 | 
						|
 | 
						|
    if ( !isset( $orderBy ) ) $orderBy = "id";
 | 
						|
    if ( !isset( $orderDir ) ) $orderDir = "ASC";
 | 
						|
 | 
						|
    $consulta = "SELECT id, nick, Nombre, Apellidos, usaCorreo, primeraEntrada, ultimaEntrada, email FROM users ORDER BY $orderBy $orderDir";
 | 
						|
    $res = mysql_query( $consulta, $conexion ) OR die("No puedo consultar los usuarios");
 | 
						|
 | 
						|
    if ( mysql_num_rows($res) <= 0 )
 | 
						|
    {
 | 
						|
 	echo "<center>No se encontraron usuarios en el sistema</center>";
 | 
						|
    } else {
 | 
						|
 | 
						|
echo "<!-- BEGIN: LISTADO DE USUARIOS -->";
 | 
						|
?>
 | 
						|
<style>
 | 
						|
 td.menu
 | 
						|
 {
 | 
						|
  color:#FFFFFF;
 | 
						|
  background-color:#800000;
 | 
						|
  font-size: 9pt;
 | 
						|
  border-style : solid;
 | 
						|
  border-left-width : 0;
 | 
						|
  border-top-width : 0;
 | 
						|
  border-bottom-width : 0;
 | 
						|
  border-right-width : 0;
 | 
						|
 }
 | 
						|
</style>
 | 
						|
    <div align="center"><center><table border="0" cellpadding="0"
 | 
						|
    cellspacing="0" width="580">
 | 
						|
        <tr>
 | 
						|
            <td><h1>Listado de usuarios</h1>
 | 
						|
		<p></p>
 | 
						|
 | 
						|
            <hr noshade color="#800000">
 | 
						|
<table  border="0" cellspacing="0" cellpadding="2" width="100%">
 | 
						|
            <tr>
 | 
						|
                <td class="menu"><b>id</b> <a href="<?echo "$thisLOCATION&oderBy=id&orderDir=DESC"?>"><img src="images/actions/down.gif" border=0></a><a href="<?echo "$thisLOCATION&oderBy=id&orderDESC=ASC"?>"><img src="images/actions/up.gif" border=0></a></td>
 | 
						|
                <td class="menu"><b>Nick</b> <a href="<?echo "$thisLOCATION&oderBy=nick&orderDir=DESC"?>"><img src="images/actions/down.gif" border=0></a><a href="<?echo "$thisLOCATION&oderBy=nick&orderDESC=ASC"?>"><img src="images/actions/up.gif" border=0></a></td>
 | 
						|
                <td class="menu"><b>Nombre</b> <a href="<?echo "$thisLOCATION&oderBy=Nombre,Apellidos&orderDir=DESC"?>"><img src="images/actions/down.gif" border=0></a><a href="<?echo "$thisLOCATION&oderBy=Nombre,Apellidos&orderDESC=ASC"?>"><img src="images/actions/up.gif" border=0></a></td>
 | 
						|
                <td class="menu"><b>Alta</b> <a href="<?echo "$thisLOCATION&oderBy=primeraEntrada&orderDir=DESC"?>"><img src="images/actions/down.gif" border=0></a><a href="<?echo "$thisLOCATION&oderBy=primeraEntrada&orderDESC=ASC"?>"><img src="images/actions/up.gif" border=0></a></td>
 | 
						|
                <td class="menu"><b>ultimaEntrada</b> <a href="<?echo "$thisLOCATION&oderBy=ultimaEntrada&orderDir=DESC"?>"><img src="images/actions/down.gif" border=0></a><a href="<?echo "$thisLOCATION&oderBy=ultimaEntrada&orderDESC=ASC"?>"><img src="images/actions/up.gif" border=0></a></td>
 | 
						|
                <td class="menu">-[:]-</td>
 | 
						|
            </tr>
 | 
						|
<?
 | 
						|
   while ( $datos = mysql_fetch_array($res) )
 | 
						|
   { 
 | 
						|
	echo "<tr>";
 | 
						|
	echo "<td><a href=\"./?dgo=registro.php&showUser=$datos[0]\">$datos[0]</a></td>";
 | 
						|
 | 
						|
	echo "<td>";
 | 
						|
	if ( strcmp( $datos[4], "Y") == 0 ) echo "<a href=\"mailto:$datos[1]@musica.com\">$datos[1]</a>";
 | 
						|
	else {
 | 
						|
		if ( empty($datos[7]) ) echo "$datos[1]";
 | 
						|
		else echo "<a href=\"mailto:$datos[7]\">$datos[1]</a>";
 | 
						|
	}
 | 
						|
	echo "</td>";
 | 
						|
 | 
						|
	echo "<td>$datos[2] $datos[3]</td>";
 | 
						|
	echo "<td>".substr($datos[5], 6, 2 )."/".substr($datos[5], 4, 2 )."/".substr($datos[5], 0, 4 )."</td>";
 | 
						|
	echo "<td>".substr($datos[6], 6, 2 )."/".substr($datos[6], 4, 2 )."/".substr($datos[6], 0, 4 )."</td>";
 | 
						|
	echo "<td><a href=\"javascript:deleteUser($datos[0])\"><img src=\"images/actions/cancel.gif\" border=0></a></td>";
 | 
						|
	echo "</tr>";
 | 
						|
   }
 | 
						|
	  mysql_free_result($res);
 | 
						|
?>       
 | 
						|
</table>     
 | 
						|
            <hr noshade color="#800000">
 | 
						|
            <p><br>
 | 
						|
            </p>
 | 
						|
            </td>
 | 
						|
        </tr>
 | 
						|
    </table>
 | 
						|
    </center></div>
 | 
						|
</form>
 | 
						|
<script language="JavaScript"> 
 | 
						|
function deleteUser( which )
 | 
						|
{
 | 
						|
  var submitOK = confirm("Atencion: Esta a punto de eliminar al usuario.");
 | 
						|
  if ( submitOK )
 | 
						|
	  document.location.href = "<?echo "$thisLOCATION&orderBy=$orderBy&orderDir=$orderDir&usaCorreo=$usaCorreo"?>&deleteUser="+which;
 | 
						|
}
 | 
						|
</script>
 | 
						|
<?
 | 
						|
echo "<!-- END: LISTADO DE USUARIOS -->";
 | 
						|
}
 | 
						|
} else echo "<!-- ACCESO NO AUTORIZADO     -->";
 | 
						|
?>
 |