34 lines
708 B
PHP
34 lines
708 B
PHP
<?php
|
|
$base = dirname(__DIR__);
|
|
$stop = $base . '/data/stop.flag';
|
|
$bat = $base . '/start_bot.bat';
|
|
|
|
$action = $_GET['action'] ?? '';
|
|
|
|
if ($action === 'start') {
|
|
$cmd = 'cmd /c start "" /min "' . $bat . '"';
|
|
|
|
if (function_exists('popen')) {
|
|
@pclose(@popen($cmd, 'r'));
|
|
} else {
|
|
@shell_exec($cmd . ' >NUL 2>&1');
|
|
}
|
|
|
|
header('Location: index.php');
|
|
exit;
|
|
}
|
|
|
|
if ($action === 'stop') {
|
|
file_put_contents($stop, '1');
|
|
header('Location: index.php');
|
|
exit;
|
|
}
|
|
|
|
if ($action === 'restart') {
|
|
file_put_contents($stop, '1');
|
|
echo '<meta http-equiv="refresh" content="1; url=control.php?action=start">Genstarter...';
|
|
exit;
|
|
}
|
|
|
|
header('Location: index.php');
|