<?php
session_start();

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

include('../db.php');
?>
<html>
<head>
<title>banners</title>
<link href="../sformi.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/JavaScript">
function doSubmit() { 
	document.formulario.submit();
}
</script>
</head>
<body>
<?php 

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

?>
<?php
$banner_texto = $banner_url = $banner_insert_max = $banner_inserts = $banner_file = $banner_tipo = "";
switch($operacion)
{
	case "add";
		break;

	case "edit";
		$conn = db_connect();
		if($conn) {
			$query = "SELECT banner_id, banner_texto, banner_url, banner_inserts, banner_file, banner_tipo FROM bania_banners WHERE banner_id = " . $id;
			$result = mysql_query($query, $conn);
			if (mysql_num_rows($result)) {
				$row = mysql_fetch_array($result);
				$banner_texto = $row['banner_texto'];
				$banner_url = $row['banner_url'];
				$banner_inserts = $row['banner_inserts'];
				$banner_file = $row['banner_file'];
				$banner_tipo = $row['banner_tipo'];
			}
		}
		break;
}
?>
<form method="post" action="banners_db.php" name="formulario" enctype="multipart/form-data">
<input name="op" type="hidden" value="<?= $operacion; ?>">
<input name="id" type="hidden" value="<?= $id; ?>">
<table border="0" cellspacing="0" cellpadding="0">
	<tr><td width="200" class= "lbl">Texto</td>
	  <td width="200" rowspan="18" valign="top" class= "lbl"><img src="../../_bann/<?= $banner_file; ?>"hspace="6" vspace="6"></td>
    </tr>
<tr><td width="" class="data"><input name="banner_texto" type="text" size="" maxlength="" value="<?= $banner_texto; ?>"></td>
  </tr>
<tr><td><img src="../_imgs/d.gif" width="6" height="6"></td>
  </tr>
<tr><td width="200" class= "lbl">URL</td>
  </tr>
<tr><td width="" class="data"><input name="banner_url" type="text" size="" maxlength="" value="<?= $banner_url; ?>"></td>
  </tr>
<tr><td><img src="../_imgs/d.gif" width="6" height="6"></td>
  <tr><td width="200" class= "lbl">Inserciones</td>
  </tr>
<tr><td width="" class="data"><?= $banner_inserts; ?></td>
  </tr>
<tr><td><img src="../_imgs/d.gif" width="6" height="6"></td>
  <tr><td width="200" class= "lbl">File</td>
  </tr>
<tr><td width="" class="data"><input name="banner_file" type="text" size="" maxlength="" value="<?= $banner_file; ?>"></td>
  </tr>
<tr><td><img src="../_imgs/d.gif" width="6" height="6"></td>
  <tr><td width="200" class= "lbl">Tipo</td>
  </tr>
<tr><td width="" class="data">
<select name="banner_tipo" style="width:200px">
		<option value="0" <?= $banner_tipo == '0' ? 'selected' : ''; ?>>En reserva</option>
		<option value="50" <?= $banner_tipo == '50' ? 'selected' : ''; ?>>Home Parte superior</option>
		<option value="145" <?= $banner_tipo == '145' ? 'selected' : ''; ?>>Home 1 M&oacute;dulo</option>
		<option value="348" <?= $banner_tipo == '348' ? 'selected' : ''; ?>>Home 2 M&oacute;dulos</option>
		<option value="168" <?= $banner_tipo == '168' ? 'selected' : ''; ?>>Vertical</option>
		<option value="528" <?= $banner_tipo == '528' ? 'selected' : ''; ?>>Tienda</option>
</select>
</td>
  </tr>
<tr><td><img src="../_imgs/d.gif" width="6" height="6"></td>
  </table>
<table border="0" cellspacing="0" cellpadding="0">
	<tr>
	  <td>
		<a href="javascript:history.go(-1)" class="button">[ cancelar ]</a>&nbsp;&nbsp;
		<a href="javascript:doSubmit();" class="button" style="margin-left:20px">[ Ok ]</a>
		<a href="banners_db.php?op=del&id=<?= $id; ?>" onClick="return confirm('Est&aacute;s seguro de querer borrar este banner?')" class="button" style="margin-left:150px">[ borrar ]</a></td>
	</td>
	</tr>
</table>
</form>
</body>
</html>