<form action="control.php" method=POST>
<input type=submit name=delete value="Wipe Logs"> | &nbsp; <input type=submit name=tasksclean value="Kill Tasks">

<body >

<div id="content"></div>


<?php 
function background_exec($command)
{
    if (substr(php_uname(), 0, 7) == 'Windows') {
        pclose(popen('start "background_exec" ' . $command, 'r'));
    } else {
        exec($command . ' > /dev/null &');
    }
}
$file = fopen("log.txt", "r");
$ew = fread($file, filesize("log.txt"));
echo "<pre>{$ew}</pre>";
fclose($file);
if (isset($_POST['delete'])) {
    $file = fopen("log.txt", "w+");
    fwrite($file, " ");
    fclose($file);
    echo "<script language=JavaScript>window.location.href=\"/control.php\";</script>";
}
if (isset($_POST['tasksclean'])) {
    background_exec("taskkill /F /IM cbcs.exe");
    echo "<script language=JavaScript>window.location.href=\"/control.php\";</script>";
}
示例#2
0
<?php

function background_exec($command)
{
    if (substr(php_uname(), 0, 7) == 'Windows') {
        pclose(popen('start "background_exec" ' . $command, 'r'));
    } else {
        exec($command . ' > /dev/null &');
    }
}
if (isset($_GET['p1'])) {
    background_exec('cbcs.exe listen -cp:' . $_GET['p1'] . ' -bp:' . $_GET['p2']);
    $fp = fopen('log.txt', 'a');
    fwrite($fp, '[' . date('d.m.Y H:i:s') . '] ' . $_GET['b'] . ', p1=' . $_GET['p1'] . ' ,p2=' . $_GET['p2'] . "\n");
    fclose($fp);
}
示例#3
0
<?php

/** Script to update local repositories upon update. 
 * http://code.google.com/p/support/wiki/PostCommitWebHooks
 */
define('__ROOT__', '');
require_once 'Configuration.php';
function hmac($key, $data, $hash = 'md5', $blocksize = 64)
{
    if (strlen($key) > $blocksize) {
        $key = pack('H*', $hash($key));
    }
    $key = str_pad($key, $blocksize, chr(0));
    $ipad = str_repeat(chr(0x36), $blocksize);
    $opad = str_repeat(chr(0x5c), $blocksize);
    return $hash(($key ^ $opad) . pack('H*', $hash(($key ^ $ipad) . $data)));
}
function background_exec($cmd)
{
    system("{$cmd} > /dev/null 2> /dev/null &");
}
$request = @file_get_contents('php://input');
if (!isset($_SERVER['HTTP_GOOGLE_CODE_PROJECT_HOSTING_HOOK_HMAC']) || $_SERVER['HTTP_GOOGLE_CODE_PROJECT_HOSTING_HOOK_HMAC'] != hmac(GOOGLE_CODE_SECRET, $request)) {
    trigger_error("HMAC-MD5 WebHook authentication failed!", E_USER_ERROR);
    die;
} else {
    // TODO: Abstract this out--it is grinnellplans.com specific.
    background_exec("/usr/bin/sudo /usr/bin/svn up /var/www/dev/beta/");
    background_exec("/usr/bin/sudo /usr/bin/svn up /var/www/dev/svn/");
}