예제 #1
0
        $username = $row['newlayout'] == 'Y' ? $row['cname'] . '-' . $row['id'] : $row['cname'];
        if ($row['protected'] == 'N' and $row['servertemplate'] > 1) {
            $shorten .= '-' . $row['servertemplate'];
            $pserver = 'server/';
        } else {
            if ($row['protected'] == 'Y') {
                $username .= '-p';
                $ftppass = $row['decryptedftppass'];
                $pserver = '';
            } else {
                $pserver = 'server/';
            }
        }
        $ftpConnect = new EasyWiFTP($row['ftp_ip'], $row['ftpport'], $username, $ftppass);
        $downloadChrooted = $ftpConnect->removeSlashes($pserver . $row['serverip'] . '_' . $row['port'] . '/' . $shorten . '/' . $row['binarydir'] . '/screenlog.0');
        if ($ftpConnect->ftpConnection) {
            if (!$ftpConnect->downloadToTemp($downloadChrooted, 32768, false, $ui->isinteger('lastLog', 'get'))) {
                $array['error'] = 'Cannot download screenlog from ' . $downloadChrooted;
            } else {
                $array['lastLog'] = $ftpConnect->getLastFileSize();
                $array['log'] = nl2br($ftpConnect->getTempFileContent());
            }
        } else {
            $array['error'] = 'Cannot connect to FTP Server ' . $row2['ip'] . ':' . $row2['ftpport'];
        }
    }
}
if ($query->rowCount() < 1) {
    $array['error'] = 'Error: No rootID';
}
die(json_encode($array));
예제 #2
0
파일: class_app.php 프로젝트: Eun/developer
 private function easyAntiCheatSettings($action = 'start')
 {
     global $resellerLockupID;
     if ($this->appServerDetails['eacAllowed'] == 'Y') {
         $gameType = $this->getGameType();
         // On app start we only run commands for supported games
         if ($action == 'start' and in_array($this->appServerDetails['app']['anticheat'], array(3, 4, 5, 6)) and ($gameType == 'hl1' or $gameType == 'hl2')) {
             if ($gameType == 'hl2') {
                 $config = 'cfg/server.cfg';
             } else {
                 if ($gameType == 'hl1') {
                     $config = 'server.cfg';
                 } else {
                     $config = 'main/server.cfg';
                 }
             }
             $ftpObect = new EasyWiFTP($this->appMasterServerDetails['ssh2IP'], $this->appMasterServerDetails['ftpPort'], $this->appServerDetails['userNameExecute'], $this->appServerDetails['ftpPasswordExecute']);
             if ($ftpObect->loggedIn === true) {
                 if (!$ftpObect->downloadToTemp($this->appServerDetails['absoluteFTPPath'] . $config)) {
                     $ftpObect->downloadToTemp($this->appServerDetails['absoluteFTPPathNoChroot'] . $config);
                 }
                 $configFile = $ftpObect->getTempFileContent();
                 $configFile = str_replace(array("", "\\b", "\r", "\\Z"), '', $configFile);
                 $configFile = preg_replace('/\\s+/', ' ', $configFile);
                 $lines = explode("\n", $configFile);
                 foreach ($lines as $singeLine) {
                     // Do a rough check if the line is a comment
                     if (preg_match("/\\w/", substr($singeLine, 0, 1))) {
                         if (preg_match("/\"/", $singeLine)) {
                             $exploded = explode('"', $singeLine);
                             $cvar = str_replace(' ', '', $exploded[0]);
                         } else {
                             $exploded = explode(' ', $singeLine);
                             $cvar = $exploded[0];
                         }
                         if ($cvar == 'rcon_password' and isset($exploded[1])) {
                             $rconPassword = $exploded[1];
                         }
                     }
                 }
                 if (isset($rconPassword)) {
                     eacchange('change', $this->appServerDetails['template']['id'], $rconPassword, $resellerLockupID);
                 }
             }
             // On app stop we run commands in any case to ensure we remove left overs
         } else {
             if ($action == 'stop') {
                 eacchange('remove', $this->appServerDetails['template']['id'], '', $resellerLockupID);
             }
         }
     }
 }
예제 #3
0
     } else {
         $game_cvars = array();
     }
 }
 $configfile = '';
 $cleanedconfig = '';
 $newconfig = '';
 $setarray = array();
 $ftp = new EasyWiFTP($ip, $ftpport, $username, $ftppass);
 if ($ftp->loggedIn === true) {
     if ($ui->smallletters('type', 4, 'get') == 'full' and isset($ui->post['update']) and $ui->post['update'] == 1) {
         $configfile = stripslashes($ui->post['cleanedconfig']);
     } else {
         if ($ui->smallletters('type', 4, 'get') == 'easy' or $ui->smallletters('type', 4, 'get') == 'full' and !isset($ui->post['update'])) {
             $ftp->downloadToTemp($pserver . $serverip . '_' . $port . '/' . $ftpshorten . '/' . $config);
             $configfile = $ftp->getTempFileContent();
         }
     }
     $lines = array();
     if (strlen($configfile) > 0) {
         $configfile = str_replace(array("", "\\b", "\r", "\\Z"), '', $configfile);
         $lines = explode("\n", $configfile);
     }
     if (isset($ui->post['update']) and $ui->post['update'] == 1 and isset($lines)) {
         foreach ($lines as $singeline) {
             $singeline = preg_replace('/\\s+/', ' ', $singeline);
             if (preg_match("/\\w/", substr($singeline, 0, 1))) {
                 if (preg_match("/\"/", $singeline)) {
                     $split = explode('"', $singeline);
                     $cvar = str_replace(' ', '', $split[0]);
                     $value = $split[1];
예제 #4
0
파일: serverlog.php 프로젝트: Eun/developer
        }
    }
    if (isset($rootID)) {
        $query = $sql->prepare("SELECT `ip`,`ftpport` FROM `rserverdata` WHERE `id`=? AND `resellerid`=? LIMIT 1");
        $query->execute(array($rootID, $resellerLockupID));
        while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
            $ftpport = $row['ftpport'];
            $ip = $row['ip'];
            $ftpConnect = new EasyWiFTP($ip, $ftpport, $username, $ftppass);
            $downloadChrooted = $ftpConnect->removeSlashes($pserver . $serverip . '_' . $port . '/' . $shorten . '/' . $binarydir . '/screenlog.0');
            if ($ftpConnect->ftpConnection) {
                if (!$ftpConnect->downloadToTemp($downloadChrooted, 32768)) {
                    $error = 'Cannot download screenlog from ' . $downloadChrooted;
                }
            } else {
                $error = 'Cannot connect to FTP Server ' . $ip . ':' . $ftpport;
            }
        }
        if (isset($ip)) {
            $log = isset($error) ? $error : nl2br($ftpConnect->getTempFileContent());
            $ftpConnect->tempHandle = null;
            $ftpConnect = null;
        } else {
            $log = 'Error: wrong rootID';
        }
    } else {
        $log = 'Error: No rootID';
    }
}
include IncludeTemplate($template_to_use, 'gameserverlog.tpl');
$sql = null;