且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如果密码正确,PHP从其他服务器下载.zip文件

更新时间:2023-02-05 08:49:25

在更新服务器上:

 <?php 
if($ _GET ['pass'] == $ thepassword){
header -Transfer-Encoding:binary');
header('Content-Length:'.filesize($ zipfile));
header('Content-Type:application / zip');
readfile($ zipfile);
exit();
}
else {
echo'error';
}
?>


I'm working on my very own CMS. I put the latest updates of the CMS into an update folder on the server and the file name is update.zip.

Is there a way for me to call let's say a PHP file on the update server with a variable e.g. http://updateserver.com/update.php?pass=JDFSDH324723HDSFSDJFDSHSD3

And if the pass is correct that then the system may download the .zip file?

Or if you guys can think a better way of making an update system I'm open for suggestions :)

On the update server:

<?php
if ($_GET['pass'] == $thepassword) {
    header('Content-Transfer-Encoding: binary');
    header('Content-Length: '.filesize($zipfile));
    header('Content-Type: application/zip');
    readfile($zipfile);
    exit();
}
else {
    echo 'error';
}
?>