problema con listado d ultimos mensajes
buenas a todo el mundo, en mi web dispongo de un script para ver los ultimos post del foro y me da cada 2 por 3 errores en carga en el mismo script ( y en la web, me sale un icono de error en la carga) el script es el siguiente:
<?
$directorio = "foro"; //Carpeta donde esta situado el foro
$mostrar = "6"; //Número de mensajes a mostrar Puede Cambiarlo
$caracteres = "25"; //Caracteres que se mostrarán de cada línea.
//Lo Siguiente no Lo debes tocar
include("$directorio/config.php");
echo "
<script type=text/javascript>
function sobre(texto) { subnav.innerHTML = texto; }
function fuera(texto) { subnav.innerHTML = "<a href=$directorio/index.php> Entrar al Foro</a>" }
</script>
";
$conexion = mysql_connect($dbhost, $dbuser, $dbpasswd);
mysql_select_db($dbname, $conexion);
$consulta = "select * from ".$table_prefix."posts order by post_time desc";
$resultado = mysql_query($consulta);
$i = 0;
while ($rows = mysql_fetch_array($resultado)) {
if ($i <= $mostrar) {
$consulta1 = "select * from ".$table_prefix."forums where forum_id='$rows[forum_id]'";
$resultado1 = mysql_query($consulta1);
$datosf = mysql_fetch_array($resultado1);
$consulta2 = "select * from ".$table_prefix."users where user_id='$rows[poster_id]'";
$resultado2 = mysql_query($consulta2);
$datosu = mysql_fetch_array($resultado2);
$consulta3 = "select * from ".$table_prefix."topics where topic_id='$rows[topic_id]'";
$resultado3 = mysql_query($consulta3);
$datost = mysql_fetch_array($resultado3);
if (strlen($datost[topic_title]) > $caracteres) {
$datost[topic_title] = substr($datost[topic_title], 0, 40)."...";
}
echo "<b></b> <a href="$directorio/viewtopic.php?t=$rows[topic_id]" target="_blank" onmouseover='sobre(" en <b>$datosf[forum_name]</b> por <i>$datosu[username]</i> </font>")' onmouseout='fuera()'>$datost[topic_title]</a> <br>";
$i++;
}
}
echo '<br> <table width=100% border=0 cellpadding=0 cellspacing=0> <tr> <td id=subnav name=subnav> <a href="$directorio/index.php" target="_blank"> Entrar al Foro</a> </td> </tr> </table>';
mysql_free_result($resultado);
mysql_close($conexion);
?>
El problema es que ultimamente me salen post de esta forma subscrita:
por DarKcApTaiN ")' onmouseout='fuera()'>El club de la lucha 2 CD's...
en vez de salir asi:
Alguien me puede ayudar??? hay algo mal en el codigo??? me es urgente, gracias
Estrenos Cine ---> Caratulas...
<?
$directorio = "foro"; //Carpeta donde esta situado el foro
$mostrar = "6"; //Número de mensajes a mostrar Puede Cambiarlo
$caracteres = "25"; //Caracteres que se mostrarán de cada línea.
//Lo Siguiente no Lo debes tocar
include("$directorio/config.php");
echo "
<script type=text/javascript>
function sobre(texto) { subnav.innerHTML = texto; }
function fuera(texto) { subnav.innerHTML = "<a href=$directorio/index.php> Entrar al Foro</a>" }
</script>
";
$conexion = mysql_connect($dbhost, $dbuser, $dbpasswd);
mysql_select_db($dbname, $conexion);
$consulta = "select * from ".$table_prefix."posts order by post_time desc";
$resultado = mysql_query($consulta);
$i = 0;
while ($rows = mysql_fetch_array($resultado)) {
if ($i <= $mostrar) {
$consulta1 = "select * from ".$table_prefix."forums where forum_id='$rows[forum_id]'";
$resultado1 = mysql_query($consulta1);
$datosf = mysql_fetch_array($resultado1);
$consulta2 = "select * from ".$table_prefix."users where user_id='$rows[poster_id]'";
$resultado2 = mysql_query($consulta2);
$datosu = mysql_fetch_array($resultado2);
$consulta3 = "select * from ".$table_prefix."topics where topic_id='$rows[topic_id]'";
$resultado3 = mysql_query($consulta3);
$datost = mysql_fetch_array($resultado3);
if (strlen($datost[topic_title]) > $caracteres) {
$datost[topic_title] = substr($datost[topic_title], 0, 40)."...";
}
echo "<b></b> <a href="$directorio/viewtopic.php?t=$rows[topic_id]" target="_blank" onmouseover='sobre(" en <b>$datosf[forum_name]</b> por <i>$datosu[username]</i> </font>")' onmouseout='fuera()'>$datost[topic_title]</a> <br>";
$i++;
}
}
echo '<br> <table width=100% border=0 cellpadding=0 cellspacing=0> <tr> <td id=subnav name=subnav> <a href="$directorio/index.php" target="_blank"> Entrar al Foro</a> </td> </tr> </table>';
mysql_free_result($resultado);
mysql_close($conexion);
?>
El problema es que ultimamente me salen post de esta forma subscrita:
por DarKcApTaiN ")' onmouseout='fuera()'>El club de la lucha 2 CD's...
en vez de salir asi:
Alguien me puede ayudar??? hay algo mal en el codigo??? me es urgente, gracias
Estrenos Cine ---> Caratulas...