if ($option==comentario) {
if (($name) && ($email) && ($comment)) {
mysql_query("insert into comments values('','$articulo','$name','$email','$comment',current_timestamp,'articulo','inactive','$ip')",$conexion);
echo "
Comentario recibido.
« Regresar al Artículo »
";
$destino="fabherca@hotmail.com";
$sfrom="Así Pienso
"; //email asipienso
$sreply="info@asipienso.com";
$sdestinatario="$destino"; //email usuario
$ssubject="Comentario en Artículo"; //subject
$shtml="Te informamos que $name ha hecho un comentario en el Artículo: $title \n\n Para aprobar el comentario por favor visita http://www.asipienso.com/admin \n\n Equipo Así Pienso\n www.asipienso.com"; // mensaje aviso
$sheader="From: $sfrom";
mail($sdestinatario,$ssubject,$shtml,$sheader);
}
else
{
echo "Debes llenar todos los campos, Nombre, Email y Comentario.
« Regresar al Artículo »
";
}
}
else {
function nl2p($str,$addtag='') {
return str_replace('', '', '' . preg_replace('#\n|\r#', '
$0', $str) . '
');
}
$queEmp = "SELECT articles.id, `title`, `lead`, `text`, `lec`, `author`, `date`, `name`, `photo` FROM `articles`, `authors` WHERE `name`=`author` AND articles.id='$id'";
$resEmp = mysql_query($queEmp, $conexion) or die(mysql_error());
$totEmp = mysql_num_rows($resEmp);
if ($totEmp> 0) {
while ($rowEmp = mysql_fetch_assoc($resEmp)) {
$fecha_num="$rowEmp[date]";
setlocale(LC_TIME,'Spanish');
setlocale(LC_TIME,'es_ES');
setlocale(LC_TIME,'es_MX');
$fecha=strftime('%A, %e de %B %Y',strtotime($fecha_num));
$fecha=ucwords($fecha);
$text = nl2p($rowEmp[text]);
echo "".$rowEmp['title']."

$text
Por: ".$rowEmp['author']." - $fecha
".$rowEmp['lec']." Lecturas
";
$visita = 1 + $rowEmp[lec];
$section="articulo";
include "comentarios.php";
}
}
mysql_query("UPDATE `articles` SET `lec`=$visita where `id`=$id") or die(mysql_error());
}
?>
Columnistas
$queEmp = "SELECT * FROM authors order by rand() limit 1";
$resEmp = mysql_query($queEmp, $conexion) or die(mysql_error());
$totEmp = mysql_num_rows($resEmp);
if ($totEmp> 0) {
while ($rowEmp = mysql_fetch_assoc($resEmp)) {
$link = "columnista/$rowEmp[id]/".urls_amigables($rowEmp[name])."";
echo "

".$rowEmp['name']."";
$result=mysql_query("select id, title, author from articles where author='$rowEmp[name]' order by rand() limit 1");
while($row=mysql_fetch_array($result)) {
$link = "/articulo/$row[id]/".urls_amigables($row[title])."";
echo "
Piensa: $row[title]";
}
}
}
?>
Otros Artículos
$queEmp = "SELECT id, title FROM articles WHERE cat='Artículo' order by id DESC LIMIT 9,20";
$resEmp = mysql_query($queEmp, $conexion) or die(mysql_error());
$totEmp = mysql_num_rows($resEmp);
if ($totEmp> 0) {
while ($rowEmp = mysql_fetch_assoc($resEmp)) {
$url = "".$rowEmp['title']."";
$link = "articulo/".$rowEmp['id']."/".urls_amigables($url)."";
echo "
· ".$rowEmp['title']."
";
}
}
?>