Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {php}
- $customfields = $this->_tpl_vars["customfields"];
- foreach ($customfields AS $customfield) {
- if ($customfield["name"]=="APCIP") { $apcip = $customfield["value"]; }
- if ($customfield["name"]=="APCPort") { $apcport = $customfield["value"]; }
- if ($customfield["name"]=="GraphID") { $graphid = $customfield["value"]; }
- if ($customfield["name"]=="Username") { $username = $customfield["value"]; }
- if ($customfield["name"]=="Password") { $password = $customfield["value"]; }
- if ($customfield["name"]=="Server ID(s)") { $serverid = $customfield["value"]; }
- if ($customfield["name"]=="RDP / SSH Port") { $rdpssh = $customfield["value"]; }
- if ($customfield["name"]=="Server IP(s)") { $serverip = $customfield["value"]; }
- if ($customfield["name"]=="Hostname") { $hostname = $customfield["value"]; }
- if ($customfield["name"]=="Monitor Name") { $mon_name = $customfield["value"]; }
- if ($customfield["name"]=="Monitor Host") { $mon_host = $customfield["value"]; }
- if ($customfield["name"]=="Monitor Type") { $mon_port = $customfield["value"]; }
- if ($customfield["name"]=="Server Port(s)") { $switch_port = $customfield["value"]; }
- if ($customfield["name"]=="Monitor") { $monitorenable = $customfield["value"]; }
- if ($customfield["name"]=="Email for Alerts") { $mon_email = $customfield["value"]; }
- if ($customfield["name"]=="Mobile for Alerts") { $mon_mob = $customfield["value"]; }
- if ($customfield["name"]=="vserverid") { $vserverid = $customfield["value"]; }
- }
- $filename = '/home/rr_user/'.$serverid.'';
- system("find /home/rr_user/ -mmin +5 -exec rm -f {} \;");
- if (file_exists($filename)) {
- echo "<p align=center><b>To Prevent File System Corruption we now limit reboots to one per five minutes</b><br /></p>";
- $reboot_chk = "1";
- echo "reboot $reboot_chk";
- }
- else if ($reboot_chk !=="1" && $_REQUEST["controlaction"]) {
- $apcport = explode(',',$apcport);
- foreach ($apcport as $port) {
- $apcport = str_replace(',','',$port);
- $shell_command = "snmpset -v 1 -c WHMCS_Reboot000 $apcip 1.3.6.1.4.1.318.1.1.4.4.2.1.3.$apcport i ".$_REQUEST["controlaction"]; echo "<p align=center><b>Your power command has now been processed! Test Test</b><br /></p>";
- $return=array();
- exec($shell_command, $return);
- $time = time() - 3600;
- touch($filename, $time);
- }
- }
- {/php}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement