$ch = ClientHandler::getInstance($client); array_push($process_list, array('client' => $client, 'RunningProcessInfo' => $ch->runningProcessInfo(), 'pinfo' => shell_exec("ps auxww | " . $cfg['bin_grep'] . " " . tfb_shellencode($ch->binClient) . " | " . $cfg['bin_grep'] . " -v grep"))); } $tmpl->setloop('process_list', $process_list); } // drivespace-bar tmplSetDriveSpaceBar(); break; // netstat // netstat case "netstat": // set vars if ($cfg['isAdmin']) { // set vars $tmpl->setvar('netstatConnectionsSum', netstatConnectionsSum()); $tmpl->setvar('netstatPortList', netstatPortList()); $tmpl->setvar('netstatHostList', netstatHostList()); } // language $tmpl->setvar('_ID_HOSTS', $cfg['_ID_HOSTS']); $tmpl->setvar('_ID_PORTS', $cfg['_ID_PORTS']); $tmpl->setvar('_ID_CONNECTIONS', $cfg['_ID_CONNECTIONS']); // drivespace-bar tmplSetDriveSpaceBar(); break; // xfer // xfer case "xfer": // is enabled ? if ($cfg["enable_xfer"] != 1) { AuditAction($cfg["constants"]["error"], "ILLEGAL ACCESS: " . $cfg["user"] . " tried to use xfer");
/** * Print Net Stat * * @return mixed */ function _netstat() { global $cfg; echo $cfg['_ID_CONNECTIONS'] . ":\n"; echo netstatConnectionsSum() . "\n"; echo $cfg['_ID_PORTS'] . ":\n"; echo netstatPortList(); echo $cfg['_ID_HOSTS'] . ":\n"; echo netstatHostList(); return true; }
?> <br> <div align="left" id="BodyLayer" name="BodyLayer" style="border: thin solid <?php echo $cfg["main_bgcolor"]; ?> ; position:relative; width:740; height:500; padding-left: 5px; padding-right: 5px; z-index:1; overflow: scroll; visibility: visible"> <?php echo "<pre>"; echo "<strong>" . _DRIVESPACE . "</strong>\n\n"; echo $result; echo "<br><hr><br>"; echo $result2; echo "<br><hr><br>"; echo "<strong>" . _SERVERSTATS . "</strong>\n\n"; echo $result4; echo "<br><hr><br>"; echo $result5; echo "<br><hr><br>"; echo "<strong>" . _ID_CONNECTIONS . " : </strong>"; echo netstatConnectionsSum(); echo "<br>\n"; echo "<strong>" . _ID_PORTS . " : </strong>\n"; echo netstatPortList(); echo "<br>\n"; echo "<strong>" . _ID_HOSTS . " : </strong>\n"; echo netstatHostList(); echo "</pre>"; echo "</div>"; DisplayFoot();
function printNetStat() { echo "\n"; echo "---------------------------------------\n"; echo " TorrentFlux-NetStat \n"; echo "---------------------------------------\n"; echo "\n"; echo " --- " . _ID_CONNECTIONS . " --- \n"; echo netstatConnectionsSum(); echo "\n\n"; echo " --- " . _ID_PORTS . " --- \n"; echo netstatPortList(); echo "\n"; echo " --- " . _ID_HOSTS . " --- \n"; echo netstatHostList(); echo "\n"; }
/** * gets available port and sets field port * * @return boolean */ function setClientPort() { $portString = netstatPortList(); $portAry = explode("\n", $portString); $this->port = (int) $this->minport; while (1) { if (!in_array($this->port, $portAry)) { return true; } else { $this->port += 1; } if ($this->port > $this->maxport) { $this->status = -1; $this->messages .= "<b>Error</b> All ports in use.<br>"; return false; } } return false; }
/** * gets available port and sets port field * * @return boolean */ function _setClientPort() { global $cfg; $portString = netstatPortList(); $portAry = explode("\n", $portString); $this->port = intval($this->minport); while (1) { if (in_array($this->port, $portAry)) { $this->port += 1; } else { return true; } if ($this->port > $this->maxport) { // state $this->state = CLIENTHANDLER_STATE_ERROR; // message $msg = "All ports in use."; array_push($this->messages, $msg); AuditAction($cfg["constants"]["error"], $msg); $this->logMessage($msg . "\n", true); // write error to stat $sf = new StatFile($this->transfer, $this->owner); $sf->time_left = 'Error'; $sf->write(); // return return false; } } return false; }