myDC.ru

Здравствуйте, гость ( Вход | Регистрация )

 
 
Ответить в данную темуНачать новую тему

> Что Это Такое?, что-то нарыл да вот только не понятно что это...

Теги
Нет тегов для показа
MEXAHuK
сообщение 26.1.2009, 20:26
Сообщение #1


Освоившийся участник
*****

Группа: Пользователи
Сообщений: 314
Регистрация: 13.10.2008
Пользователь №: 791
Спасибо сказали: 9 раз




сабж:
CODE
<title>DC Hub Connection Logs</title>
<?php
//Note: anything with "//" before it is a comment
//Anything with "/*" is the start of a comment for a block of code
//Anything with "*/" is the end of a comment for a block of code
//Rename this file to index.php and place it in your root web directory if you want it to load by default

/*
Uncomment these lines if you want to restrict access to this site to only 127.0.x.x networks
and 197.145.x.x networks. You can change the IP address values as needed. Delete this comment also
$test = "^197.145";
$test2 = "^127.0";
$ip = $_SERVER['REMOTE_ADDR'];
if (!eregi($test,$ip) && !eregi($test2,$ip)){
echo "Please wait...";
exit(0);
}
*/

ini_set('display_errors','FALSE'); //we don't want to see any errors; set to TRUE for debugging
error_reporting(E_ALL); //no error reporting; set to error_reporting(0); for debugging
$logfolder = "C:/0.4.1.1/scripts/Rincewind's Grimoire/Settings/Security/UserLog/Logs"; //folder containing the Grimore logs
if (is_dir($logfolder)){
chdir($logfolder);
$error = "";
}
else {
$error = "Could not find log folder.";
}
$debug = FALSE; //Do not show debugging information
$dbx = array();
$forbidden = array(
"",
"..",
".",
"RECYCLER",
"System Volume Information",
"Copy of "
);

//logfile format:
//connect-disconnect, date, time, name, ip, description, email, version, share, mode, speed

?>
<h1 onclick="window.location='grimoirelogsfinal.php'">Search</h1>
<?php echo "<font color=red>$error</font>" ?>
<table>
<tr>
<td>Location
<td>String
<td>Search only today
<td>
</tr>
<tr>
<form name="search" method=get action=<?php echo $_SERVER['SCRIPT_NAME'] ?>>
<td><select name="location">
<option value=0>C/D
<option value=1>Date
<option value=2>Time
<option value=3 selected>Nick
<option value=4>IP
<option value=5>Comment
<option value=6>Email
<option value=7>Version
<option value=8>Share
<option value=9>Mode
<option value=10>Connection
</select>
<td><input type="text" name="searchstring">
<td><input type="checkbox" name="t" checked>
<td><button>Search</button>
</tr>
</table>
<table>
<tr>
<td>C/D
<td>Time
<td>Date
<td>Nick
<td>IP
<td>Comment
<td>Email
<td>Version
<td>Share
<td>Mode
<td>Connection
</tr>
<tr>
<td><input type="checkbox" name="0">
<td><input type="checkbox" name="1">
<td><input type="checkbox" name="2" checked>
<td><input type="checkbox" name="3" checked>
<td><input type="checkbox" name="4" checked>
<td><input type="checkbox" name="5">
<td><input type="checkbox" name="6" checked>
<td><input type="checkbox" name="7">
<td><input type="checkbox" name="8" checked>
<td><input type="checkbox" name="9">
<td><input type="checkbox" name="10">
</tr>
</table>
<br><input type="checkbox" name="debug"> Debug
<br><input type="checkbox" name="raw"> Raw results <p>
<?php
if (isset($_GET['debug'])){
$debug=TRUE;
}
if ($debug){
echo "<tt>Opening Directory: $logfolder<br>";
}
if (isset($_GET['location'])){
//Old log file format for logs in Grimoire v4.1.0
//If you are using Grimoire v5.1.1 only...delete the entire section of code below
//until the next comment where I tell you to stop
$files = scandir($logfolder);
if (isset($_GET['t'])){
$filename = "ConnectionLog-" . date('Y-m-d') . ".csv";
$files = "";
$files = array($filename);
}
for($i=0; $i<count($files); $i++){
if(is_file($files[$i]) && !array_search($files[$i],$forbidden)){
if ($debug){
echo "<tt>Loading $files[$i]...</tt><br>";
}

load_file($files[$i]);
}
}

//Stop deleting the section for the Grimoire v4.1.0 logs here

//New log file format for logs in Grimoire v5.1.1
//If you are using a previous version of Grimoire (like v4.1.0)...delete the entire section of code below
//until the next comment where I tell you to stop
$files = scandir($logfolder);
if (isset($_GET['t'])){
$filename = "UserLog-" . date('Y-m-d') . ".csv";
$files = "";
$files = array($filename);
}
for($i=0; $i<count($files); $i++){
if(is_file($files[$i]) && !array_search($files[$i],$forbidden)){
if ($debug){
echo "<tt>Loading $files[$i]...</tt><br>";
}

load_file($files[$i]);
}
}
//Stop deleting the section for the Grimoire v5.1.1 logs here

$results_local = parse_data();
global $results;
$results = $results_local;
if ($debug){
echo "Results:<pre>"; print_r($results); echo "</pre>";
for ($j=0; $j<=10; $j++){
for ($i=0; $i<20; $i++){
echo "($i,$j)<br>";
}
}
}
if ($debug){
//echo "Search:<pre>"; print_r($dbx); echo "</pre>";
echo "<tt>Finished.</tt><br>";
}
if (isset($_GET['raw'])){

}
?>
<table border=1>
<tr>
<?php
if (isset($_GET['0'])){
echo "<td>C/D\r";
}
if (isset($_GET['1'])){
echo "<td>Time\r";
}
if (isset($_GET['2'])){
echo "<td>Date\r";
}
if (isset($_GET['3'])){
echo "<td>Nick\r";
}
if (isset($_GET['4'])){
echo "<td>IP\r";
}
if (isset($_GET['5'])){
echo "<td>Comment\r";
}
if (isset($_GET['6'])){
echo "<td>Email\r";
}
if (isset($_GET['7'])){
echo "<td>Version\r";
}
if (isset($_GET['8'])){
echo "<td>Share\r";
}
if (isset($_GET['9'])){
echo "<td>Mode\r";
}
if (isset($_GET['10'])){
echo "<td>Connection\r";
}
?>
</tr>
<tr>
<?php
$linkme = $_SERVER['REQUEST_URI'];
$needle = $_GET['searchstring'];
$linkme = strstr($linkme,$needle);
$linkme = strstr($linkme,'&');
if (isset($_GET['0'])){
echo "<td valign=top>";
foreach($results[0] as $value){
echo "$value<br>";
}
}
if (isset($_GET['1'])){
echo "<td valign=top>";
foreach($results[1] as $value){
echo "$value<br>";
}
}
if (isset($_GET['2'])){
echo "<td valign=top>";
foreach($results[2] as $value){
echo "$value<br>";
}
}
if (isset($_GET['3'])){
echo "<td valign=top>";
foreach($results[3] as $value){
echo "<a href=\"?location=3&searchstring=$value$linkme\">$value</a><br>";
}
}
if (isset($_GET['4'])){
echo "<td valign=top>";
foreach($results[4] as $value){
echo "<a href=\"?location=4&searchstring=$value$linkme\">$value</a><br>";
}
}
if (isset($_GET['5'])){
echo "<td valign=top>";
foreach($results[5] as $value){
echo "$value<br>";
}
}
if (isset($_GET['6'])){
echo "<td valign=top>";
foreach($results[6] as $value){
echo "$value<br>";
}
}
if (isset($_GET['7'])){
echo "<td valign=top>";
foreach($results[7] as $value){
echo "$value<br>";
}
}
if (isset($_GET['8'])){
echo "<td valign=top>";
foreach($results[8] as $value){
echo "$value<br>";
}
}
if (isset($_GET['9'])){
echo "<td valign=top>";
foreach($results[9] as $value){
echo "$value<br>";
}
}
if (isset($_GET['10'])){
echo "<td valign=top>";
foreach($results[10] as $value){
echo "$value<br>";
}
}
?>
</tr>
</table>
<?php
}


function max_share($data){
static $maxshare = 0;
static $maxusers = 0;
static $currentshare = 0;
static $currentusers = 0;
$share = explode(" ",$data[8]);
switch ($share[1]){
case "KiBs":
$nshare = $share[0];
break;
case "MiBs":
$nshare = $share[0]*1000;
break;
case "GiBs":
$nshare = $share[0]*10000;
break;
case "TiBs":
$nshare = $share[0]*100000;
break;
}

echo "$share[0]$share[1] = $nshare KiBs<br>";
if ($data[0] == "C"){
$currentshare = $currentshare + $nshare;
}

if ($data[0] == "D"){
$currentshare = $currentshare - $nshare;
}

if ($currentshare > $maxshare){
$maxshare = $currentshare;
$show = $maxshare/1000000;
echo "Maxshare: $show TB<br>";
}

}
function load_file($file){
global $debug, $dbx;
$line = file($file);
for($i=0; $i<count($line); $i++){
$data = split(",",$line[$i]);
if ($debug){
//echo "<tt>Beginning search()...</tt><br>";
}
search($data);

if ($debug){
//echo "<pre>"; print_r($results); echo "</pre>";
}
//max_share($data);

}
if ($debug){
echo "<tt>Beginning parse_data()...</tt><br>";
}

}
function search($data){
global $debug, $dbx;
$index = $_GET['location'];
if ($data[$index] == $_GET['searchstring']){
if ($debug){
echo "<tt>$data[0]\t$data[1]\t$data[2]\t$data[3]\t$data[4]\t$data[5]\t$data[6]\t$data[7]\t$data[8]\t$data[9]\t$data[10]\t</tt><br>";
}
if (isset($_GET['raw'])){
echo "<tt>$data[0]\t$data[1]\t$data[2]\t$data[3]\t$data[4]\t$data[5]\t$data[6]\t$data[7]\t$data[8]\t$data[9]\t$data[10]\t</tt><br>";
}
$dbx[] = $data;

}
}
function parse_data(){
global $dbx, $debug;
$result = array_fill(0,11,array());
$total = count($dbx);
echo "Found <b>$total</b> entries.";
if ($debug){
echo "<b>$total</b>";
//$dbx[row entry (0,1,2,3,4)][current column(c/d,date,ip,nick)]
}

for ($j=0; $j<=10; $j++){

for ($i=0; $i<$total; $i++){
if ($debug){
echo "<tt>($i,$j)</tt><br>";
}
$needle = $dbx[$i][$j];
$haystack = $result[$j];

if ($debug){
echo "<tt>Searching for {$dbx[$i][$j]} in result($j) ($i,$j)</tt><br>";
}
if (!in_array($needle,$haystack)){
if ($debug){
echo "<tt>{$dbx[$i][$j]} Was not found.</tt><br>";
$use = count($result[$j]);
$use++;
}
$result[$j][] = $dbx[$i][$j];
if ($debug){
echo "<pre>"; print_r($result); echo "</pre>";
}
}
else{
if ($debug){
echo "<tt>{$dbx[$i][$j]} FOUND, skipping<br>";
break;
}
}

}

}
return $result;
}

?>
Go to the top of the page
+Quote Post
Wariner
сообщение 26.1.2009, 20:31
Сообщение #2


Самый главный активист :-D
***********

Группа: Модераторы
Сообщений: 2 790
Регистрация: 29.6.2008
Из: г. Тула
Пользователь №: 97
Спасибо сказали: 440 раз




а тебе не кажется что ты форумом ошибся, ну или хотя бы разделом?!!!

PS: тему перенёс....
Go to the top of the page
+Quote Post

Ответить в данную темуНачать новую тему
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0

Collapse

> Похожие темы

  Тема Ответов Автор Просмотров Последнее сообщение
No New Posts Что такое хороший хаб?
Немного рассуждений на тему критериев качества хаба
13 Enyby 11 208 21.1.2012, 21:15 Посл. сообщение: SKIFI
No New Posts Дело было такое...
Нужна помощь
8 Ferb 9 079 2.12.2010, 14:37 Посл. сообщение: Saymon21
No New Posts От: Дело было такое...
От темы с ID: 4084
0 Osimus 3 544 30.11.2010, 17:04 Посл. сообщение: Osimus
No New Posts Где взять такое?
0 Voice 4 013 27.7.2009, 15:23 Посл. сообщение: Voice
Closed Да что это такое?
Как убрать? помогите!
1 JlёJluK 5 292 18.6.2009, 22:06 Посл. сообщение: Maximum
No New Posts Возможно Ли Такое?
Перевод под Windows XP
4 Accelerator 10 060 27.3.2009, 18:50 Посл. сообщение: FAT_32
No New Posts Не Пойму Фто Такое ? :d
1 BadPapa 5 272 29.1.2009, 8:42 Посл. сообщение: ustas
No New Posts Topic has attachmentsКак Сделать Такое Меню?
API2
9 Lpein 14 350 13.1.2009, 23:16 Посл. сообщение: Gangster-Toni
Closed А Возможно Ли Такое?
отображение иероглифов в хабе... API2
4 Caratel 9 227 7.1.2009, 22:18 Посл. сообщение: *FoxMalder*

 



RSS Сейчас: 20.4.2024, 0:01