Przedszkolak
Postów: 6
Data rejestracji: 08.01.2008 18:55
|
Witam. Jak w temacie ponizszy kod to nic innego jak pinger dc. Moje pytanie tyczy sie gdzie to dac w fusionie i jak aby to zadzialalo i czy wogole to pod fusionem zadziala.
<?php
require ('include/sesiune.php');
require ('functions.php');
require ('config.php');
require ('style/theme.php');
header_popup();
mysql_connect($_mysql_host, $_mysql_user, $_mysql_password) or die("Nu ma pot conecta la MySQL!");
mysql_select_db($_mysql_db) or die("Nu gasesc baza de date");
echo "Last Ping was :";
echo "<br>\r\n";
$ttestt3 = mysql_query("SELECT (last_ping) FROM dark ORDER BY id DESC LIMIT 1");
$ttestt4 = mysql_fetch_row($ttestt3);
echo "$ttestt4[0] founding";
echo "<br>\r\n";
mysql_query("CREATE TABLE IF NOT EXISTS dark (id int(11) NOT NULL auto_increment, userlist varchar(255) collate utf8_unicode_ci NOT NULL, sharesize bigint(20) NULL, address varchar(255) collate utf8_unicode_ci NOT NULL, port varchar(255) collate utf8_unicode_ci NOT NULL, last_ping timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id), UNIQUE KEY (last_ping)) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;");
$test5 = mysql_query("SELECT (ulist2) FROM 0084_dark_angel ORDER BY id DESC LIMIT 1");
$test6 = mysql_fetch_row($test5);
echo "$test6[0] Users Online sharing ";
echo "<br>\r\n";
$ttestt7 = mysql_query("SELECT SUM(sharesize / 1099511627776) FROM 084_dark_angel ORDER BY id DESC");
$ttestt8 = mysql_fetch_row($ttestt7);
echo "$ttestt8[0] TB";
echo "<br>\r\n";
echo "Let's see how many I'll count this time ";
echo "<br>\r\n";
echo "<br>\r\n";
echo "<hr>";
mysql_query("DROP TABLE dark_angel");
mysql_query("DROP TABLE 084_dark_angel");
mysql_query("ALTER TABLE 'dark_angel' DROP ulist");
mysql_query("ALTER TABLE 'dark_angel' DROP ulist2");
mysql_query("ALTER TABLE 'dark_angel' DROP address");
mysql_query("ALTER TABLE 'dark_angel' DROP port");
mysql_query("DROP TABLE ulist");
mysql_query("DROP TABLE ulist2");
mysql_query("CREATE TABLE IF NOT EXISTS ulist (sharesize VARCHAR(255) CHARACTER SET greek COLLATE greek_general_ci NOT NULL )");
mysql_query("CREATE TABLE IF NOT EXISTS ulist2 (sharesize2 VARCHAR(255) CHARACTER SET greek COLLATE greek_general_ci NOT NULL )");
$conexiune = mysql_connect($_mysql_host, $_mysql_user, $_mysql_password) or die("Nu ma pot conecta la MySQL!");
mysql_select_db($_mysql_db, $conexiune) or die("Nu gasesc baza de date");
$rrr = mysql_query("SELECT * FROM active_hubs");
$rra = mysql_fetch_array($rrr);
if(!isset($_GET['actiune'])) $_GET['actiune'] = '';
switch($_GET['actiune'])
{
case '':
echo '<center><font size="1" face="Verdana" color="#4682B4"><b>Accesul direct la aceasta pagina nu este permis !</b></font></center>';
break;
case 'status':
$dbs = "SELECT * FROM `active_hubs` WHERE id='".$_GET['id']."'";
$rezultat = mysql_query($dbs);
while($rand = mysql_fetch_array($rezultat))
{
$address = $rand['address'];
$port = $rand['port'];
$data = date('H:i:s');
$data2 = date('d-m-Y');
$command = 'On '.$data2.' at '.$data.' are currently --->';
$command2 = 'Users Online';
$sharesize = 334652547200; // octeti
$email = '';
$description = 'Bot';
if ($_GET['hub_type'] == 'YnHub')
{
}
else
if ($_GET['hub_type'] == 'Verlihub')
{
if ($fp=@fsockopen(htmlentities($address, ENT_QUOTES),$port,$ERROR_NO,$ERROR_STR,(float)60))
{
echo '<span class="online"><center><b>Hubul este Online</b></center></span><br><br>';
function executa($sock, $str) {
socket_send($sock, $str.'|', strlen($str) + 1, NULL);
}
function lock2key($_LOCK) {
$lockLength = strlen ($_LOCK);
$h = ord($_LOCK{0}) ^ ord( $_LOCK{ $lockLength - 1} ) ^ ord( $_LOCK{ $lockLength - 2} ) ^ 5;
while ($h > 255) {$h = $h - 256;}
$h = (($h<<4) & 240) | (($h>>4) & 15);
$a = $h;
if ($a == '126' || // '~'
$a == '124' || // '|'
$a == '96' || // '`'
$a == '36' || // '$'
$a == '5' || // '^E'
$a == '0') // NUL
{
$LockToKey = "/%DCN";
if ($a < 100)
$LockToKey .="0";
if ($a < 10)
$LockToKey .="0";
$LockToKey .= $a;
$LockToKey .= "%/";
} else {
$LockToKey = chr ($a);
}
for ($j = 1; $j < strlen($_LOCK); $j++) {
$h = ord($_LOCK{$j}) ^ ord($_LOCK{$j-1});
while ($h > 255) {$h = $h - 256;}
$h = (($h<<4) & 240) | (($h>>4) & 15);
$a = $h;
if ($a == '126' || // '~'
$a == '124' || // '|'
$a == '96' || // '`'
$a == '36' || // '$'
$a == '5' || // '^E'
$a == '0') // NUL
{
$LockToKey .= "/%DCN";
if ($a < 100)
$LockToKey .="0";
if ($a < 10)
$LockToKey .="0";
$LockToKey .= $a;
$LockToKey .= "%/";
} else {
$LockToKey .= chr ($a);
}
}
return $LockToKey;
}
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if (!socket_connect($socket, gethostbyname($address), $port)) {
echo 'Error : '.socket_strerror(socket_last_error());
return;
}
while ($buffer = socket_read($socket, 2048, PHP_BINARY_READ)) {
$linie = explode('|', $buffer);
for ($i = 0; $i < sizeof($linie); ++$i) {
$user = explode(' ', $linie[$i]);
switch($user[0]) {
case '$BadPass':
echo "Parola incorecta<br>\r\n";
break;
case '$GetPass':
executa($socket, '$MyPass '.$pass);
break;
case '$Hello':
if ($user[1] == $nick) {
executa($socket, '$Version 1,0091');
executa($socket, '$MyINFO $ALL '.$nick.' '.$description.'<++ V:0.674,M:A,H:1/0/1,S:20>$ $LAN(T3).$'.$email.'$'.$sharesize.'$');
}
break;
case '$HubName':
break;
case '$Lock':
executa($socket, '$Supports UserCommand NoGetINFO NoHello UserIP2 TTHSearch ');
executa($socket, '$Key '.lock2key($user[1]));
executa($socket, '$ValidateNick '.$nick);
break;
case '$LogedIn':
break;
case '$MyINFO':
if ($user[2] == $nick) {
executa($socket, '$GetNickList');
}
else {
echo "$user[2]<br>\r\n";
mysql_connect($_mysql_host, $_mysql_user, $_mysql_password) or die("Nu ma pot conecta la MySQL!");
mysql_select_db($_mysql_db) or die("Nu gasesc baza de date");
mysql_query("CREATE TABLE IF NOT EXISTS dark_angel (id int(11) NOT NULL auto_increment, userlist varchar(255) collate utf8_unicode_ci NOT NULL, sharesize bigint(20) NULL, address varchar(255) collate utf8_unicode_ci NOT NULL, port varchar(255) collate utf8_unicode_ci NOT NULL, last_ping timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id), UNIQUE KEY (last_ping)) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;");
mysql_query("ALTER TABLE 'dark_angel' ADD INDEX ('userlist')");
mysql_query("CREATE TABLE IF NOT EXISTS 084_dark_angel (id int(11) NOT NULL auto_increment, userid int(11) NOT NULL, userlist varchar(255) collate utf8_unicode_ci NOT NULL, sharesize bigint(20) NOT NULL, address varchar(255) collate utf8_unicode_ci NOT NULL, port varchar(255) collate utf8_unicode_ci NOT NULL, last_ping timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id), INDEX (userid)) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci");
echo "<br>\r\n";
$rest = strpos($user[5], "$");
// START PRINTING $ FROM THE SECOND
// -1 CUTS THE LAST SEARCH STRING [$]
$rest = substr($user[5], 0, -1);
$res = strrpos($rest, "$");
// START PRINTING $ FROM THE SECOND
// -1 CUTS THE LAST SEARCH STRING [$]
$res = substr($rest, "$res" );
$rest = strrchr($res, "$");
// START PRINTING $ FROM THE SECOND
// -1 CUTS THE LAST SEARCH STRING [$]
$rest = substr($res, 1 );
echo "$rest<br>\r\n";
echo "<br>\r\n";
mysql_query("INSERT INTO 084_dark_angel (userlist, sharesize, address, port) VALUES ('$user[2]', '$rest', '$address', '$port' )");
echo "<hr>";
$test1 = mysql_query("SELECT COUNT(*) FROM 084_dark_angel");
$test2 = mysql_fetch_row($test1);
echo "$test2[0]";
mysql_query("INSERT INTO 0084_dark_angel (ulist, ulist2, address, port) VALUES ('$test2[0]', '$test2[0]', '$address', '$port')") ;
echo "<br>\r\n";
echo "<hr>";
$test3 = mysql_query("SELECT id FROM 084_dark_angel ORDER BY id DESC LIMIT 1");
$test4 = mysql_fetch_row($test3);
echo "$test4[0]";
echo "<br>\r\n";
mysql_query("UPDATE grlist.0084_dark_angel SET ulist2 = $test2[0]") ;
echo "<hr>";
$test5 = mysql_query("SELECT ulist2 FROM 0084_dark_angel ORDER BY id DESC LIMIT 1");
$test6 = mysql_fetch_row($test5);
echo "$test6[0]";
echo "<br>\r\n";
echo "<hr>";
$test7 = mysql_query("SELECT SUM(sharesize) FROM 084_dark_angel");
$test8 = mysql_fetch_row($test7);
echo "$test8[0]";
mysql_query("INSERT INTO dark_angel (sharesize, address, port) VALUES ('$test8[0]', '$address', '$port')") ;
mysql_query("INSERT INTO dark (userlist, sharesize) VALUES ('$test6[0]', '$test8[0]')") ;
echo "<br>\r\n";
echo "<hr>";
break;
}
break;
case '$Broadcasting':
break;
case '$Broadcastin':
break;
case '$roadcasting':
break;
case '$roadcastin':
break;
case '$1.1>':
break;
case '$.1>':
break;
case '$otification':
break;
case '$Notification':
break;
case '$OpList':
break;
case '$Quit':
break;
case '$o':
break;
case 'o':
break;
case 'o:':
break;
case 'o:':
break;
case 'o':
break;
case '$Search':
break;
case '$version':
break;
case '$Supports':
break;
case '$HubTopic':
break;
case '$HUB':
break;
case '$To':
break;
case '$To:':
break;
case 'HUB':
break;
case 'broadcasting':
break;
case '$broadcasting':
break;
case '____________________':
break;
case '______________________':
break;
case '_____________________':
break;
case '$UserCommand':
break;
case '$ForceMove':
break;
case '$ValidateDenide':
break;
case 'Another':
break;
case '$ValidateDenide':
break;
default:
if (substr($user[0], 0, 1) == '<') {
} else if ($user[0] != "")
echo "Comanda nesuportata: \"".$user[0]."\"<br>\r\n";
}
}
}
fclose($fp);
socket_close($socket);
?>
- <center>
Current User Count:<br>
- <textarea cols="10" rows="1" readonly="readonly" class="thHead">
- <?
mysql_query("INSERT INTO active_hubs (nicklist) VALUES ('$test2[0]')");
mysql_query("UPDATE grlist.active_hubs SET nicklist = $test2[0]") ;
$test1 = mysql_query("SELECT COUNT(*) FROM 084_dark_angel");
$test2 = mysql_fetch_row($test1);
echo "$test2[0]";
mysql_query("UPDATE grlist.0084_dark_angel SET ulist2 = $test2[0]") ;
fclose($socket);
socket_close($socket);
?>
- </textarea>
- </center>
- <?
}
else
{
echo '<center><span class="offline"><b>Hubul este Offline !</b></span></center>';
}
}
}
break;
}
footer_popup();
?>
Kliknij i zaczekaj na załadowanie kodu ...
P.S. Dodam ze skrypt dostalem z drugiej reki wiec nawet nie wiem czy jest porawny.
Pozdrawiam
PW od moderatora:
- Przeniesienie tematu - Pieka 07.11 - 20:05
Edytowane przez Pieka dnia 07.11.2008 20:04:53
|