<?php

include("modulos/settings.php");

function GravaLOG()
{
	$data = date("d/m/y h:i:s A");
	$navegador = $_SERVER['HTTP_USER_AGENT'];
	$ip = $_SERVER['REMOTE_ADDR'];
	$ip_reverso = gethostbyaddr($_SERVER['REMOTE_ADDR']);
	$metodo = $_SERVER['REQUEST_METHOD'];
	$local = $_SERVER['REQUEST_URI'];
	$log = "IP: ".$ip."\r\n";
	$log .= "IP Reverso: ".$ip_reverso."\r\n";
	$log .= "Data: ".$data."\r\n";
	$log .= "Navegador: ".$navegador."\r\n";
	$log .= "Local: ".$local."\r\n";
	$log .= "Metodo: ".$metodo."\r\n";
	$log .= "---------------------------------\r\n\r\n";
	$fp = fopen("logs.txt", "a");
	fwrite($fp, $log);
	fclose($fp);
	die('<div class="box_conteudo">N&atilde;o digite caracteres especiais</div>');
}

foreach($_POST as $value)
foreach($caracteres as $word)
if(substr_count($value, $word) > 0)
GravaLOG();

foreach($_GET as $value)
foreach($caracteres as $word)
if(substr_count($value, $word) > 0)
GravaLOG();

foreach($_COOKIE as $value)
foreach($caracteres as $word)
if(substr_count($value, $word) > 0)
GravaLOG();

foreach($_SESSION as $value)
foreach($caracteres as $word)
if(substr_count($value, $word) > 0)
GravaLOG();

?>