Beispiel #1
0
function scanip($ip, $timeout, $portarr)
{
    foreach ($portarr as $port) {
        if (check_port($ip, $port, $timeout = 0.1) == True) {
            echo 'Port: ' . $port . ' is open<br/>';
            @ob_flush();
            @flush();
        }
    }
}
Beispiel #2
0
{
    $sock = @fsockopen($ip, $port, $errno, $errstr, PORT_CHECK_TIMEOUT);
    if (!$sock) {
        return false;
    }
    fclose($sock);
    return true;
}
header('Content-type: text/plain');
try {
    $db = new PDO('sqlite:openra.db');
    $ip = $_SERVER['REMOTE_ADDR'];
    $port = $_REQUEST['port'];
    $addr = $ip . ':' . $port;
    $name = $_REQUEST['name'];
    $connectable = check_port($ip, $port);
    if (!$connectable) {
        $name = '[down]' . $name;
    }
    $insert = $db->prepare('INSERT OR REPLACE INTO servers 
            (name, address, players, state, ts, map, mods) 
            VALUES (:name, :addr, :players, :state, :time, :map, :mods)');
    $insert->bindValue(':name', $name, PDO::PARAM_STR);
    $insert->bindValue(':addr', $addr, PDO::PARAM_STR);
    $insert->bindValue(':players', $_REQUEST['players'], PDO::PARAM_INT);
    $insert->bindValue(':state', $_REQUEST['state'], PDO::PARAM_INT);
    $insert->bindValue(':time', time(), PDO::PARAM_INT);
    $insert->bindValue(':map', $_REQUEST['map'], PDO::PARAM_STR);
    $insert->bindValue(':mods', $_REQUEST['mods'], PDO::PARAM_STR);
    $insert->execute();
    if (isset($_REQUEST['new'])) {
function get_available_port($start = 1080, $end = 65535)
{
    while (true) {
        $p = rand($start, $end);
        if (check_port($p)) {
            return $p;
        }
    }
}
Beispiel #4
0
         if ($elapsed < $wait) {
             err('Not authorized (' . ($wait - $elapsed) . 'h) - READ THE FAQ!');
         }
     }
 }
 $passkey_ip = $az['passkey_ip'];
 if ($passkey_ip != '' && getip() != $passkey_ip) {
     err('Unauthorized IP for this passkey!');
 }
 if ($az['parked'] == 'yes') {
     err('Error, your account is parked!');
 }
 if (portblacklisted($port)) {
     err('Port ' . $port . ' is blacklisted.');
 } else {
     $sockres = check_port($ip, $port, 5);
     if (!$sockres) {
         $connectable = 'no';
         if ($nc == 'yes') {
             err('Your client is not connectable! Check your Port-configuration or search on forums.');
         }
     } else {
         $connectable = 'yes';
         @fclose($sockres);
     }
 }
 $res = mysql_query('SELECT torrent, userid FROM snatched WHERE torrent = ' . $torrentid . ' AND userid = ' . $userid) or err(mysql_error());
 $check = mysql_fetch_array($res);
 if (!$check) {
     mysql_query("INSERT LOW_PRIORITY INTO snatched (torrent, userid, port, startdat, last_action) VALUES ({$torrentid}, {$userid}, {$port}, {$dt}, {$dt})");
 }
<?php

/**
 * EasyPHP: a complete WAMP environement for PHP development & personal
 * web hosting including PHP, Apache, MySQL, PhpMyAdmin, Xdebug...
 * DEVSERVER for PHP development and WEBSERVER for personal web hosting
 * @author   Laurent Abbal <*****@*****.**>
 * @link     http://www.easyphp.org
 */
// Array of available ports
$ports = array(80, 8080, 8000, 8888);
$ports_available = array($_SERVER['SERVER_PORT']);
foreach ($ports as $port) {
    if (!check_port($port)) {
        $ports_available[] = $port;
    }
}
// Parameters
$parameters_mgmt = array('new_server_port' => array('name' => 'available ports', 'values' => $ports_available, 'description' => $ports_available_desc));
// Read httpd.conf -> array
$source = "../conf_files/httpd.conf";
$httpdconf = file_get_contents($source);
$httpdconf_array = explode("\r\n", $httpdconf);
$parameters_conf = array();
$action = "http://" . $_SERVER['HTTP_HOST'] . "/home/" . $file . "apacheconfmanager_update.php";
?>

<form method="post" action="<?php 
echo $action;
?>
" style="clear:both;width:580px;padding:10px 0px 0px 0px;margin:0px auto 0px auto;text-align:center;">
Beispiel #6
0
        <ul>
            <li>Welcome</li>
            <li>Push Server</li>
            <li>Environment</li>
            <li><b>Database</b></li>
        </ul>
        </div>

        <div id="main">
        <h2>Database Setup</h2>
        
        <table>
        <tr>
        <td>Host Check</td>
        <?php 
        if (check_port(3306, "{$db_host}")) {
            ?>
  
            <td class="success">Connected -  <?php 
            echo $db_host;
            ?>
</td>
        <?php 
        } else {
            $fail = TRUE;
            ?>
            <td class="error">Having issues connecting to the database host - <?php 
            echo $db_host;
            ?>
</td>
        <?php 
Beispiel #7
0
if ($wantpassword == $wantusername) {
    bark("Извините, пароль не может быть такой-же как имя пользователя.");
}
if (!validemail($email)) {
    bark("Это не похоже на реальный email адрес.");
}
list(, $domain) = explode('@', $email);
if (!mail_possible($email)) {
    bark('Почты в таком домене быть не может (' . htmlspecialchars_uni($domain) . ')');
}
if ($check_for_working_mta) {
    // Some pre PHP 5.3 WINDOWS installations...
    if (function_exists('getmxrr')) {
        getmxrr($domain, $mxs);
        foreach ($mxs as $mx) {
            if (check_port($mx, 25, 1, true)) {
                $is_good_smtp = true;
                break;
            }
        }
        if (!$is_good_smtp) {
            bark("На вашей почтовой службе не работает почтовый сервер (MTA).");
        }
    }
}
if (!validusername($wantusername)) {
    bark("Неверное имя пользователя.");
}
if ($year == '0000' || $month == '00' || $day == '00') {
    stderr($tracker_lang['error'], "Похоже вы указали неверную дату рождения");
}
}
// Port initialization
if ($_SERVER['SERVER_PORT'] == '8887') {
    $source = "../conf_files/httpd.conf";
    $httpdconf = file_get_contents($source);
    // Backup old httpd.conf
    $backup_httpdconf = "../conf_files/httpd_" . date("Y-m-d@U") . ".conf";
    $fp_backup = fopen($backup_httpdconf, 'w');
    fputs($fp_backup, $httpdconf);
    fclose($fp_backup);
    // Search and replace
    if (!check_port(80)) {
        $new_port = 80;
    } elseif (!check_port(8080)) {
        $new_port = 8080;
    } elseif (!check_port(8888)) {
        $new_port = 8888;
    }
    $search = ':' . $_SERVER['SERVER_PORT'];
    $replace = ':' . $new_port;
    $httpdconf = str_replace($search, $replace, $httpdconf);
    // Save new httpd.conf
    $fp_update = fopen('../conf_files/httpd.conf', 'w');
    fputs($fp_update, $httpdconf);
    fclose($fp_update);
    $redirect = "http://" . $_SERVER['SERVER_NAME'] . ":" . $new_port . "/home/index.php";
    header("Location: " . $redirect);
    exit;
}
$www = @opendir($_SERVER["DOCUMENT_ROOT"]);
$www_files = array();
Beispiel #9
0
function server_report()
{
    $report = array();
    $svcs = array('22' => 'SSH', '80' => 'HTTP', '3306' => 'MySQL');
    foreach ($svcs as $port => $service) {
        $report[$service] = check_port($port);
    }
    return $report;
}
Beispiel #10
0
    return true;
}
// === body ===
// make sure everything required is actually set.
foreach (array('port', 'name', 'state', 'map', 'mods', 'players') as $key) {
    if (!isset($_REQUEST[$key])) {
        die('field "' . $key . '" is not set');
    }
}
try {
    $ip = $_SERVER['REMOTE_ADDR'];
    $port = $_REQUEST['port'];
    $addr = $ip . ':' . $port;
    // don't get spammed so easily
    if ($_REQUEST['state'] == 1) {
        if (!check_port($ip, $port)) {
            die('[001] game server "' . $addr . '" does not respond');
        }
    }
    $name = urldecode($_REQUEST['name']);
    $started = '';
    $version_arr = explode('@', $_REQUEST['mods']);
    $game_mod = array_shift($version_arr);
    $version = implode('@', $version_arr);
    $db = new PDO('sqlite:db/openra.db');
    if ($_REQUEST['state'] == 2) {
        $query = $db->prepare('SELECT * FROM servers WHERE address = :addr');
        $query->bindValue(':addr', $addr, PDO::PARAM_STR);
        $query->execute();
        $result = $query->fetchAll();
        foreach ($result as $row) {