Ir para conteúdo

carvalhod

Members
  • Total de itens

    3
  • Registro em

  • Última visita

Reputação

0 Comum

Sobre carvalhod

  1. Bom dia. Quando eu salvo informação no banco de dados ele está salvando com 1 hora adiantado. Tipo se for 12h ele salva 13h. eu já usei o date_default_timezone_set("America/Sao_Paulo"); e mesmo assim. Código: class Traffic { private $db; private $uri; private $ip; private $data; private $hora; private $user_agent; public function __construct(){ $this->db = new PDO('mysql:host=localhost; dbname=charts; charset=utf8', 'root', ''); $this->uri = filter_input(INPUT_SERVER, 'REQUEST_URI', FILTER_DEFAULT); $this->ip = filter_input(INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP); $cookie = filter_input(INPUT_COOKIE, md5($this->uri), FILTER_DEFAULT); $this->user_agent = filter_input(INPUT_SERVER, 'HTTP_USER_AGENT'); if(!$cookie): $this->_set_cookie(); $this->_set_data(); endif; } private function _set_cookie() { setcookie(md5($this->uri), TRUE, time() + strtotime(date('Y-m-d 23:59:59')) - time()); //expira todo dia às 23h59 } private function _set_data() { $geo = json_decode(file_get_contents("http://ip-api.com/json/{$this->ip}")); $this->hora=date_default_timezone_set("America/Sao_Paulo"); $this->data['data'] = date('Y-m-d H:i:s'); $this->data['pagina'] = $this->uri; $this->data['ip'] = $this->ip; $this->data['cidade'] = (isset($geo->city)) ? $geo->city : 'desconhecida'; $this->data['regiao'] = (isset($geo->regionName)) ? $geo->regionName : 'Desconhecida'; $this->data['pais'] = (isset($geo->country)) ? $geo->country : 'desconhecida'; $this->data['navegador'] = $this->_get_browser(); $this->data['plataforma'] = $this->_get_platform(); $this->data['referencia'] = $this->_get_referer(); $this->_rec_data(); } ..........
×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.