if ($toomuch > 0) { $query = $sql->prepare("SELECT `id` FROM `voice_server_backup` WHERE `sid`=? AND `uid`=? AND `resellerid`=? ORDER BY `id` ASC LIMIT " . $toomuch); $query->execute(array($id, $user_id, $reseller_id)); while ($row = $query->fetch(PDO::FETCH_ASSOC)) { $delete = $sql->prepare("DELETE FROM `voice_server_backup` WHERE `id`=? AND `uid`=? AND `resellerid`=? LIMIT 1"); $delete->execute(array($row['id'], $user_id, $reseller_id)); tsbackup('delete', $ssh2user, $serverdir, $masterserver, $volocalserverid, $row['id']); } } $connection = new TS3($queryip, $queryport, 'serveradmin', $querypassword); $errorcode = $connection->errorcode; if (strpos($errorcode, 'error id=0') === false) { $template_file = $spracheResponse->error_ts_query_connect . $errorcode; } else { $connection->StartServer($volocalserverid); $rawsnapshot = $connection->Snapshotcreate($volocalserverid); $channelSnapshot = $connection->channelList($volocalserverid); if (is_array($rawsnapshot) and isset($rawsnapshot[0]['msg'])) { $template_file = $spracheResponse->error_ts_query . $rawsnapshot[0]['msg']; } else { if (is_array($rawsnapshot) and !isset($rawsnapshot[0]['msg'])) { $template_file = 'Unknown error'; } else { $snapshot = gzcompress($rawsnapshot, 9); $query = $sql->prepare("INSERT INTO `voice_server_backup` (`sid`,`uid`,`name`,`snapshot`,`channels`,`date`,`resellerid`) VALUES(?,?,?,?,?,NOW(),?)"); $query->execute(array($id, $user_id, $name, $snapshot, $channelSnapshot, $reseller_id)); $return = tsbackup('create', $ssh2user, $serverdir, $masterserver, $volocalserverid, $sql->lastInsertId()); if ($return == 'ok') { $query = $sql->prepare("SELECT CONCAT(`ip`,':',`port`) AS `address` FROM `voice_server` WHERE `id`=? AND `userid`=? AND `resellerid`=? LIMIT 1"); $query->execute(array($id, $user_id, $reseller_id)); $address = $query->fetchColumn();