Tengo esto pero no me va....
me da este error:
Cita: Fatal error: Cannot redeclare compara_fechas() (previously declared in /home/mindpani/public_html/sets/sets.php:126) in /home/mindpani/public_html/sets/sets.php on line 126
Código PHP:
<?php
$conexion = mysql_connect("localhost","XXXXXXXXX","XXXXXXXX");
mysql_select_db("xxxxxxxxxx", $conexion) OR die("No se puede establecer la conexión a MySQL");
$sql = mysql_query("SELECT * FROM sets ORDER BY fecha DESC") or die (mysql_error());
while ($row = mysql_fetch_array($sql)) {
$id = "$row[setid]";
$titulo = "$row[setname]";
$link = "$row[seturl]";
$autor = "$row[setautor]";
$estilo = "$row[estiloid]";
$duracion = "$row[setduracion]";
$tamano = "$row[setsize]";
$clics = "$row[setclics]";
$criticas = "$row[urlcriticas]";
$fecha = "$row[fecha]";
function compara_fechas($fecha1,$fecha2)
{
if (preg_match("/[0-9]{1,2}\/[0-9]{1,2}\/([0-9][0-9]){1,2}/",$fecha1))
list($dia1,$mes1,$año1)=split("/",$fecha1);
if (preg_match("/[0-9]{1,2}-[0-9]{1,2}-([0-9][0-9]){1,2}/",$fecha1))
list($dia1,$mes1,$año1)=split("-",$fecha1);
if (preg_match("/[0-9]{1,2}\/[0-9]{1,2}\/([0-9][0-9]){1,2}/",$fecha2))
list($dia2,$mes2,$año2)=split("/",$fecha2);
if (preg_match("/[0-9]{1,2}-[0-9]{1,2}-([0-9][0-9]){1,2}/",$fecha2))
list($dia2,$mes2,$año2)=split("-",$fecha2);
$dif = mktime(0,0,0,$mes1,$dia1,$año1) - mktime(0,0,0, $mes2,$dia2,$año2);
return ($dif);
}
$fecha_actual= DATE;
if (compara_fechas($fecha,$fecha_actual) <=15)
echo "
<tr>
<td width='2%' class='texto2' style='border-right:0px;'><img src='http://www.mindpanic.com/foros/templates/chunkstyle/images/folder_new_big.gif'></td>
<td width='41%' class='texto3' style='border-left:0px;'><a href='descargar.php?id=$id&link=".urlencode($link)."' class='ultimos'>$titulo</a><br />By $autor</td>
<td width='20%' class='texto3' style='border-left:0px;' align='center' valign='middle'>$estilo</td>
<td width='14%' class='texto3' style='border-left:0px;' align='center' valign='middle'>$tamano Mb.</td>
<td width='5%' class='texto3' style='border-left:0px;' align='center' valign='middle'>$clics</td>
<td width='18%' class='texto3' style='border-left:0px;' align='center' valign='middle'><a href='$criticas'>[ver comentarios]</a></td>
</tr>
";
if (compara_fechas($fecha,$fecha_actual) >15)
echo"
<tr>
<td width='2%' class='texto2' style='border-right:0px;'><img src='http://www.mindpanic.com/foros/templates/chunkstyle/images/folder.gif'></td>
<td width='41%' class='texto3' style='border-left:0px;'><a href='descargar.php?id=$id&link=".urlencode($link)."' class='ultimos'>$titulo</a><br />By $autor</td>
<td width='20%' class='texto3' style='border-left:0px;' align='center' valign='middle'>$estilo</td>
<td width='14%' class='texto3' style='border-left:0px;' align='center' valign='middle'>$tamano Mb.</td>
<td width='5%' class='texto3' style='border-left:0px;' align='center' valign='middle'>$clics</td>
<td width='18%' class='texto3' style='border-left:0px;' align='center' valign='middle'><a href='$criticas'>[ver comentarios]</a></td>
</tr>
";
}
?>
Ayuda pleaseeee!!!!!!!!!