<?php
session_start();
include('../db.php');

if (!session_is_registered("clave_audio")) {
	include("../login.php");
	if (!$continuar) exit;
}

if(isset($_REQUEST['op'])) {
	$op = $_REQUEST['op'];
} else {
	$op = "list";
}

// this code is for the "paginator"
$start = (isset($$_REQUEST['start']) ? $$_REQUEST['start'] : 0);
$limit = 25;
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>imagenes</title>
<link href="../sformi.css" rel="stylesheet" type="text/css">
</head>
<body>
<!-- CONTENT -->
<?php
	if($op == "edit"){
?>
	<table border="0" cellspacing="0" cellpadding="0">
		<tr><td><a href="imagenes_edit.php?op=add" class="button">[ add a new record ]</a></td></tr>
		<tr><td><img src="_imgs/d.gif" width="200" height="5"></td></tr>
	</table>

<?php
	}
?>

<table border="0" cellspacing="0" cellpadding="0">
<?php
//	include("../login.php");
//	if (!$continuar) exit;

	$conn = db_connect();
	if($conn) {
		$query = "SELECT imagen_id, imagen_id, imagen_filepath, imagen_url, imagen_pie, imagen_width, imagen_height FROM edito_imagenes ORDER BY imagen_id LIMIT " . $start . ",25";
		$result = mysql_query($query, $conn);
		$num_results = mysql_num_rows($result);
?>
	<tr>
		<td width="0" valign="top" class="hdr">Imagen Id</td><td width="114" valign="top" class="hdr">Imagen Filepath</td><td width="114" valign="top" class="hdr">Imagen Url</td><td width="114" valign="top" class="hdr">Imagen Pie</td><td width="114" valign="top" class="hdr">Imagen Width</td><td width="114" valign="top" class="hdr">Imagen Height</td>
<?php
			// this buttons will always be after the data
	if($op == "edit"){
?>
		<td></td>
<?php
	}
?>
	</tr>
<?php
	for ($i=0; $i <$num_results; $i++)
	{
		$row = mysql_fetch_array($result);
		$imagen_id = $row['imagen_id'];
$imagen_id = $row['imagen_id'];
$imagen_filepath = $row['imagen_filepath'];
$imagen_url = $row['imagen_url'];
$imagen_pie = $row['imagen_pie'];
$imagen_width = $row['imagen_width'];
$imagen_height = $row['imagen_height'];

?>
	<tr>
			<td width="0" valign="top" class="data"><a href="imagenes_show.php?id=<?php echo $imagen_id; ?>" class="button"><?php echo $imagen_id; ?></a></td><td width="114" valign="top" class="data"><?php echo $imagen_filepath; ?></td><td width="114" valign="top" class="data"><?php echo $imagen_url; ?></td><td width="114" valign="top" class="data"><?php echo $imagen_pie; ?></td><td width="114" valign="top" class="data"><?php echo $imagen_width; ?></td><td width="114" valign="top" class="data"><?php echo $imagen_height; ?></td>
<?php
			// this buttons will always be after the data
		if($op == "edit"){
?>
			<td valign="top" class="data">&nbsp;<a href="imagenes_edit.php?op=edit&id=<?php echo $imagen_id; ?>" class="button">[ edit ]</a>&nbsp;&nbsp;<a href="imagenes_db.php?op=del&id=<?php echo $imagen_id; ?>" class="button">[ delete ]</a></td>
<?php
		}	
?>	
	</tr>
	<tr>
<?php
			if($op == "edit") {
?>
		<td bgcolor="#DBDEE6" colspan=7><img src="_imgs/d.gif" width="5" height="1"></td>
<?php
			} else {
?>
		<td bgcolor="#DBDEE6" colspan=6><img src="_imgs/d.gif" width="5" height="1"></td>
<?php
			}
?>
	</tr>
<?php
		}	// FOR
	} else {	// IF CONN
		echo '<p>An error has occurred while accessing the database: ' . mysql_error();
	}	 
?>
</table>
<?php
	// do we need to paginate the result?
	if($num_results > $limit) {
	
	}
?>
<!-- EOF CONTENT -->

<?php
	if($op == "edit"){
?>
	<table border="0" cellspacing="0" cellpadding="0">
		<tr><td></td></tr>
		<tr><td><img src="_imgs/d.gif" width="200" height="5"></td></tr>
	</table>

<?php
	}
?>
<!-- END OF CONTENT -->
</body>
</html>
