gpt4 book ai didi

PHP执行外部命令后返回空白页

转载 作者:太空宇宙 更新时间:2023-11-04 05:28:12 24 4
gpt4 key购买 nike

我的脚本:

<?php
include 'theme.php';
/*ceklogin();*/
css();
if($_POST['wget-send'])
{
$formdir=$_POST['dir'];
$formlink=$_POST['link'];
$toSave = nl2br($_POST["link"]);
$simpan = str_replace('<br />', '', $toSave);
$filelink = fopen('/root/wget/wget-download-link.txt',a);
$filedir = fopen('/root/wget/wget-dir.txt',w);

fwrite($filedir, $formdir);
fwrite($filelink, $simpan. "\n");
}

if($_POST['restart-download'])
{
exec('mv /root/wget/wget-download-link.txt.done /root/wget/wget-download-link.txt > /dev/null 2>&1 &');
exit();
}

if($_POST['stop-wget'])
{
exec('killall wget > /dev/null 2>&1 &');
exit();
}

echo "<form action=\"".$PHP_SELF."\" method=\"post\" id=\"WgetForm\">";
echo "Download directory:<br><input type=\"text\" name=\"dir\" size=\"15\" value=\"/mnt/usb/\"/><br>";
echo '<br>Download link:';
echo ("<textarea name=\"link\" rows=\"13\" cols=\"62\"></textarea><br>");
echo '
<input type="submit" onclick="DownloadRestarted()" name="restart-download" value="Restart latest download" id="RestartWget" />
<input type="submit" onclick="LinkAdded()" name="wget-send" value="Download" id="WgetID" />
<input type="submit" onclick="WgetStopped()" name="stop-wget" value="Stop Wget" id="StopWget" />
</form>
</div>';
echo <<<HTML
<script type="text/javascript">

function LinkAdded()
{
alert("Link has been sucessfully sent to wget, it'll be downloaded soon, check the wget log for the download progress");
}
function DownloadRestarted()
{
alert("Download restarted, check the wget log for the download progress");
}
function WgetStopped()
{
alert("Wget has been successfully stopped, no download is running right now");
}

</script>
HTML;
foot();
echo '
</div>
</body>
</div>
</html>';
?>

请注意exec部分。每当我单击重新启动最新下载停止Wget时,它总是返回一个空白页面。我的脚本出了什么问题?解决该问题的唯一临时方法是删除exec部分,但这也会使我无法使这些按钮工作。

最佳答案

if block 中删除 exit(),这就是页面空白的原因

exit() 终止当前脚本

关于PHP执行外部命令后返回空白页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27761495/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com