Пример #1
0
    $response->add('Action: insert_easywi_version done: ');
    $error = $insert_easywi_version->errorinfo();
    $insert_easywi_version->closecursor();
    if (isset($error[2]) and $error[2] != '' and $error[2] != null and !isinteger($error[2])) {
        $response->add($error[2] . '<br />');
    } else {
        $response->add('OK<br />');
    }
    $alter_gsswitch = $sql->prepare("ALTER TABLE `gsswitch` ADD COLUMN `newlayout` ENUM('Y','N') DEFAULT 'Y' AFTER `secnotified`");
    $alter_gsswitch->execute();
    $response->add('Action: alter_gsswitch done: ');
    $error = $alter_gsswitch->errorinfo();
    $alter_gsswitch->closecursor();
    if (isset($error[2]) and $error[2] != '' and $error[2] != null and !isinteger($error[2])) {
        $response->add($error[2] . '<br />');
    } else {
        $response->add('OK<br />');
    }
    $update_gsswitch = $sql->prepare("UPDATE `gsswitch` SET `newlayout`='N'");
    $update_gsswitch->execute();
    $response->add('Action: update_gsswitch done: ');
    $error = $update_gsswitch->errorinfo();
    $update_gsswitch->closecursor();
    if (isset($error[2]) and $error[2] != '' and $error[2] != null and !isinteger($error[2])) {
        $response->add($error[2] . '<br />');
    } else {
        $response->add('OK<br />');
    }
} else {
    echo "Error: this file needs to be included by the updater!<br />";
}
Пример #2
0
 if (!isset($ui->post['table_name']) or !gamestring($ui->post['table_name'])) {
     $error = 1;
 }
 if (!isset($ui->post['column_sourceip']) or !gamestring($ui->post['column_sourceip'])) {
     $error = 1;
 }
 if (!isset($ui->post['column_destip']) or !gamestring($ui->post['column_destip'])) {
     $error = 1;
 }
 if (!isset($ui->post['column_byte']) or !gamestring($ui->post['column_byte'])) {
     $error = 1;
 }
 if (!isset($ui->post['column_date']) or !gamestring($ui->post['column_date'])) {
     $error = 1;
 }
 if (!isset($ui->post['multiplier']) or !isinteger($ui->post['multiplier'])) {
     $error = 1;
 }
 if (!isset($ui->post['text_colour_1']) or !validate_int($ui->post['text_colour_1'], 0, 255) and $ui->post['text_colour_1'] != 0) {
     $error = 1;
 }
 if (!isset($ui->post['text_colour_2']) or !validate_int($ui->post['text_colour_2'], 0, 255) and $ui->post['text_colour_2'] != 0) {
     $error = 1;
 }
 if (!isset($ui->post['text_colour_3']) or !validate_int($ui->post['text_colour_3'], 0, 255) and $ui->post['text_colour_3'] != 0) {
     $error = 1;
 }
 if (!isset($ui->post['barin_colour_1']) or !validate_int($ui->post['barin_colour_1'], 0, 255) and $ui->post['barin_colour_1'] != 0) {
     $error = 1;
 }
 if (!isset($ui->post['barin_colour_2']) or !validate_int($ui->post['barin_colour_2'], 0, 255) and $ui->post['barin_colour_2'] != 0) {
Пример #3
0
function versioncheck($current, $new, $file, $response)
{
    global $sql;
    $include = true;
    if ($current < $new) {
        $response->add("Upgrading Database from {$current} to {$new}<br />");
        if (is_file(EASYWIDIR . '/' . $file)) {
            $response->add('Found updaterfile ' . $file . '. Executing it now<br>');
            include EASYWIDIR . '/' . $file;
        } else {
            if (is_file(EASYWIDIR . '/install/' . $file)) {
                $response->add('Found updaterfile ' . EASYWIDIR . 'install/' . $file . '. Executing it now<br>');
                include EASYWIDIR . '/install/' . $file;
            } else {
                die("File {$file} is missing<br />");
            }
        }
        if ($new < '2.08' and isset($sql)) {
            $update_easywiversion = $sql->prepare("UPDATE `easywi_version` SET `version`=?");
            $update_easywiversion->execute(array($new));
            $response->add('<br />Action: update_easywiversion done: ');
            $error = $update_easywiversion->errorinfo();
            $update_easywiversion->closecursor();
            if (isset($error[2]) and $error[2] != '' and $error[2] != null and !isinteger($error[2])) {
                $response->add($error[2] . '<br />');
            } else {
                $response->add('OK<br />');
            }
        }
        return true;
    } else {
        return false;
    }
}
Пример #4
0
     $query2->execute(array($row['serverid'], $reseller_id));
     $switchID = $query2->fetchColumn();
     if (isid($switchID, 10)) {
         $query3->execute(array($switchID, $reseller_id));
         while ($row3 = $query3->fetch(PDO::FETCH_ASSOC)) {
             $shorten = $row3['shorten'];
             $shortens[] = $shorten;
             $serverids[$shorten][] = $row3['id'];
             $gsused[$shorten]++;
         }
         $shortenlist = implode('|', $shortens);
         foreach ($shortens as $shorten) {
             $switchcount[$shortenlist][$shorten]['used']++;
             foreach ($serverids[$shorten] as $id) {
                 $key = array_search($id, $switchcount[$shortenlist][$shorten]['freeids']);
                 if ($key == 0 or isinteger($key)) {
                     unset($switchcount[$shortenlist][$shorten]['freeids'][$key]);
                 }
             }
         }
     }
 }
 $status = array();
 $serveravailable = false;
 $gameselect = array();
 foreach ($gscounts as $key => $value) {
     $query = $sql->prepare("SELECT `description` FROM `servertypes` WHERE `shorten`=? AND `resellerid`=? LIMIT 1");
     $query->execute(array($key, $reseller_id));
     $description = $query->fetchColumn();
     $amount = $value - $gsused[$key];
     $switchcount[$shortenlist][$shorten];
 }
 if (!isid($ui->post['hddsize'], 4)) {
     $fail = 1;
     $template_file .= "HDDsize";
 }
 if (!isinteger($ui->post['ram'])) {
     $fail = 1;
     $template_file .= "Ram";
 }
 if (!isinteger($ui->post['minram'])) {
     $fail = 1;
     $template_file .= "MinRam";
 } else {
     $minram = $ui->post['minram'];
 }
 if (!isinteger($ui->post['maxram'])) {
     $fail = 1;
     $template_file .= "MaxRam";
 }
 if (!ismac($ui->post['mac'])) {
     $fail = 1;
     $template_file .= "MAC";
 }
 if (!active_check($ui->post['active'])) {
     $fail = 1;
     $template_file .= "Active";
 }
 if ($reseller_id == 0) {
     $query = $sql->prepare("SELECT * FROM `virtualcontainer` WHERE `id`=? LIMIT 1");
     $query->execute(array($id));
 } else {
Пример #6
0
     print "Invalid secondary weapon's skill...";
     $do = false;
 }
 if ($do == true and ($i2hskill <= 0 or !isinteger($i2hskill))) {
     print "Invalid 2H skill...";
     $do = false;
 }
 if ($do == true and ($ih1proc < 0 or !isinteger($ih1proc))) {
     print "Invalid primary weapon proc...";
     $do = false;
 }
 if ($do == true and ($ih2proc < 0 or !isinteger($ih2proc))) {
     print "Invalid secondary weapon proc...";
     $do = false;
 }
 if ($do == true and ($i2hproc < 0 or !isinteger($i2hproc))) {
     print "Invalid 2H weapon proc...";
     $do = false;
 }
 //if (($do==true) and (($imoblevel<=0) or (!isinteger($imoblevel)))) { print "Invalid mob level..."; $do=false; }
 if ($do == false) {
     include "../includes/footers.php";
     exit;
 }
 // weapon real damages
 $w1dam = $ih1dam;
 $w2dam = $ih2dam;
 $w2hdam = $i2hdam;
 if ($iclass == 32768) {
     // berserker
     $bonus = 3 + $ilevel / 10;
Пример #7
0
 public function SendCommand($value)
 {
     if ($this->connected == true and is_resource($this->socket)) {
         $return = array();
         $response = '';
         if (is_array($value)) {
             fputs($this->socket, $value[0] . "\n");
         } else {
             fputs($this->socket, $value . "\n");
         }
         stream_set_blocking($this->socket, true);
         stream_set_timeout($this->socket, $this->maxExecutionTime);
         $metaData = stream_get_meta_data($this->socket);
         while (strpos($response, 'msg=') === false or strpos($response, 'error id=') === false) {
             if ($metaData['unread_bytes'] < 1) {
                 break;
             }
             $new = fgets($this->socket);
             $response .= $new;
             $metaData = stream_get_meta_data($this->socket);
         }
         if ($this->debug == true) {
             print "Raw query return: {$response}\r\n";
         }
         @(list($databody, $errorcode) = explode('error id=', str_replace(array("\r", "\n"), '', $response)));
         if ($errorcode) {
             $this->errorcode = 'error id=' . $errorcode;
         }
         if ($databody == '' or $databody == null) {
             $databody = $this->errorcode;
         }
         if (!is_array($value) or isset($value[1]) and $value[1] == 'array') {
             foreach (explode('|', $databody) as $data) {
                 $cvars = array();
                 foreach (explode(' ', $data) as $singleline) {
                     $splitted = preg_split('/=(?!$)/', $singleline, -1, PREG_SPLIT_NO_EMPTY);
                     $count = count($splitted);
                     if ($count > 2) {
                         $i = 1;
                         $buffered = '';
                         while ($i < $count) {
                             $buffered .= $splitted[$i];
                             $i++;
                         }
                         $splitted[1] = $buffered;
                     }
                     if (!isset($splitted[1])) {
                         $splitted[1] = '';
                     }
                     $index = trim(preg_replace('/\\s+/', '', $splitted[0]));
                     if ($index != 'error') {
                         $cvars[$index] = isinteger(trim($splitted[1])) ? (int) trim($splitted[1]) : trim($splitted[1]);
                     }
                 }
                 $return[] = $cvars;
             }
         } else {
             $return = $databody;
         }
         return $return;
     } else {
         return "error: not connected";
     }
 }
Пример #8
0
 $active = $ui->post['active'];
 $reseller = $ui->post['reseller'];
 $ip = $ui->post['ip'];
 $thin = $ui->post['thin'];
 $thinquota = isid($ui->post['thinquota'], "2");
 $maxserver = isid($ui->post['maxserver'], "3");
 $port = $ui->post['port'];
 $user = $ui->post['user'];
 $esxi = $ui->post['esxi'];
 $pass = password_check($ui->post['pass'], 255);
 $os = "linux";
 $description = $ui->description('description', 'post');
 $cores = isid($ui->post['cores'], "5");
 $cpu = $ui->description('cpu', 'post');
 $mhz = isid($ui->post['mhz'], "5");
 $ram = isinteger($ui->post['ram']);
 $pinsert = $sql->prepare("INSERT INTO `virtualhosts` (`active`,`esxi`,`ip`,`port`,`user`,`pass`,`os`,`description`,`publickey`,`keyname`,`cpu`,`cores`,`mhz`,`ram`,`maxserver`,`thin`,`thinquota`,`resellerid`) VALUES (:active, :esxi, :ip, AES_ENCRYPT(:port, :aeskey),AES_ENCRYPT(:user, :aeskey),AES_ENCRYPT(:pass, :aeskey),:os, :description, :publickey, :keyname, :cpu, :cores, :mhz, :ram, :maxserver, :thin, :thinquota, :reseller)");
 $pinsert->execute(array(':active' => $active, ':esxi' => $esxi, ':ip' => $ip, ':port' => $port, ':aeskey' => $aeskey, ':user' => $user, ':pass' => $pass, ':os' => $os, ':description' => $description, ':publickey' => $publickey, ':keyname' => $keyname, ':cpu' => $cpu, ':cores' => $cores, ':mhz' => $mhz, ':ram' => $ram, ':maxserver' => $maxserver, ':thin' => $thin, ':thinquota' => $thinquota, ':reseller' => $reseller));
 $serverid = $sql->lastInsertId();
 include EASYWIDIR . '/stuff/methods/functions_ssh_exec.php';
 $uidb = ssh2_execute('vh', $serverid, 'cd /vmfs/volumes; S=""; for U in `ls -la | grep "drwxr-xr-t" | awk \'{print $9}\'`; do C=`vmkfstools -Ph $U 2> /dev/null | grep "Capacity" | awk \'{print $2$3}\'`; S="$S$U:$C;"; done; for U in `ls -la | grep "drwxrwxrwx" | awk \'{print $9}\'`; do C=`vmkfstools -Ph $U 2> /dev/null | grep "Capacity" | awk \'{print $2$3}\'`; S="$S$U:$C;"; done; echo $S');
 if ($uidb != '' and $uidb !== false) {
     $uiddata = explode(";", $uidb);
     $i = 0;
     $count = count($uiddata) - 1;
     while ($i < $count) {
         list($uid, $space) = explode(":", $uiddata[$i]);
         if (strpos(strtolower($space), strtolower('TB')) === false) {
             $hddamount = str_replace('GB,', '', $space);
         } else {
             $hddamount = str_replace('TB,', '', $space) * 1000;