ACA EL FILE.PHP (Creo que el mas importante)
File.php: Código PHP:
<?php require_once('Connections/FS.php'); ?><?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO comentarios_d (id_comentario, id_descarga_comentario, id_usuario_comentario, titulo_comentario, autor_comentario, fecha_comentario) VALUES (%s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['id_comentario'], "int"),
GetSQLValueString($_POST['id_descarga_comentario'], "int"),
GetSQLValueString($_POST['id_usuario_comentario'], "int"),
GetSQLValueString($_POST['titulo_comentario'], "text"),
GetSQLValueString($_POST['autor_comentario'], "text"),
GetSQLValueString($_POST['fecha_comentario'], "date"));
mysql_select_db($database_FS, $FS);
$Result1 = mysql_query($insertSQL, $FS) or die(mysql_error());
$insertGoTo = "downloads.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
mysql_select_db($database_FS, $FS);
$query_rsComentarios = "SELECT * FROM comentarios_d";
$rsComentarios = mysql_query($query_rsComentarios, $FS) or die(mysql_error());
$row_rsComentarios = mysql_fetch_assoc($rsComentarios);
$totalRows_rsComentarios = mysql_num_rows($rsComentarios);
$maxRows_DetailRS1 = 5;
$pageNum_DetailRS1 = 0;
if (isset($_GET['pageNum_DetailRS1'])) {
$pageNum_DetailRS1 = $_GET['pageNum_DetailRS1'];
}
$startRow_DetailRS1 = $pageNum_DetailRS1 * $maxRows_DetailRS1;
mysql_select_db($database_FS, $FS);
$recordID = $_GET['recordID'];
$query_DetailRS1 = "SELECT * FROM descargas WHERE id = $recordID";
$query_limit_DetailRS1 = sprintf("%s LIMIT %d, %d", $query_DetailRS1, $startRow_DetailRS1, $maxRows_DetailRS1);
$DetailRS1 = mysql_query($query_limit_DetailRS1, $FS) or die(mysql_error());
$row_DetailRS1 = mysql_fetch_assoc($DetailRS1);
if (isset($_GET['totalRows_DetailRS1'])) {
$totalRows_DetailRS1 = $_GET['totalRows_DetailRS1'];
} else {
$all_DetailRS1 = mysql_query($query_DetailRS1);
$totalRows_DetailRS1 = mysql_num_rows($all_DetailRS1);
}
$totalPages_DetailRS1 = ceil($totalRows_DetailRS1/$maxRows_DetailRS1)-1;
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin título</title>
</head>
<body>
<table border="1" align="center">
<tr>
<td>titulo</td>
<td><strong><?php echo $row_DetailRS1['titulo']; ?></strong> </td>
</tr>
<tr>
<td>resena</td>
<td><?php echo $row_DetailRS1['resena']; ?> </td>
</tr>
<tr>
<td>imagen</td>
<td><img src="<?php echo $row_DetailRS1['imagen']; ?>" width="200" height="200" border="0" align="middle" /> </td>
</tr>
<tr>
<td>desc</td>
<td><?php echo $row_DetailRS1['desc']; ?> </td>
</tr>
<tr>
<td>tamano</td>
<td><?php echo $row_DetailRS1['tamano']; ?> </td>
</tr>
<tr>
<td>url</td>
<td><div align="center"><a href="<?php echo $row_DetailRS1['url']; ?>"><strong>Descargar</strong></a> </div></td>
</tr>
<tr>
<td>autor</td>
<td><em><?php echo $row_DetailRS1['autor']; ?></em> </td>
</tr>
</table>
<hr />
<?php do { ?>
<table width="100%" border="0">
<tr>
<td>Comentario Numero: <?php echo $row_rsComentarios['id_comentario']; ?> Titulo: <?php echo $row_rsComentarios['titulo_comentario']; ?></td>
</tr>
<tr>
<td>Fecha y Autor: <?php echo $row_rsComentarios['fecha_comentario']; ?> - <?php echo $row_rsComentarios['autor_comentario']; ?></td>
</tr>
</table>
<?php } while ($row_rsComentarios = mysql_fetch_assoc($rsComentarios)); ?><p> </p>
<hr />
<p> </p>
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<table align="center">
<tr valign="baseline">
<td nowrap align="right">Id_descarga_comentario:</td>
<td><input type="text" name="id_descarga_comentario" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Id_usuario_comentario:</td>
<td><input type="text" name="id_usuario_comentario" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Titulo_comentario:</td>
<td><input type="text" name="titulo_comentario" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Autor_comentario:</td>
<td><input type="text" name="autor_comentario" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Fecha_comentario:</td>
<td><input type="text" name="fecha_comentario" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right"> </td>
<td><input type="submit" value="Insertar registro"></td>
</tr>
</table>
<input type="hidden" name="id_comentario" value="">
<input type="hidden" name="MM_insert" value="form1">
</form>
<p> </p>
<p align="center"><a href="downloads.php"><strong>Volver</strong></a></p>
</body>
</html><?php
mysql_free_result($rsComentarios);
mysql_free_result($DetailRS1);
?>
Saludos