Пример #1
0
 $query5 = $sql->prepare("UPDATE `serverlist` SET `anticheat`=?,`map`=?,`mapGroup`=?,`servertemplate`=? WHERE `id`=? AND `resellerid`=? LIMIT 1");
 $query6 = $sql->prepare("UPDATE `gsswitch` SET `ppassword`=AES_ENCRYPT(?,?) WHERE `id`=? LIMIT 1");
 $query = $sql->prepare("SELECT `id`,`resellerid` FROM `rserverdata` WHERE `active`='Y'");
 $query->execute();
 while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
     $resellerLockupID = $row['resellerid'];
     $appServer = new AppServer($row['id']);
     $query2->execute(array($aeskey, $row['id']));
     while ($row2 = $query2->fetch(PDO::FETCH_ASSOC)) {
         $query3->execute(array($row2['id'], $currenttime));
         while ($row3 = $query3->fetch(PDO::FETCH_ASSOC)) {
             $query4->execute(array($row3['server_id'], $row3['switchID'], $resellerLockupID));
             $query5->execute(array($row3['anticheat'], $row3['map'], $row3['mapGroup'], $row3['template'], $row3['server_id'], $resellerLockupID));
             $appServer->getAppServerDetails($row3['switchID']);
             if ($row3['restart'] == 'N' and $row3['worldsafe'] == 'Y') {
                 $appServer->mcWorldSave();
                 echo 'MC worldsave: ' . $row2['server'] . "\r\n";
             }
             if ($row3['restart'] == 'N' and $row3['upload'] == 'Y') {
                 $appServer->demoUpload();
                 echo 'Demo upload for: ' . $row2['server'] . "\r\n";
             }
             if ($row3['restart'] == 'Y') {
                 if ($row3['protected'] == 'Y' and $row2['protected'] == 'N') {
                     $appServer->stopAppHard();
                     $query6->execute(array(passwordgenerate(20), $aeskey, $row3['switchID']));
                     $appServer->getAppServerDetails($row3['switchID']);
                     $appServer->removeApp($row3['template']);
                     $appServer->addApp($row3['template']);
                 }
                 $appServer->startApp();