281 lines
		
	
	
		
			9.7 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			281 lines
		
	
	
		
			9.7 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?
 | 
						||
			session_name( "SYNCRO" );
 | 
						||
			$v1="user_id";
 | 
						||
			$v2="user_name";
 | 
						||
			$v3="user_auth";
 | 
						||
			session_register($v1,$v2,$v3);
 | 
						||
			session_start();
 | 
						||
 | 
						||
require ("common/config.inc.php");
 | 
						||
require ("common/dbnav_bar.php");
 | 
						||
 | 
						||
if ( !isset( $offset ) ) $offset = 0;
 | 
						||
 | 
						||
 | 
						||
$sql_orden = "";
 | 
						||
$MWhere = "";
 | 
						||
$parse_options = ""; 
 | 
						||
if ( isset( $orden ) ) 
 | 
						||
{
 | 
						||
  $parse_options .= "&orden=$orden";
 | 
						||
  if ( strcmp( $orden, "g" ) == 0 )
 | 
						||
    $sql_orden = " ORDER BY Genero, Titulo ";
 | 
						||
  if ( strcmp( $orden, "t" ) == 0 ) 
 | 
						||
    $sql_orden = " ORDER BY Titulo ";
 | 
						||
}
 | 
						||
if ( isset( $status ) )
 | 
						||
{
 | 
						||
  switch( $status )
 | 
						||
  {
 | 
						||
    case "-= CUALQUIERA =-":
 | 
						||
	break;
 | 
						||
    case "No la tengo";
 | 
						||
	$MWhere = "WHERE pu.status IS NULL";	
 | 
						||
	$parse_options .="&status=$status";
 | 
						||
	break;
 | 
						||
    default:
 | 
						||
	$MWhere = "WHERE p.status = '$status'";
 | 
						||
	$parse_options .="&status=$status";
 | 
						||
	break;
 | 
						||
  }
 | 
						||
}
 | 
						||
if ( isset( $genero ) )
 | 
						||
{
 | 
						||
 if ( empty( $MWhere ) ) { $MWhere = "WHERE "; $And = ""; } else { $And =" AND "; }
 | 
						||
 switch( $genero )
 | 
						||
 {
 | 
						||
    case "-= CUALQUIERA =-";
 | 
						||
	break;
 | 
						||
    default:
 | 
						||
	$MWhere .= $And ." p.Genero='$genero'";
 | 
						||
	$parse_options .="&genero=$genero";
 | 
						||
  	break;
 | 
						||
 }
 | 
						||
}
 | 
						||
 | 
						||
 | 
						||
 | 
						||
  // Segun TIPO selecionamos las pelis
 | 
						||
  $conexion = mysql_connect( 'localhost', 'syncro_users', '29dic2001' ) OR die("No puedo conectar");
 | 
						||
  $id = mysql_select_db( 'SYNCRO', $conexion ) OR die("No puedo abrir Base de Datos");
 | 
						||
  
 | 
						||
  $sdown = false;
 | 
						||
  if ( $user_auth )
 | 
						||
  {
 | 
						||
    $qFROM = "pelis AS p LEFT JOIN pelis_user AS pu ON (pu.user=$user_id AND p.id=pu.peli) $MWhere"; 
 | 
						||
    $consulta = "SELECT DISTINCT p.id, p.Genero, p.Status, p.Titulo, p.Duracion, p.NumCDs, pu.status FROM $qFROM $sql_orden LIMIT $offset, $limit";
 | 
						||
    $sdown = true;
 | 
						||
  } else {
 | 
						||
    $qFROM = "pelis p";
 | 
						||
    $consulta = "SELECT p.id, p.Genero, p.Status, p.Titulo, p.Duracion, p.NumCDs, p.owner, u.Apodo FROM $qFROM, users u WHERE u.id = p.owner $sql_orden LIMIT $offset, $limit";
 | 
						||
  }
 | 
						||
	
 | 
						||
  if ( isset( $q ) )	
 | 
						||
  { 
 | 
						||
	if ( strcmp( $q, "mias" )==0 && $user_auth )
 | 
						||
	{
 | 
						||
//	 $qFROM = "pelis p, pelis_user pu WHERE pu.user = $user_id AND p.id = pu.peli";
 | 
						||
//	 $consulta = "SELECT DISTINCT p.id, p.Genero, p.Status, p.Titulo, p.Duracion, p.NumCDs, pu.status FROM $qFROM $sql_orden LIMIT $offset, $limit";
 | 
						||
	 $qFROM = "pelis p, pelis_user pu LEFT JOIN pelis_user pup ON (pup.status='PEDIR' AND pu.status='OK' AND p.id=pup.peli) WHERE pu.user=$user_id AND p.id=pu.peli";
 | 
						||
	 $consulta = "SELECT DISTINCT p.id, p.Genero, p.Status, p.Titulo, p.Duracion, p.NumCDs, pu.status, pup.peli FROM $qFROM $sql_orden LIMIT $offset, $limit";
 | 
						||
 | 
						||
         $sdown = true;
 | 
						||
	 $slapiden = true;
 | 
						||
	 $parse_options .= "&q=mias";
 | 
						||
	}
 | 
						||
	if ( strcmp( $q, "en_curso" )==0 && $user_auth )
 | 
						||
	{
 | 
						||
	 $qFROM = "pelis p  WHERE p.Status != 'OK'";
 | 
						||
	 $consulta = "SELECT p.id, p.Genero, p.Status, p.Titulo, p.Duracion, p.NumCDs FROM $qFROM $sql_orden LIMIT $offset, $limit";
 | 
						||
         $sdown = false;
 | 
						||
	 $parse_options .= "&q=en_curso";
 | 
						||
	}
 | 
						||
  }
 | 
						||
  CreateDBnav( $qFROM );
 | 
						||
  $res = mysql_query( $consulta, $conexion ) OR die("No puedo realizar la consulta<br>$consulta<br>".mysql_error($conexion));
 | 
						||
?>
 | 
						||
 | 
						||
 | 
						||
<html>
 | 
						||
<head>
 | 
						||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
 | 
						||
<title>SYNCRO: Listado de peliculas</title>
 | 
						||
<link href="syncro.ico" rel="SHORTCUT ICON">
 | 
						||
<link rel="stylesheet" type="text/css" href="syncro.css" body="syncro.css">
 | 
						||
</head>
 | 
						||
 | 
						||
<body bgcolor="#57A44D">
 | 
						||
<br>
 | 
						||
<form action="<? echo "$PHP_SELF?$parse_options"?> method="post">
 | 
						||
    <div align="center"><center><table border="1" cellpadding="0"
 | 
						||
    cellspacing="0" width="600" bgcolor="#427B42"
 | 
						||
    bordercolor="#000000" bordercolordark="#000000"
 | 
						||
    bordercolorlight="#000000">
 | 
						||
        <tr>
 | 
						||
            <td><table border="0" cellpadding="2" cellspacing="0"
 | 
						||
            width="100%">
 | 
						||
                <tr>
 | 
						||
                    <td width="300">Leyenda:</td>
 | 
						||
                    <td width="150">Filtrar por Estado: </td>
 | 
						||
                    <td width="150"><select name="status"
 | 
						||
                    size="1">
 | 
						||
                        <option selected>-= CUALQUIERA =-</option>
 | 
						||
                        <option>ok</option>
 | 
						||
                        <option>para alquilar</option>
 | 
						||
                        <option>ripeando</option>
 | 
						||
                        <option>por llegar</option>
 | 
						||
<? if ( $user_auth ) echo "<option>No la tengo</option>"; ?>
 | 
						||
                    </select></td>
 | 
						||
<? if ( $user_auth ) echo '<td width="20" rowspan="2"  valign="top" ><input type="image" name="I2"  src="images/ok.gif" alt="ENVIAR" align="bottom" border="0" width="20" height="58"></td>'; ?>
 | 
						||
                </tr>
 | 
						||
                <tr>
 | 
						||
                    <td width="300">
 | 
						||
		      <font color="#427B42">:-(</font><img src="images/prip.gif" width="15" height="15"> Aun no disponible<br>
 | 
						||
 | 
						||
<? 
 | 
						||
	if ( isset( $slapiden ) ) 
 | 
						||
		echo '<font color="#427B42">:-(</font><img src="images/ppre.gif" width="15" height="15"> <20>La estan pidiendo!<br>';
 | 
						||
	else
 | 
						||
		echo '<font color="#427B42">:-)</font><img src="images/pdown.gif" width="18" height="18"> A<>adir a mi listado<br>';
 | 
						||
?>
 | 
						||
 | 
						||
                      <font color="#427B42">:-)</font><img src="images/pped.gif" width="15" height="15"> <20>Tengo que pedirla!<br>
 | 
						||
                    </td><td valign="top" width="150">Filtrar por G<>nero:<br>
 | 
						||
                    </td>
 | 
						||
                    <td valign="top" width="150"><select
 | 
						||
                    name="genero" size="1">
 | 
						||
                        <option selected>-= CUALQUIERA =-</option>
 | 
						||
                        <option>SIN CLASIFICAR</option>
 | 
						||
                        <option>Acci<63>n</option>
 | 
						||
                        <option>Animaci<63>n</option>
 | 
						||
                        <option>Aventuras</option>
 | 
						||
                        <option>B<>lica</option>
 | 
						||
                        <option>Biograf<61>a</option>
 | 
						||
                        <option>Cat<61>strofe</option>
 | 
						||
                        <option>C.Ficci<63>n</option>
 | 
						||
                        <option>Fant<6E>stico</option>
 | 
						||
                        <option>Cine Negro</option>
 | 
						||
                        <option>Comedia</option>
 | 
						||
                        <option>Dib.Animado</option>
 | 
						||
                        <option>Documental</option>
 | 
						||
                        <option>Drama</option>
 | 
						||
                        <option>Hist<73>rica</option>
 | 
						||
                        <option>Intriga</option>
 | 
						||
                        <option>Musical</option>
 | 
						||
                        <option>Melodrama</option>
 | 
						||
                        <option>Oeste</option>
 | 
						||
                        <option>Terror</option>
 | 
						||
                        <option>Picantes</option>
 | 
						||
                    </select><br>
 | 
						||
                    </td>
 | 
						||
                </tr>
 | 
						||
            </table>
 | 
						||
<? ShowDBnav(); ?>
 | 
						||
            </td>
 | 
						||
        </tr>
 | 
						||
    </table>
 | 
						||
    </center></div>
 | 
						||
</form>
 | 
						||
<div align="center"><center>
 | 
						||
 | 
						||
<table border="1" cellpadding="0" cellspacing="0" width="600"
 | 
						||
bgcolor="#427B42" bordercolor="#000000" bordercolordark="#000000"
 | 
						||
bordercolorlight="#000000">
 | 
						||
    <tr>
 | 
						||
        <td><table border="0" width="100%"  cellspacing="0"  >
 | 
						||
            <tr>
 | 
						||
                <td bgcolor="#000000">
 | 
						||
<? if ( strcmp( $orden, "g" ) != 0 )
 | 
						||
	echo "<a href=\"$PHP_SELF?$parse_options&orden=g\"><img src=\"images/sortd.gif\" border=\"0\"></a>";
 | 
						||
?><strong> G<>nero</strong></td>
 | 
						||
                <td bgcolor="#000000">
 | 
						||
<? if ( strcmp( $orden, "t" ) != 0 )
 | 
						||
	echo "<a href=\"$PHP_SELF?$parse_options&orden=t\"><img src=\"images/sortd.gif\" border=\"0\"></a>";
 | 
						||
?><strong> T<>tulo</strong></td>
 | 
						||
                <td bgcolor="#000000"><strong>Dur.</strong></td>
 | 
						||
                <td bgcolor="#000000"><strong><? if ( !sdown ) echo "Ripper"; ?></strong></td>
 | 
						||
                <td bgcolor="#000000"><strong>CD's</strong></td>
 | 
						||
                <td bgcolor="#000000" colspan="4" style="text-align:center"><strong>- status -</strong></td>
 | 
						||
            </tr>
 | 
						||
<?
 | 
						||
  $numrows = mysql_num_rows( $res );
 | 
						||
  if (  $numrows > 0 )
 | 
						||
  {
 | 
						||
   if ( $user_auth ) 
 | 
						||
   {
 | 
						||
     $ver_preview = "gestion-pelisp.php?peli_id=";
 | 
						||
     $target = "target='preview'";
 | 
						||
   } else $ver_preview = "#";	
 | 
						||
 | 
						||
   while ( $datos = mysql_fetch_array($res) )
 | 
						||
   { 
 | 
						||
	   if ( strcmp( $datos[2], "OK" ) == 0 )
 | 
						||
		$p_imgStatus = "";
 | 
						||
	   else
 | 
						||
		$p_imgStatus = "<img src='images/prip.gif'>";
 | 
						||
	   if ( strcmp($datos[4], "00:00:00" ) != 0 )
 | 
						||
	   {
 | 
						||
	    $hh = strtok($datos[4], ":");
 | 
						||
	    $mm = strtok(":");
 | 
						||
	    $dur = $hh*60 + $mm;
 | 
						||
  	    if ( $dur == 0 ) $dur = "";
 | 
						||
	   } else $dur="";
 | 
						||
		 
 | 
						||
	if ( $linea_color ) 
 | 
						||
	   echo "<tr>";
 | 
						||
	else
 | 
						||
	   echo "<tr bgcolor=\"#488048\">";
 | 
						||
	$linea_color = !$linea_color;
 | 
						||
 | 
						||
           echo "<td>$datos[1]</td>" .
 | 
						||
                "<td><a href='$ver_preview $datos[0]' $target >$datos[3]</a></td>" .
 | 
						||
                "<td class=\"tdr\">$dur</td>";
 | 
						||
if ( !$slapiden ) echo "<td>$datos[7]</td>";
 | 
						||
	   echo "<td>$datos[5]</td>" .
 | 
						||
                "<td>$p_imgStatus</td>";
 | 
						||
		if ( $user_auth && empty( $p_imgStatus ) )
 | 
						||
		{
 | 
						||
  		  if ( $sdown )
 | 
						||
		  {
 | 
						||
		    if ( empty($datos[6]) )
 | 
						||
		    {
 | 
						||
	                echo "<td><a href='gestion-amispelis.php?peli_id=$datos[0]&peli_name=$datos[3]' target='preview'><img src='images/pdown.gif' border='0'></a></td>";
 | 
						||
		    } else {
 | 
						||
			if ( strcmp($datos[6],"OK") != 0 )
 | 
						||
 			  echo "<td><a href='gestion-amispelis.php?peli_id=$datos[0]&peli_name=$datos[3]&accion=editar' target='preview'><img src='images/pped.gif' border='0'></a></td>";
 | 
						||
			else
 | 
						||
			  echo "<td> </td>";
 | 
						||
		    }
 | 
						||
		  } else {
 | 
						||
		    echo "<td> </td>";
 | 
						||
		  }
 | 
						||
		  if ( $slapiden && !empty($datos[7]) )
 | 
						||
				echo "<td><a href='gestion-pidiendo.php?peli_id=$datos[0]' target='preview'><img src='images/ppre.gif' width='15' height='15' border='0'></a></td>";
 | 
						||
			else
 | 
						||
			        echo "<td> </td>";			
 | 
						||
		} else {
 | 
						||
	                echo "<td> </td>";
 | 
						||
		        echo "<td> </td>";
 | 
						||
		        echo "<td> </td>";
 | 
						||
		}
 | 
						||
		echo "</tr>";
 | 
						||
   };
 | 
						||
 | 
						||
  } else {
 | 
						||
	echo "<tr><td>-= ERROR =-</td><td>La consulta no produjo resultados</td><td></td><td></td><td></td><td></td><td></td>";
 | 
						||
  }
 | 
						||
?>
 | 
						||
        </table>
 | 
						||
        </td>
 | 
						||
    </tr>
 | 
						||
</table>
 | 
						||
</center></div><br>
 | 
						||
<?
 | 
						||
 $navBarBox = MakeBox( GetDBnav() );
 | 
						||
 echo $navBarBox;
 | 
						||
 mysql_close($conexion);
 | 
						||
?>
 | 
						||
<p align="center"> </p>
 | 
						||
</body>
 | 
						||
</html>
 |