if ($query2->rowCount() == 0) { $query3->execute(array($row['active'], $ex[0] . '.' . $ex[1] . '.' . $ex[2] . '.0', str_replace("option subnet-mask %subnet-mask%;\r\n", '', $row['subnetOptions']), $row['netmask'])); $lastID = $sql->lastInsertId(); for ($lastTriple = 2; $lastTriple < 255; $lastTriple++) { $query4->execute(array($lastID, $ex[0] . '.' . $ex[1] . '.' . $ex[2] . '.' . $lastTriple)); } } } } } } $query = $sql->prepare("SELECT `ips`,`resellerid`,`resellersid` FROM `resellerdata`"); $query2 = $sql->prepare("UPDATE `rootsIP4` SET `ownerID`=?,`resellerID`=? WHERE `ip`=? LIMIT 1"); $query->execute(); while ($row = $query->fetch(PDO::FETCH_ASSOC)) { foreach (ipstoarray($row['ips']) as $usedip) { $query2->execute(array($row['resellerid'], $row['resellersid'], $usedip)); } } $dirSource = EASYWIDIR . '/stuff/'; $dirTarget = EASYWIDIR . '/stuff/custom_modules/'; if (!is_dir($dirTarget)) { @mkdir($dirTarget); } if (is_dir($dirTarget)) { $query = $sql->prepare("SELECT `file` FROM `modules`"); $query->execute(); while ($row = $query->fetch(PDO::FETCH_ASSOC)) { if (is_file($dirSource . $row['file'])) { rename($dirSource . $row['file'], $dirTarget . $row['file']); }
} set_time_limit($timelimit); define('EASYWIDIR', dirname(__FILE__)); include EASYWIDIR . '/stuff/methods/vorlage.php'; include EASYWIDIR . '/stuff/methods/class_validator.php'; include EASYWIDIR . '/stuff/methods/functions.php'; include EASYWIDIR . '/stuff/settings.php'; include EASYWIDIR . '/stuff/methods/functions_gs.php'; include EASYWIDIR . '/stuff/methods/functions_ssh_exec.php'; include EASYWIDIR . '/stuff/methods/class_app.php'; include EASYWIDIR . '/stuff/methods/class_masterserver.php'; include EASYWIDIR . '/stuff/methods/functions_ts3.php'; include EASYWIDIR . '/stuff/methods/class_ts3.php'; include EASYWIDIR . '/stuff/methods/queries_updates.php'; include EASYWIDIR . '/stuff/keyphrasefile.php'; if (!isset($ip) or $ui->escaped('SERVER_ADDR', 'server') == $ip or in_array($ip, ipstoarray($rSA['cronjob_ips']))) { echo "Reboot and Updater started\r\n"; if (version_compare(PHP_VERSION, '5.3.0') >= 0) { $currentTime = new DateTime(date('Y-m-d H:i:s')); } else { $currentDay = date('j'); $currentDays = date('t'); $currentHour = date('G'); } $now = date('Y-m-d', strtotime('now')); $sprache = getlanguagefile('gserver', 'uk', 0); echo "Fetch version for Teamspeak 3 Server\r\n"; $query = $sql->prepare("UPDATE `voice_masterserver` SET `latest_version`=? WHERE `bitversion`=?"); $ts3MasterVersion32 = getTS3Version('server', 'linux', 32); if (isset($ts3MasterVersion32['version']) and preg_match('/^([\\d]{1,2}.)*[\\d]{1,2}$/', $ts3MasterVersion32['version'])) { $query->execute(array($ts3MasterVersion32['version'], '32'));
function freeips($value) { global $sql; $userips = array(); if ($value == 0) { $query = $sql->prepare("SELECT `ip` FROM `rootsIP4` WHERE `resellerID`=0"); $query->execute(); while ($row = $query->fetch(PDO::FETCH_ASSOC)) { $userips[] = $row['ip']; } $query = $sql->prepare("SELECT `ip`,`ips` FROM `virtualcontainer`"); $query->execute(); while ($row = $query->fetch(PDO::FETCH_ASSOC)) { $key = array_search($row['ip'], $userips); if (false !== $key) { unset($userips[$key]); } foreach (ipstoarray($row['ips']) as $usedip) { $key = array_search($usedip, $userips); if (false !== $key) { unset($userips[$key]); } } } $query = $sql->prepare("SELECT `ip`,`ips` FROM `rootsDedicated`"); $query->execute(); while ($row = $query->fetch(PDO::FETCH_ASSOC)) { $key = array_search($row['ip'], $userips); if (false !== $key) { unset($userips[$key]); } foreach (ipstoarray($row['ips']) as $usedip) { $key = array_search($usedip, $userips); if (false !== $key) { unset($userips[$key]); } } } } else { $query = $sql->prepare("SELECT `resellerid` FROM `userdata` WHERE `id`=? LIMIT 1"); $query->execute(array($value)); $resellerid = $query->fetchColumn(); $query = $sql->prepare("SELECT `ip` FROM `rootsIP4` WHERE `resellerID`=?"); $query->execute(array($resellerid)); while ($row = $query->fetch(PDO::FETCH_ASSOC)) { $userips[] = $row['ip']; } $query = $sql->prepare("SELECT `ip`,`ips` FROM `virtualcontainer` WHERE `resellerid`=?"); $query->execute(array($resellerid)); while ($row = $query->fetch(PDO::FETCH_ASSOC)) { $key = array_search($row['ip'], $userips); if (false !== $key) { unset($userips[$key]); } foreach (ipstoarray($row['ips']) as $usedip) { $key = array_search($usedip, $userips); if (false !== $key) { unset($userips[$key]); } } } $query = $sql->prepare("SELECT `ip`,`ips` FROM `rootsDedicated` WHERE `resellerid`=?"); $query->execute(array($resellerid)); while ($row = $query->fetch(PDO::FETCH_ASSOC)) { $key = array_search($row['ip'], $userips); if (false !== $key) { unset($userips[$key]); } foreach (ipstoarray($row['ips']) as $usedip) { $key = array_search($usedip, $userips); if (false !== $key) { unset($userips[$key]); } } } $query = $sql->prepare("SELECT `id` FROM `userdata` WHERE accounttype='r' AND `resellerid`=:id AND `id`!=:id"); $query2 = $sql->prepare("SELECT `ip` FROM `rootsIP4` WHERE `resellerID`=? AND `ownerID`!=`resellerID`"); $query->execute(array(':id' => $resellerid)); while ($row = $query->fetch(PDO::FETCH_ASSOC)) { $query2->execute(array($row['id'])); while ($row2 = $query2->fetch(PDO::FETCH_ASSOC)) { $key = array_search($row2['ip'], $userips); if (false !== $key) { unset($userips[$key]); } } } } $userips = array_unique($userips); natsort($userips); return $userips; }
$pselect = $sql->prepare("SELECT `ips` FROM `resellerdata`"); $pselect->execute(); } else { if ($reseller_id == $admin_id) { $pselect = $sql->prepare("SELECT `ips` FROM `resellerdata` WHERE `resellersid`=:reseller_id"); $pselect->execute(array(':reseller_id' => $reseller_id)); } else { $pselect = $sql->prepare("SELECT `ips` FROM `resellerdata` WHERE `resellerid`=:admin_id AND c.`resellersid`=:reseller_id"); $pselect->execute(array(':admin_id' => $admin_id, ':reseller_id' => $reseller_id)); } } $ips = array(); $user_ips = array(); foreach ($pselect->fetchAll(PDO::FETCH_ASSOC) as $row) { unset($user_ips); $user_ips = ipstoarray($row['ips']); foreach ($user_ips as $userip) { $userips[] = $userip; } } $ips = array_unique($userips); natsort($ips); foreach ($ips as $ip) { if ($ui->post['what'] == $ip) { $data[] = '<option selected="selected">' . $ip . '</option>'; } else { $data[] = '<option>' . $ip . '</option>'; } } } }
$command = $gsprache->del . ' ' . $type . ' server: ' . $row['affectedID'] . ' name:' . $row['name']; $removeIDs[$row['type']][] = $row['affectedID']; $ips = array(); if ($type == 'dedicated') { $query5->execute(array($row['affectedID'])); foreach ($query5->fetchAll(PDO::FETCH_ASSOC) as $row2) { $ips[] = $row2['ip']; foreach (ipstoarray($row2['ips']) as $ip) { $ips[] = $ip; } } } else { $query6->execute(array($row['affectedID'])); foreach ($query6->fetchAll(PDO::FETCH_ASSOC) as $row2) { $ips[] = $row2['ip']; foreach (ipstoarray($row2['ips']) as $ip) { $ips[] = $ip; } } } foreach ($ips as $ip) { $query7->execute(array($ip)); } } else { $query4->execute(array($row['jobID'])); $command = 'Error: ' . $gsprache->del . ' ' . $type . ' server: ' . $row['affectedID'] . ' name:' . $row['name'] . ' ' . $return; } } else { if ($row['action'] == 'ad') { $query2->execute(array($row['jobID'])); $command = $gsprache->add . ' ' . $type . ' server: ' . $row['affectedID'] . ' name:' . $row['name'];
$usedusercpu = $row['usedcpu'] - $oldminmhz * $oldcores + $minmhz * $cores; } else { $useduserram = 0 - $oldminram + $minram; $usedusercpu = 0 - $oldminmhz * $oldcores + $minmhz * $cores; } } if ($useduserram >= $maxuserram or $usedusercpu >= $maxusermhz) { $fail = 1; $template_file .= "Reseller Limits"; } } if (isip($ui->post['ip'], 'all') and isset($oldip)) { $freeips = $reseller_id == 0 ? freeips($reseller_id) : freeips($userid); $checked_ips = array(); if (isips($ui->post['ips'])) { $postedips = ipstoarray($ui->post['ips']); if (is_array($postedips)) { foreach ($postedips as $postedip) { if (in_array($postedip, $freeips)) { $checked_ips[] = $postedip; } } } foreach ($checked_ips as $checked_ip) { if (isset($ips)) { $ips .= "\r\n" . $checked_ip; } else { $ips = $checked_ip; } } }
public function ModDB($dbname, $password, $ips, $max_queries_per_hour, $max_connections_per_hour, $max_updates_per_hour, $max_userconnections_per_hour) { if ($this->error != 'ok') { return $this->error; } try { $query = $this->remotesql->prepare("SET PASSWORD FOR ?@'' = PASSWORD(?)"); $query->execute(array($dbname, $password)); $this->remotesql->exec("GRANT USAGE ON * . * TO '{$dbname}'@'' WITH MAX_QUERIES_PER_HOUR " . $max_queries_per_hour . " MAX_CONNECTIONS_PER_HOUR " . $max_connections_per_hour . " MAX_UPDATES_PER_HOUR " . $max_updates_per_hour . " MAX_USER_CONNECTIONS " . $max_userconnections_per_hour); $query = $this->remotesql->prepare("GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,REFERENCES,INDEX,ALTER,CREATE TEMPORARY TABLES,LOCK TABLES,CREATE VIEW,SHOW VIEW,CREATE ROUTINE,ALTER ROUTINE,EXECUTE ON `" . $dbname . "`.* TO ?@''"); $query->execute(array($dbname)); $iparray = ipstoarray($ips); $allowedips = array(); $query = $this->remotesql->prepare("SELECT `host` FROM `mysql`.`host` WHERE `db`=?"); $query->execute(array($dbname)); while ($row = $query->fetch(PDO::FETCH_ASSOC)) { $allowedips[] = $row['host']; } $query = $this->remotesql->prepare("INSERT INTO `mysql`.`host` (`host`,`db`,`Select_priv`,`Insert_priv`,`Update_priv`,`Delete_priv`,`Create_priv`,`Drop_priv`,`Alter_priv`) VALUES (?,?,'Y','Y','Y','Y','Y','Y','Y')"); foreach ($iparray as $ip) { if (!in_array($ip, $allowedips)) { $query->execute(array($ip, $dbname)); } } $query = $this->remotesql->prepare("DELETE FROM `mysql`.`host` WHERE `host`=? AND `db`=? LIMIT 1"); foreach ($allowedips as $ip) { if (!in_array($ip, $iparray)) { $query->execute(array($ip, $dbname)); } } $this->remotesql->exec("FLUSH PRIVILEGES; FLUSH HOSTS;"); } catch (PDOException $error) { return $error->getMessage(); } return 'ok'; }
} return isset($serverid) ? $serverid : false; } $query = $sql->prepare("SELECT `ips`,`resellerid`,`resellersid` FROM `resellerdata`"); $query->execute(); while ($row = $query->fetch(PDO::FETCH_ASSOC)) { $ids = $row['resellerid'] . '-' . $row['resellersid']; $userips[$ids] = ipstoarray($row['ips']); } $query = $sql->prepare("SELECT `id`,`ip`,`ips` FROM `virtualcontainer`"); $query->execute(); while ($row = $query->fetch(PDO::FETCH_ASSOC)) { unset($vserverip); $vserverip[] = $row['ip']; $vserverid = $row['id']; foreach (ipstoarray($row['ips']) as $vip) { $vserverip[] = $vip; } $vserverips[$vserverid] = $vserverip; } $query = $sql2->prepare("SHOW PROCESSLIST"); $query->execute(); print "Killing active locks and threads regarding database {$stats_db}\r\n"; while ($row = $query->fetch(PDO::FETCH_ASSOC)) { list($host) = explode(':', $row['Host']); if ($host == 'localhost' and $row['db'] == $stats_db) { $query2 = $sql2->prepare("KILL ?"); $query2->execute(array($row['Id'])); } } $pass = 1;