Add DNS compatibility to App/Game master #1255

This commit is contained in:
Nexus633 2020-07-14 23:24:53 +02:00
parent 5c53d612ae
commit 6d97fde6ae
7 changed files with 25 additions and 6 deletions

View File

@ -295,11 +295,20 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
if ($reseller_id == 0) {
$query = $sql->prepare("UPDATE `rserverdata` SET `config_log_time`=:configLogTime,`config_demo_time`=:configDemoTime,`config_ztmp_time`=:configZtmpTime,`config_bad_time`=:configBadTime,`config_user_id`=:configUserID,`config_ionice`=:configIonice,`config_binaries`=:configBinaries,`config_files`=:configFiles,`config_bad_files`=:configBadFiles,`active`=:active,`steamAccount`=AES_ENCRYPT(:steamAccount,:aeskey),`steamPassword`=AES_ENCRYPT(:steamPassword,:aeskey),`hyperthreading`=:hyperthreading,`cores`=:cores,`ip`=:ip,`altips`=:altips,`port`=AES_ENCRYPT(:port,:aeskey),`user`=AES_ENCRYPT(:user, :aeskey),`pass`=AES_ENCRYPT(:pass, :aeskey),`os`=:os,`bitversion`=:bit,`description`=:desc,`ftpport`=:ftpport,`publickey`=:publickey,`keyname`=:keyname,`maxslots`=:maxslots,`maxserver`=:maxserver,`updates`=:updates,`updateMinute`=:updateMinute,`ram`=:ram,`connect_ip_only`=:connect_ip_only,`install_paths`=:install_paths,`quota_active`=:quota_active,`quota_cmd`=:quota_cmd,`repquota_cmd`=:repquota_cmd,`blocksize`=:blocksize,`inode_block_ratio`=:inode_block_ratio,`externalID`=:externalID,`resellerid`=:reseller_id WHERE `id`=:id LIMIT 1");
$query->execute(array(':configLogTime' => $configLogTime, ':configDemoTime' => $configDemoTime, ':configZtmpTime' => $configZtmpTime, ':configBadTime' => $configBadTime, ':configUserID' => $configUserID, ':configIonice' => $configIonice, ':configBinaries' => $configBinaries, ':configFiles' => $configFiles, ':configBadFiles' => $configBadFiles, ':active' => $active, ':steamAccount' => $steamAccount, ':steamPassword' => $steamPassword, ':hyperthreading' => $hyperthreading, ':cores' => $cores, ':ip' => $ip, ':altips' => $altips, ':port' => $port, ':aeskey' => $aeskey, ':user' => $user, ':pass' => $pass, ':os' => $os, ':bit' => $bit, ':desc' => $desc, ':publickey' => $publickey, ':ftpport' => $ftpport, ':keyname' => $keyname, ':maxslots' => $maxslots, ':maxserver' => $maxserver, ':updates' => $updates, ':updateMinute' => $updateMinute, ':ram' => $ram, ':connect_ip_only' => $connectIpOnly, ':install_paths' => $installPaths, ':quota_active' => $quotaActive, ':quota_cmd' => $quotaCmd, ':repquota_cmd' => $repquotaCmd, ':blocksize' => $blocksize, ':inode_block_ratio' => $inodeBlockRatio, ':externalID' => $externalID, ':reseller_id' => $ownerID, ':id' => $id));
$query2 = $sql->prepare("UPDATE `gsswitch` SET `serverip`=:ip WHERE `rootID`=:id");
$query2->execute(array(':ip' => $ip, ':id' => $id));
} else {
$query = $sql->prepare("UPDATE `rserverdata` AS r SET `config_log_time`=:configLogTime,`config_demo_time`=:configDemoTime,`config_ztmp_time`=:configZtmpTime,`config_bad_time`=:configBadTime,`config_user_id`=:configUserID,`config_ionice`=:configIonice,`config_binaries`=:configBinaries,`config_files`=:configFiles,`config_bad_files`=:configBadFiles,`active`=:active,`steamAccount`=AES_ENCRYPT(:steamAccount,:aeskey),`steamPassword`=AES_ENCRYPT(:steamPassword,:aeskey),`hyperthreading`=:hyperthreading,`cores`=:cores,`ip`=:ip,`altips`=:altips,`port`=AES_ENCRYPT(:port,:aeskey),`user`=AES_ENCRYPT(:user, :aeskey),`pass`=AES_ENCRYPT(:pass, :aeskey),`os`=:os,`bitversion`=:bit,`description`=:desc,`ftpport`=:ftpport,`publickey`=:publickey,`keyname`=:keyname,`maxslots`=:maxslots,`maxserver`=:maxserver,`updates`=:updates,`updateMinute`=:updateMinute,`ram`=:ram,`connect_ip_only`=:connect_ip_only,`install_paths`=:install_paths,`quota_active`=:quota_active,`quota_cmd`=:quota_cmd,`repquota_cmd`=:repquota_cmd,`blocksize`=:blocksize,`inode_block_ratio`=:inode_block_ratio,`externalID`=:externalID,`resellerid`=:ownerID WHERE `id`=:id AND (`resellerid`=:reseller_id OR EXISTS (SELECT 1 FROM `userdata` WHERE `resellerid`=:reseller_id AND `id`=r.`resellerid`)) LIMIT 1");
$query->execute(array(':configLogTime' => $configLogTime, ':configDemoTime' => $configDemoTime, ':configZtmpTime' => $configZtmpTime, ':configBadTime' => $configBadTime, ':configUserID' => $configUserID, ':configIonice' => $configIonice, ':configBinaries' => $configBinaries, ':configFiles' => $configFiles, ':configBadFiles' => $configBadFiles, ':active' => $active, ':steamAccount' => $steamAccount, ':steamPassword' => $steamPassword, ':hyperthreading' => $hyperthreading, ':cores' => $cores, ':ip' => $ip, ':altips' => $altips, ':port' => $port, ':aeskey' => $aeskey, ':user' => $user, ':pass' => $pass, ':os' => $os, ':bit' => $bit, ':desc' => $desc, ':publickey' => $publickey, ':ftpport' => $ftpport, ':keyname' => $keyname, ':maxslots' => $maxslots, ':maxserver' => $maxserver, ':updates' => $updates, ':updateMinute' => $updateMinute, ':ram' => $ram, ':connect_ip_only' => $connectIpOnly, ':install_paths' => $installPaths, ':quota_active' => $quotaActive, ':quota_cmd' => $quotaCmd, ':repquota_cmd' => $repquotaCmd, ':blocksize' => $blocksize, ':inode_block_ratio' => $inodeBlockRatio, ':externalID' => $externalID, ':ownerID' => $ownerID, ':id' => $id, ':reseller_id' => $resellerLockupID));
$query2 = $sql->prepare("UPDATE `gsswitch` SET `serverip`=:ip WHERE `rootID`=:id");
$query2->execute(array(':ip' => $ip, ':id' => $id));
}
$rowCount = $query->rowCount();
$loguseraction = '%mod% %root% ' . $ip;
}

View File

@ -71,7 +71,7 @@ while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
$installedRam = (int) $row['installedRam'];
$quotaActive = $row['quota_active'];
if ($row['connect_ip_only'] != 'Y' and isip($row['ip'], 'ip4')) {
if ($row['connect_ip_only'] != 'Y' and isip($row['ip'], 'ip4') or $row['connect_ip_only'] != 'Y' and ishostname($row['ip'])) {
$ips[] = $row['ip'];
}

View File

@ -44,7 +44,7 @@ $defined['rserverdata'] = array(
'cores' => array("Type"=>"smallint(3) unsigned","Null"=>"YES","Key"=>"","Default"=>"4","Extra"=>""),
'hostid' => array("Type"=>"int(10) unsigned","Null"=>"YES","Key"=>"MUL","Default"=>"0","Extra"=>""),
'connect_ip_only' => array("Type"=>"enum('Y','N')","Null"=>"NO","Key"=>"","Default"=>"N","Extra"=>""),
'ip' => array("Type"=>"varchar(15)","Null"=>"NO","Key"=>"","Default"=>"","Extra"=>""),
'ip' => array("Type"=>"varchar(255)","Null"=>"NO","Key"=>"","Default"=>"","Extra"=>""),
'altips' => array("Type"=>"text","Null"=>"YES","Key"=>"","Default"=>"","Extra"=>""),
'port' => array("Type"=>"blob","Null"=>"YES","Key"=>"","Default"=>"","Extra"=>""),
'user' => array("Type"=>"blob","Null"=>"YES","Key"=>"","Default"=>"","Extra"=>""),

View File

@ -251,7 +251,10 @@ class ValidateUserinput {
$check = $this->if_obj_or_str($value, $type, $object);
if ($check and is_string($check) and filter_var($check, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)){
if ($check and is_string($check) and filter_var($check, FILTER_VALIDATE_DOMAIN)){
return $check;
} else if ($check and is_string($check) and filter_var($check, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)){
return $check;
} else if ($check) {
return $this->loop($check, 'ip4', $type);
@ -277,7 +280,10 @@ class ValidateUserinput {
$check = $this->if_obj_or_str($value, $type, $object);
if ($check and is_string($check) and filter_var($check, FILTER_VALIDATE_IP)){
// check if is Hostname
if ($check and is_string($check) and filter_var($check, FILTER_VALIDATE_DOMAIN)){
return $check;
} else if ($check and is_string($check) and filter_var($check, FILTER_VALIDATE_IP)){
return $check;
} else if ($check) {
return $this->loop($check, 'ip', $type);

View File

@ -55,6 +55,10 @@ function isip($value, $ipx) {
return false;
}
function ishostname($value){
return (filter_var($value, FILTER_VALIDATE_DOMAIN) !== false) ? $value : false;
}
function isips($value) {
return (preg_match("/^[\r\n\.\/0-9]+$/", $value) !== false) ? $value : false;
}

View File

@ -73,7 +73,7 @@
<div class="form-group<?php if(isset($errors['ip'])) echo ' has-error';?>">
<label for="inputIP"><?php echo $sprache->haupt_ip;?></label>
<div class="controls"><input class="form-control" id="inputIP" type="text" name="ip" value="<?php echo $ip?>" maxlength="15"></div>
<div class="controls"><input class="form-control" id="inputIP" type="text" name="ip" value="<?php echo $ip?>" ></div>
</div>
<div class="form-group">

View File

@ -85,7 +85,7 @@
<div class="form-group<?php if(isset($errors['ip'])) echo ' has-error';?>">
<label for="inputIP"><?php echo $sprache->haupt_ip;?></label>
<div class="controls"><input class="form-control" id="inputIP" type="text" name="ip" value="<?php echo $ip?>" maxlength="15" required></div>
<div class="controls"><input class="form-control" id="inputIP" type="text" name="ip" value="<?php echo $ip?>" required></div>
</div>
<div class="form-group">