:: Archivo de abril, 2010

Evitar spam rechazando comentarios que contienen ciertas palabras

solo hay 1 comentario
Archivado en wordpress :: Por aldols :: abril 9, 2010 ::

Desde hace tiempo tenia problemas de spam en uno de mis blogs, diariamente tenia que borrar alrededor de 600 mensajes de spam... aunque wordpress trae un filtro nativo para palabras e ip's WordPress dejaba los mensajes en moderacion o en la carpeta de spam...

Pero aqui les dejo esta alternativa para rechazar comentarios que contengan ciertas palabras...en el archivo funtions.php de tu theme agrega lo siguiente.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
function in_comment_post_like($string, $array) {
	foreach($array as $ref) { if(strstr($string, $ref)) { return true; } }
	return false;
}
function drop_bad_comments() {
	if (!empty($_POST['comment'])) {
		$post_comment_content = $_POST['comment'];
		$lower_case_comment = strtolower($_POST['comment']);
		$bad_comment_content = array(
			'viagra',
			'hydrocodone',
			'hair loss',
			'[url=http',
			'[link=http',
			'xanax',
			'tramadol',
			'russian girls',
			'russian brides',
			'lorazepam',
			'adderall',
			'dexadrine',
			'no prescription',
			'oxycontin',
			'without a prescription',
			'sex pics',
			'family incest',
			'online casinos',
			'online dating',
			'cialis',
			'best forex',
			'amoxicillin'
		);
		if (in_comment_post_like($lower_case_comment, $bad_comment_content)) {
			$comment_box_text = wordwrap(trim($post_comment_content), 80, "n  ", true);
			$txtdrop = fopen('/var/log/httpd/wp_post-logger/nullamatix.com-text-area_dropped.txt', 'a');
			fwrite($txtdrop, "  --------------n  [COMMENT] = " . $post_comment_content . "n  --------------n");
			fwrite($txtdrop, "  [SOURCE_IP] = " . $_SERVER['REMOTE_ADDR'] . " @ " . date("F j, Y, g:i a") . "n");
			fwrite($txtdrop, "  [USERAGENT] = " . $_SERVER['HTTP_USER_AGENT'] . "n");
			fwrite($txtdrop, "  [REFERER  ] = " . $_SERVER['HTTP_REFERER'] . "n");
			fwrite($txtdrop, "  [FILE_NAME] = " . $_SERVER['SCRIPT_NAME'] . " - [REQ_URI] = " . $_SERVER['REQUEST_URI'] . "n");
			fwrite($txtdrop, '--------------**********------------------'."n");
			header("HTTP/1.1 406 Not Acceptable");
			header("Status: 406 Not Acceptable");
			header("Connection: Close");
			wp_die( __('bang bang.') );
		}
	}
}
add_action('init', 'drop_bad_comments');

Agrega tus propios términos a rechazar en el array bad_comment_content. A mi me funciono.. ahora solo me llegan 6 comentarios de spam al dia... Espero les sirva...

Via | Blog and Web

Infografia de Firefox

0 comentarios
Archivado en Navegadores :: Por aldols :: abril 7, 2010 ::

Firefox es el navegador que mas uso, aunque Chrome tambien me ha agradado, y no lo cambio por nada... asi que leyendo nagando en la red me encuentro con una excelente infografia acerca de este famoso navegador. Sin mas rollo les dejo los numero de Firefox.


Click en imagen para ampliar