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

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

$secciones = array('', 'Novedad', 'Learning Center', 'Instalaci&oacute;n', 'Curiosidad');
?>

<!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>articulos</title>
<link href="../sformi.css" rel="stylesheet" type="text/css">
</head>
<body>
<!-- CONTENT -->
	<table border="0" cellspacing="0" cellpadding="0">
		<tr><td><a href="articulos_edit.php?op=add" class="button">[ a&ntilde;adir un nuevo art&iacute;culo ]</a></td></tr>
		<tr><td><img src="_imgs/d.gif" width="200" height="5"></td></tr>
	</table>
<table border="0" cellspacing="0" cellpadding="0">
<?php

	$conn = db_connect();
	if($conn) {
		$query = "SELECT articulo_id, articulo_tipo, articulo_titular, articulo_fecha_pub, articulo_views FROM edito_articulos ORDER BY articulo_tipo, articulo_orden, articulo_id DESC";
		$result = mysql_query($query, $conn);
		$num_results = mysql_num_rows($result);
?>
	<tr>
		<td width="100" valign="top" class="hdr">Tipo</td>
		<td width="350" valign="top" class="hdr">Titular</td>
		<td width="80" valign="top" class="hdr">A&ntilde;adida</td>
		<td width="50" valign="top" class="hdr">Vista</td>
		<td></td>
	</tr>
<?php
	for ($i=0; $i <$num_results; $i++)
	{
		$row = mysql_fetch_array($result);
		$articulo_id = $row['articulo_id'];
		$articulo_tipo = $secciones[$row['articulo_tipo']];
		$articulo_titular = $row['articulo_titular'];
		$articulo_fecha_pub = $row['articulo_fecha_pub'];
		$articulo_views = $row['articulo_views'];
?>
	<tr>
		<td width="50" valign="top" class="data"><?php echo $articulo_tipo; ?></td><td width="300" valign="top" class="data"><?php echo $articulo_titular; ?></td><td width="80" valign="top" class="data"><?php echo $articulo_fecha_pub; ?></td><td width="50" valign="top" class="data"><?php echo $articulo_views; ?></td>
			<td valign="top" class="data">&nbsp;<a href="articulos_edit.php?op=edit&id=<?php echo $articulo_id; ?>" class="button">[ editar ]</a></td>
	</tr>
	<tr>
		<td bgcolor="#DBDEE6" colspan=5><img src="_imgs/d.gif" width="5" height="1"></td>
	</tr>
<?php
		}	// FOR
	} else {	// IF CONN
		echo '<p>An error has occurred while accessing the database: ' . mysql_error();
	}	 
?>
</table>
<!-- END OF CONTENT -->
</body>
</html>
