hola todos! no se me ocurria como nombrar el post! XD
he tenido la experiencia de que los bots que indagan por las webs, buscando correos para hacer publicidad no deseada (spam), y me mandan correos... a partir de eso, se me ocurrió hacer un script que detecta con expresiones regulares el correo dentro de una cadena de texto, pasa por rot13 el correo, y muestra una imagen en vez del correo
aquí les dejo mi sencillo y pequeño script, que cuenta con 2 archivos, el index, y el archivo donde se generará la imagen...
index.php:
<html>
<head>
<title>Cambia correo por imagen</title>
</head>
<body bgcolor="black" text="white">
<form method="post" action="">
<textarea cols="50" rows="20" name="contenido"><?php echo htmlentities($_POST['contenido']); ?></textarea><br>
<input type="submit" value="enviar" name="enviar">
</form>
<?php
function correo_img($correo){
$ss= '/(\S+@\S+\.\S+)/ie';
$resultado= preg_replace($ss,"str_rot13('$1')", $correo);
$s= '/(\S+@\S+\.\S+)/i';
$r = "<img src='imagen.php?text=$1&color=w'>";
$resultado= preg_replace($s, $r, $resultado);
return $resultado;
}
if($_POST['enviar']){
$contenido=htmlentities($_POST['contenido']);
$contenido=str_replace("\n", "<br>\n", $contenido);
echo correo_img($contenido);
}
?>
</body>
</html>
imagen.php
<?php
$text=str_rot13(strip_tags($_GET['text']));
$color=strip_tags($_GET['color']);
header("Content-Type: image/png");
if($color!="b" && $color!="w"){
$width=55;
}else{
$width=strlen($text)*10;
}
$imagen = @imagecreate($width, 20);
if($color=="b"){
$color_fondo = imagecolorallocate($imagen, 0, 0, 0);
$color_texto = imagecolorallocate($imagen, 255, 255, 255);
}else if($color=="w"){
$color_fondo = imagecolorallocate($imagen, 255, 255, 255);
$color_texto = imagecolorallocate($imagen, 0, 0, 0);
}else{
$color_fondo = imagecolorallocate($imagen, 255, 255, 255);
$color_texto = imagecolorallocate($imagen, 255, 0, 0);
$text="error!";
}
imagestring($imagen, 5, 5, 6, $text, $color_texto);
imagepng($imagen);
imagedestroy($imagen);
?>
si desean ver su funcionamiento, aqui les dejo un demo...
Los enlaces son solo para miembros.
Registrate o
iniciá sesiónSaludos!