Contador
Publicado por Francis David 23/01/2005
[ Hits: 6.708 ]
Homepage: http://blog.fdavid.com.br
Contato de visitas em PHP, pega o IP do ultimo visitante para não incrementar o contato quando o mesmo visitante carregar o index.html novamente.
/** counterview.php **
* Under GNU License
* Author Knancys (http://knancys.no-ip.info)
* ICQ# 174253802 des-fdavid@netsite.com.br
*
* June, 13 of 2004
* Description: PHP script for counter view of web site
*
* counterview.cvs -> Include counter and IP of last visitor (run-time creator)
*/
/** change log **
* 06-20-04 -> (upd) File counterview (ASCII) converted to CSV format
*
*/
<?php
//Variables
$fn = "counterview.csv";
$file = fopen ($fn, "r");
$cv = 1;
//Id's visitor and counter
If ($file)
{ $arq = fread ($file, filesize ($fn));
$cv = substr ($arq, 0, strpos ($arq, ";"));
$ip = substr ($arq, strpos ($arq, ";") + 1, filesize ($fn));
fclose ($file);
If ($ip != $_SERVER["REMOTE_ADDR"])
$cv = $cv + 1;
}
//Add IP Visitor
$record = (string) $cv;
$record .= ';' . $_SERVER["REMOTE_ADDR"];
//Write in file
$file = fopen ($fn, "w");
fwrite ($file, $record);
fclose ($file);
//Return Counter View
print $cv;
?>
Nenhum comentário foi encontrado.
Gentoo binário em 2026: UEFI, LUKS, Btrfs e Systemd
Trabalhando Nativamente com Logs no Linux
Jogando Daikatana (Steam) com Patch 1.3 via Luxtorpeda no Linux
LazyDocker – Interface de Usuário em Tempo Real para o Docker
Usando dracut e dispensando genkernel no Gentoo + LUKS + Btrfs
Curso GRÁTIS: OCS Inventory NG - Do Deploy ao Hardening com foco em Segurança da Informação!
Instalando fontes via script no Nautilus Scripts no Gnome do Debian 13
O que houve com slackware ??? (3)
Pendrive do Ubuntu 24.04 travando ao tentar fazer a instalação dual bo... (5)









