compilemachinegame/index.php
2022-07-27 16:33:37 +08:00

42 lines
1.1 KiB
PHP

<?php
include_once('vendor/autoload.php');
header("Content-type:text/html;charset=utf-8");
use phpseclib3\Crypt\RSA;
use phpseclib3\Net\SSH2;
use phpseclib3\Crypt\PublicKeyLoader;
echo("<title>打包機遊戲列表</title>");
echo "打包機遊戲列表<br>";
$ssh = new SSH2('192.168.5.108', 22);
$public_key = file_get_contents(__DIR__."\authorized_keys");
$private_key = file_get_contents(__DIR__."\Publisher");
$key = PublicKeyLoader::load($private_key);
if ($ssh->login('Publisher', $key)) {
// echo('Connected');
} else {
die('Login Failed');
}
$dir = $ssh->exec('dir /b/on D:\Casino-Core-Type2\assets\Game');
$dirs = explode("\n",$dir);
function lensort($a,$b){
return strlen($a)-strlen($b);
}
usort($dirs,'lensort');
for ( $i=0 ; $i<count($dirs); $i++ ) {
$dirname = $dirs[$i];
if (strpos($dirname, "Game_") !== false && strpos($dirname, ".meta") === false) {
$gamedir = $ssh->exec('dir /b/on D:\Casino-Core-Type2\assets\Game\\'.$dirname);
$gamedirs = explode("\n",$gamedir);
if ( count($gamedirs) > 2 ) {
echo $dirname . "<br>";
}
}
}
?>