예제 #1
0
    }
}
// Load the list of games
$oldDir = getcwd();
chdir("../scripts");
$__logPrefix = "lwControl";
$__loader = array('log', 'classloader', 'version', 'game', 'tick', 'config', 'db_connection', 'db_accessor', 'db', 'library');
require_once "loader.inc";
chdir($oldDir);
$games = config::getGames();
dbConnect();
// Handle commands
if ($_GET['c'] != '') {
    $cGame = $_GET['g'];
    if (array_key_exists($cGame, $games) && $cGame != 'main') {
        handleCommand($_GET['c'], $games[$cGame]);
    }
}
?>
<html>
 <head>
  <title>LegacyWorlds Beta 5 > Administration > Game status</title>
 </head>
 <body>
  <h1><a href="index.html">LWB5 > Administration</a> > Game status</h1>

  <h2>Game list</h2>
  <p>
   <b>WARNING:</b> make sure you know what you're doing here - there are no second chances on this page;
   if you click something, that "something" <i>will</i> happen <i>at once</i>.
  </p>
예제 #2
0
파일: irc.php 프로젝트: valek0972/hackits
    sendCommand("NICK {$nickname}\n\r");
    sendCommand("USER {$nickname} USING PHP IRC\n\r");
    while (!feof($server['SOCKET'])) {
        $server['READ_BUFFER'] = fgets($server['SOCKET'], 1024);
        if (strpos($server['READ_BUFFER'], "376") && !strpos($server['READ_BUFFER'], "PRIVMSG")) {
            sendCommand("JOIN {$server_channel}\n\r");
        } elseif (substr($server['READ_BUFFER'], 0, 6) == "PING :") {
            sendCommand("PONG :" . substr($server['READ_BUFFER'], 6) . "\n\r");
        } else {
            echo $server['READ_BUFFER'];
            if (strpos($server['READ_BUFFER'], "PRIVMSG {$server_channel}")) {
                file_put_contents($logfile, date("H:i:s") . $server['READ_BUFFER'], FILE_APPEND);
                $nick = substr($server['READ_BUFFER'], 1, strpos($server['READ_BUFFER'], "!") - 1);
                $message = substr($server['READ_BUFFER'], strpos($server['READ_BUFFER'], "PRIVMSG {$server_channel}") + strlen($server_channel) + 10, strlen($server['READ_BUFFER']));
                if (substr($message, 0, 1) == $controlchar) {
                    handleCommand($nick, $message, $server_channel);
                }
            }
        }
        flush();
    }
    echo "Socket closed\n";
} else {
    echo $errno . " : " . $errstr;
}
function sendCommand($cmd)
{
    global $server;
    fwrite($server['SOCKET'], $cmd, strlen($cmd));
}
function handleCommand($nick, $message, $channel)