Loga Usuários!
Publicado por Leonardo Berbert Gomes 30/12/2004
[ Hits: 5.741 ]
Homepage: https://www.linkedin.com/in/leoberbert
Script CGI em Python, que
tem a função de logar os
acessos a uma página da Web.
#!../CGIpython/cgipython
import os, sys, string
logfilename = "/absolute/path/to/log/file/directory/"
# change the directory path
exc_list = ["xxx.xxx.xxx.xxx", "xxx.xxx.xxx.xxx"]
#exc_list = []
# the list of machines to exclude from logging
######### And now the tricky bit #############
# Get input
infolist = sys.argv[1:] + [ os.popen('date').read(),
os.environ.get("REMOTE_ADDR", "--noaddr--"),
os.environ.get("HTTP_USER_AGENT", "--noagent--"),
os.environ.get("HTTP_REFERER", "--noreferer--"),
'\n']
# print infolist
out = string.join(infolist, ' : ')
address = os.environ.get("REMOTE_ADDR", "noaddr")
logfilename += (address + ".dat")
if address not in exc_list:
open(logfilename,'a').write(out)
print "Content-type: text/html\n\n"
hcoin - Preço do Dólar, Bitcoin e Euro em Python
Nenhum comentário foi encontrado.
Jogando Daikatana (Steam) com Patch 1.3 via Luxtorpeda no Linux
LazyDocker – Interface de Usuário em Tempo Real para o Docker
Instalando COSMIC no Linux Mint
Turbinando o Linux Mint: o poder das Nemo Actions
Inteligência Artificial no desenvolvimento de software: quando começar a usar?
O widget do Plasma 6 Área de Notificação
[Resolvido] Algo deu errado ao abrir seu perfil
Instalar Dual Boot, Linux+Windows. (12)
Problemas com o "startx&... no Slackware (10)
Conselho distribuiçao brasileira (8)
Atalho no Linux Mint não aparece menu de troca de monitores (0)









