<?php //session if (!isset($_SESSION['username'])) { header('Location: /404.html'); exit; } if ($_GET['server']) { $host_name = $_GET['server']; $myDC = $SFTP_DATA[$host_name]['DC']; $sftp_ipaddr = $SFTP_DATA[$host_name]['SFTP_HOST']; // get sftp data $sftp_Data = SoapFunction($sftp_ipaddr, $soap_login, $soap_password, "User"); if ($sftp_Data == "SOAP_ERROR") { echo "<div class='alert alert-danger'>"; echo "<button data-dismiss='alert' class='close'>×</button>"; echo "<i class='fa fa-times-circle'></i>"; echo "<strong> SOAP ERROR!</strong> Please check Connectivity to SOAP Service or Code!"; echo "</div>"; exit; } } //if-loop ?> <div class="row"> <div class="col-md-1"><h5>Select DC:<h5></div> <div class="col-sm-2"> <form action="" method="get" id='get_rules'> <select name='server' class="form-control" > <?php
<?php //session if (!isset($_SESSION['username'])) { header('Location: /404.html'); exit; } if ($_GET['server']) { $host_name = $_GET['server']; $myDC = $SFTP_DATA[$host_name]['DC']; $sftp_ipaddr = $SFTP_DATA[$host_name]['SFTP_HOST']; // get iptables rule $rule_list = SoapFunction($sftp_ipaddr, $soap_login, $soap_password, "IPTables"); if ($rule_list == "SOAP_ERROR") { echo "<div class='alert alert-danger'>"; echo "<button data-dismiss='alert' class='close'>×</button>"; echo "<i class='fa fa-times-circle'></i>"; echo "<strong> SOAP ERROR!</strong> Please check Connectivity to SOAP Service or Code!"; echo "</div>"; exit; } } ?> <div class="row"> <form action="" method="get" id='get_rules'> <input type='hidden' name='type' value='firewall'> <div class="col-md-1"><h5> Select DC:<h5></div> <div class="col-sm-2"> <select name='server' class="form-control" > <?php //foreach ($DATACENTER as $key => $arr_ref) {
if ($_GET['server']) { $host_name = $_GET['server']; $myDC = $SFTP_DATA[$host_name]['DC']; $sftp_ipaddr = $SFTP_DATA[$host_name]['SFTP_HOST']; // get sftp logs $logs_secure = SoapFunction($sftp_ipaddr, $soap_login, $soap_password, "Logs-Secure"); if ($logs_secure == "SOAP_ERROR") { echo "<div class='alert alert-danger'>"; echo "<button data-dismiss='alert' class='close'>×</button>"; echo "<i class='fa fa-times-circle'></i>"; echo "<strong> SOAP ERROR!</strong> Please check Connectivity to SOAP Service or Code!"; echo "</div>"; exit; } ///// $logs_messages = SoapFunction($sftp_ipaddr, $soap_login, $soap_password, "Logs-Messages"); if ($logs_messages == "SOAP_ERROR") { echo "<div class='alert alert-danger'>"; echo "<button data-dismiss='alert' class='close'>×</button>"; echo "<i class='fa fa-times-circle'></i>"; echo "<strong> SOAP ERROR!</strong> Please check Connectivity to SOAP Service or Code!"; echo "</div>"; exit; } } ?> <div class="row"> <form action="sftp.php" method="get" id='logs'> <div class="col-md-1"><h5> Select DC:<h5></div> <div class="col-sm-2"> <select name='server' class="form-control" >
foreach ($sftp_Data as $data) { list($user, $user_desc, $homedir, $shell, $sshkey_count, $sftp_home) = explode(":", $data); if ($user_desc != NULL) { echo "<option value=" . $user . ">" . $user . " (" . $user_desc . ")</option>"; } else { echo "<option value=" . $user . ">" . $user . "</option>"; } } echo "</select>"; } elseif ($_GET['type'] == "ssh_keys") { // get ssh key for user using ajax //login details $soap_login = "******"; $soap_password = "******"; $host_name = $_GET['sftp_server']; $myDC = $SFTP_DATA[$host_name]['DC']; $sftp_ipaddr = $SFTP_DATA[$host_name]['SFTP_HOST']; //get sshkeys $Ssh_key = SoapFunction($sftp_ipaddr, $soap_login, $soap_password, "SSH_Keys", $_GET['user'], "--catfile", "key"); if ($Ssh_key == "SOAP_ERROR") { echo "<span id='datacenter'><strong> SOAP ERROR!</strong> Please check Connectivity to SOAP Service or Code! </span>"; exit; } $KeyFilePath = $Ssh_key[0]; unset($Ssh_key[0]); $RSAKey = implode("\n", $Ssh_key); //echo "<div id='KEY_TEXT' style='display: block' class='col-sm-20'>"; echo "<span><b>RSA " . $KeyFilePath . "</b></span>"; echo "<textarea name='rsakey' class='form-control' id='form-field-6' style='width: 900px; height: 250px;'>" . $RSAKey . "</textarea>"; //echo "</div>"; }
print "<br>Test:" . $Key; if (trim($Key) == "Result" && trim($Value) == "SUCCESS") { $STATUS = "SUCCESS"; } else { $STATUS = "FAIL"; } } else { $STATUS = "FAIL"; } } if ($_POST['submit'] == 'update_user') { //update_user $host_name = $_POST['datacenter']; $sftp_ipaddr = $SFTP_DATA[$host_name]['SFTP_HOST']; if ($_POST['username']) { $Result = SoapFunction($sftp_ipaddr, $soap_login, $soap_password, "Account", $_POST['username'], "--edit", $_POST['password'], $_POST['customer'], $_POST['shell']); list($Key, $Value) = explode('=', $Result[0]); if (trim($Key) == "Result" && trim($Value) == "SUCCESS") { $STATUS = "SUCCESS"; } else { $STATUS = "FAIL"; } } else { $STATUS = "FAIL"; } } } ?> <!-- ---------------------------------------------------------------------------- --> <!-- start: CSS REQUIRED FOR THIS PAGE ONLY -->