<?php
if($_GET["action"]=="postMsg"){
function quitar($mensaje){
$mensaje = str_replace("<","<",$mensaje);
$mensaje = str_replace(">",">",$mensaje);
$mensaje = str_replace("<-/\-/\-/\-Otro Comentario-/\-/\-/\->","Soy un n00b",$mensaje);
$mensaje = str_replace("<-/*\->","<--/+\-->",$mensaje);
//bbCode Imágenes
$mensaje = str_replace("[img]",'<img src="',$mensaje);
$mensaje = str_replace("[/img]",'" width="380">',$mensaje);
//bbCode Videos Youtube
$mensaje = str_replace("[youtube]youtube.com/watch?v=",'<embed src="youtube.com/v/',$mensaje);
$mensaje = str_replace("[/youtube]",'" type="application/x-shockwave-flash" wmode="transparent" width="380" height="295"></embed>',$mensaje);
//bbCode Negritas
$mensaje = str_replace("[b]","<b>",$mensaje);
$mensaje = str_replace("[/b]","</b>",$mensaje);
//salto de Linea (enter)
$mensaje = str_replace("\n","<br>",$mensaje);
//bbCode Centrado
$mensaje = str_replace("[center]","<center>",$mensaje);
$mensaje = str_replace("[/center]","</center>",$mensaje);
//bbCode Color de Fuente
$mensaje = str_replace('[color ="','<font color="',$mensaje);
$mensaje = str_replace("]",'">',$mensaje);
$mensaje = str_replace("[/color]","</font>",$mensaje);
//bbCode Tamaño de Fuente
$mensaje = str_replace('[6]',"<h1>",$mensaje);
$mensaje = str_replace('[5]',"<h2>",$mensaje);
$mensaje = str_replace('[4]',"<h3>",$mensaje);
$mensaje = str_replace('[3]',"<h4>",$mensaje);
$mensaje = str_replace('[2]',"<h5>",$mensaje);
$mensaje = str_replace('[1]',"<h6>",$mensaje);
$mensaje = str_replace('[/6]',"</h1>",$mensaje);
$mensaje = str_replace('[/5]',"</h2>",$mensaje);
$mensaje = str_replace('[/4]',"</h3>",$mensaje);
$mensaje = str_replace('[/3]',"</h4>",$mensaje);
$mensaje = str_replace('[/2]',"</h5>",$mensaje);
$mensaje = str_replace('[/1]',"</h6>",$mensaje);
return $mensaje;
}
if($_POST["nick"] != null && $_POST["mensaje"] != null){
if(file_exists("comentarios.txt")){
$archivo = fopen("comentarios.txt","r+");
if($archivo){
while(!feof($archivo)){
fread($archivo,1);
}
$texto = "<-/\-/\-/\-Otro Comentario-/\-/\-/\->\n".quitar($_POST["nick"])."<-/*\->".date(d."/".m."/".y)."<-/*\->".quitar($_POST["mensaje"])."\n";
fwrite($archivo,$texto);
fclose($archivo);
}
}
}
}
function agregar($mensaje){
$mensaje = str_replace("\'","'",$mensaje);
$mensaje = str_replace('\"','"',$mensaje);
return $mensaje;
}
$archivo = fopen("comentarios.txt","r+");
while(!feof($archivo)){
$file = $file.fgets($archivo);
}fclose($archivo);
$comentario = explode("<-/\-/\-/\-Otro Comentario-/\-/\-/\->",$file);
$contador = 0;
//bgcolor='#FFFFCC' link='#FFFFCC' vlink='#FFFFCC' alink='#FFFFCC
?>
<head>
<title>Comentarios</title>
</head>
<body bgcolor="#FFFFCC" alink="#FFFFCC" vlink="#FFFFCC">
<table align="center" width="402" cellpadding="0" cellspacing="0">
<tr height="20">
<td colspan="4" bgcolor="#0033FF">
<center>
<b>
<font face="Papyrus" color="#ffffff">Comentarios</font>
</b>
</center>
</td>
</tr>
<?
$contador = 0;
while($comentario[$contador] != null){
$parte = explode("<-/*\->",$comentario[$contador]);
?>
<tr>
<td width="1" bgcolor="#0033FF">
</td>
<td bgcolor="#0033FF" width="200">
<font face="Papyrus" color="#ffffff">Por: <b><?echo $parte[0];?></b></font>
</td>
<td bgcolor="#0033FF" width="200">
<p align="right">
<font face="Papyrus" color="#ffffff"><i><?echo $parte[1];?></i></font>
</p>
</td>
<td width="1" bgcolor="#0033FF">
</td>
</tr>
<tr>
<td width="1" bgcolor="#0033FF">
</td>
<td colspan="2" bgcolor="#FFFFCC">
<font face="Papyrus" color="#000000"><?echo agregar($parte[2]);?></font>
</td>
<td width="1" bgcolor="#0033FF">
</td>
</tr>
<? $contador++;
}
?>
<tr height="20">
<td colspan="4" bgcolor="#0033FF">
</td>
</tr>
<tr height="20">
<td colspan="4" bgcolor="#0033FF">
<center>
<b><font face="Papyrus" color="#ffffff">Postear un comentario</font></b>
</center>
</td>
</tr>
<form action="?action=postMsg" method="post">
<tr>
<td width="1" bgcolor="#0033FF">
</td>
<td width="200" bgcolor="#0033FF">
<center>
<b><font face="Papyrus" color="#ffffff">Nick:</font></b><input type="text" name="nick" size="22" style="{border:2px dotted #ffffff; background-color:#FFFFCC;color:#000000;}">
</center>
</td>
<td width="200" bgcolor="#0033FF">
<center>
<font face="Papyrus" color="#ffffff"><i><?echo date(d."/".m."/".y);?></i></font>
</center>
</td>
<td width="1" bgcolor="#0033FF">
</td>
</tr>
<tr>
<td width="1" bgcolor="#0033FF">
</td>
<td colspan="2" bgcolor="#FFFFCC">
<center>
<font face="Papyrus" color="#000000"><b>Mensaje</b></font><br>
<textarea name="mensaje" cols="46" rows="12" style="{border:2px dotted #0033FF; background-color:#FFFFCC;color:#000000;}"></textarea><br>
<input type="submit" value="Enviar" style="{border-color:#ffffff; background-color:#0033FF; color:#ffffff;}">
</center>
</td>
<td width="1" bgcolor="#0033FF">
</td>
</tr>
</form>
<tr height="20">
<td colspan="4" bgcolor="#0033FF">
<center>
<b><font size="2" color="#ffffff" face="Papyrus">
Powered by: <a href="mailto:nuker.the.best@gmail.com">Nuker</a>
</font></b>
</center>
</td>
</tr>
</table>