- Joined
- Apr 13, 2008
- Messages
- 1,244
- Reaction score
- 656
A simple log system made by me a long time ago and developed today just for you
1. Output/Save visitors in a new file + reveals the real ip behind the proxy
2. Output/Save visitors in a MySQL database + reveals the real ip behind the proxy
3. Output/Save visitors in a MsSQL database + reveals the real ip behind the proxy
In development...
In development also:
- GeoIP & GeoLocation Systems - will log the country + city of the visitor
- In the last Update (Update_5) - the 3 scripts (point 1, 2 and 3) will be rewritten in just one script with a controler, from which you can choose, whether it will save the visitors information in a file, mssql db, mysql db or file + db !
- BG Translation
Credits (The unimportant stuff):
- A piece of shit, nicknamed "ReaL"
1. Output/Save visitors in a new file + reveals the real ip behind the proxy
PHP:
<?php
function real_ip(){
if(isset($_SERVER)){
if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])){
$hidden_ip = $_SERVER['HTTP_X_FORWARDED_FOR'];}
elseif(isset($_SERVER['HTTP_CLIENT_IP'])){
$hidden_ip = $_SERVER['HTTP_CLIENT_IP'];}
else{
$hidden_ip = $_SERVER['REMOTE_ADDR'];}}
else{
if(getenv('HTTP_X_FORWARDED_FOR')){
$hidden_ip = getenv('HTTP_X_FORWARDED_FOR');}
elseif(getenv('HTTP_CLIENT_IP')){
$hidden_ip = getenv('HTTP_CLIENT_IP');}
else{
$hidden_ip = getenv('REMOTE_ADDR');}}
return $hidden_ip;} //Revealing the real ip behind the proxy
$log_date = date("l dM Y H:i:s"); //Logs the date and time, when the visitor visits
$log_ip = real_ip(); //Logs the real ip of the visitor
$log_agent = $_SERVER['HTTP_USER_AGENT']; //Logs the user agent of the visitor (Browser and some more information)
$log_uri = $_SERVER['REQUEST_URI']; //Logs the filename, which the visitor visits
$log_ref = $_SERVER['HTTP_REFERER']; //Logs the web address, from which the visitor comes to visit
$log_line = "$log_date || IP: $log_ip || UserAgent: $log_agent || Page: $log_uri || Referer: $log_ref\n"; //Don't touch
$log_file = fopen("./visitors.log", "a"); //visitors.log is the name of the file (you can change it if u want
fputs($log_file, $log_line); //Don't touch
header("Location: ../index.php"); //This function redirects the visitor to ../index.php , of course, you can remove this function if you want (it wont mess up the log system)
?>
2. Output/Save visitors in a MySQL database + reveals the real ip behind the proxy
PHP:
<?php
$db_host = "localhost";
$db_user = "Your MySQL User (Default: root)";
$db_pass = "Your MySQL Password (Default: no password)";
$db_name = "Your MySQL DataBase";
$connect = mysql_connect($db_host,$db_user,$db_pass);
if (!$connect){
die('Could not connect to MySQL: ' . mysql_error());}
mysql_select_db($db_name,$connect) or die (mysql_error());
mysql_query("CREATE TABLE IF NOT EXISTS visitors(
id INT NOT NULL AUTO_INCREMENT,
date VARCHAR( 255 ) NOT NULL,
ip VARCHAR( 255 ) NOT NULL,
agent VARCHAR( 255 ) NOT NULL,
uri VARCHAR( 255 ) NOT NULL,
referer VARCHAR( 255 ),
PRIMARY KEY ( id )
)");
function real_ip(){
if(isset($_SERVER)){
if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])){
$hidden_ip = $_SERVER['HTTP_X_FORWARDED_FOR'];}
elseif(isset($_SERVER['HTTP_CLIENT_IP'])){
$hidden_ip = $_SERVER['HTTP_CLIENT_IP'];}
else{
$hidden_ip = $_SERVER['REMOTE_ADDR'];}}
else{
if(getenv('HTTP_X_FORWARDED_FOR')){
$hidden_ip = getenv('HTTP_X_FORWARDED_FOR');}
elseif(getenv('HTTP_CLIENT_IP')){
$hidden_ip = getenv('HTTP_CLIENT_IP');}
else{
$hidden_ip = getenv('REMOTE_ADDR');}}
return $hidden_ip;}
$log_date = date("l dM Y H:i:s");
$log_ip = real_ip();
$log_agent = $_SERVER['HTTP_USER_AGENT'];
$log_uri = $_SERVER['REQUEST_URI'];
$log_ref = $_SERVER['HTTP_REFERER'];
mysql_query("INSERT INTO visitors (date, ip, agent, uri, referer) VALUES ('$log_date', '$log_ip', '$log_agent', '$log_uri', '$log_ref')") or die (mysql_error());
mysql_close($connect);
header("Location: ../index.php");
?>
3. Output/Save visitors in a MsSQL database + reveals the real ip behind the proxy
In development...
In development also:
- GeoIP & GeoLocation Systems - will log the country + city of the visitor
- In the last Update (Update_5) - the 3 scripts (point 1, 2 and 3) will be rewritten in just one script with a controler, from which you can choose, whether it will save the visitors information in a file, mssql db, mysql db or file + db !
- BG Translation
Credits (The unimportant stuff):
- A piece of shit, nicknamed "ReaL"
Last edited: