Show DevBest [REL] [MySQL] WebDAV Logging script

Status
Not open for further replies.

Jonty

Active Member
Aug 7, 2010
194
65
I'm assuming you know how to make it so /webdav.php shows up as /webdav/ using htaccess, and you will also need to change the aliases around in apache/conf/httpd-dav.conf.

Contents of WebDAV.php:

PHP:
<?php
$con = mysql_connect("localhost", "root", "password") or die(mysql_error());
$db = mysql_select_db("dav_logs");
$ip = $_SERVER['REMOTE_ADDR'];
$checkQuery = mysql_query("SELECT * FROM logs WHERE ip = '".$ip."'");

if(mysql_num_rows($checkQuery))
{
	mysql_query("UPDATE logs SET attempts = attempts + '1' WHERE ip = '".$ip."'");
}
else
{
	mysql_query("INSERT into logs (ip,attempts) VALUES ('".$ip."', '1')");
}


echo "<center><b>WebDAV testpage</center>";




?>

Contents of log.php (or cunt.php):

PHP:
<?php

$con = mysql_connect("localhost", "root", "password") or die(mysql_error());
$db = mysql_select_db("dav_logs");

$gL = mysql_query("SELECT * FROM logs");
while($sL = mysql_fetch_assoc($gL))
{
	$gN = mysql_query("SELECT * FROM logs WHERE ip = '".$sL['ip']."'");
	$sN = mysql_num_rows($gN);
	echo "<font face='tahoma'> Address: " . $sL['ip'] . " | Attempts: " . $sL['attempts'] . "<br>";
	echo "</font face>";
}
?>

And the database structure:

Code:
CREATE TABLE IF NOT EXISTS `logs` (
  `id` int(5) NOT NULL AUTO_INCREMENT,
  `ip` varchar(50) NOT NULL,
  `attempts` int(5) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ip` (`ip`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;

Rate 'n' slate ladies
 

vLife

New Member
Dec 18, 2010
21
0
Nice work,
Finally those noobs who come crying about their hotel being hacked can have a way to get their ips.
 
Status
Not open for further replies.

Users who are viewing this thread

Top