Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 KB | None | 0 0
  1. {php}
  2. $customfields = $this->_tpl_vars["customfields"];
  3. foreach ($customfields AS $customfield) {
  4. if ($customfield["name"]=="APCIP") { $apcip = $customfield["value"]; }
  5. if ($customfield["name"]=="APCPort") { $apcport = $customfield["value"]; }
  6. if ($customfield["name"]=="GraphID") { $graphid = $customfield["value"]; }
  7. if ($customfield["name"]=="Username") { $username = $customfield["value"]; }
  8. if ($customfield["name"]=="Password") { $password = $customfield["value"]; }
  9. if ($customfield["name"]=="Server ID(s)") { $serverid = $customfield["value"]; }
  10. if ($customfield["name"]=="RDP / SSH Port") { $rdpssh = $customfield["value"]; }
  11. if ($customfield["name"]=="Server IP(s)") { $serverip = $customfield["value"]; }
  12. if ($customfield["name"]=="Hostname") { $hostname = $customfield["value"]; }
  13. if ($customfield["name"]=="Monitor Name") { $mon_name = $customfield["value"]; }
  14. if ($customfield["name"]=="Monitor Host") { $mon_host = $customfield["value"]; }
  15. if ($customfield["name"]=="Monitor Type") { $mon_port = $customfield["value"]; }
  16. if ($customfield["name"]=="Server Port(s)") { $switch_port = $customfield["value"]; }
  17. if ($customfield["name"]=="Monitor") { $monitorenable = $customfield["value"]; }
  18. if ($customfield["name"]=="Email for Alerts") { $mon_email = $customfield["value"]; }
  19. if ($customfield["name"]=="Mobile for Alerts") { $mon_mob = $customfield["value"]; }
  20. if ($customfield["name"]=="vserverid") { $vserverid = $customfield["value"]; }
  21. }
  22.  
  23. $filename = '/home/rr_user/'.$serverid.'';
  24.  
  25. if (file_exists($filename)) {
  26. if (file_exists($filename)) {
  27. system("find /home/rr_user/ -mmin +5 -exec rm -f {} \;");
  28. echo "<p align=center><b>To Prevent File System Corruption we now limit reboots to one per five minutes</b><br /></p>";
  29. $reboot_chk = "1";
  30. echo "Reboot Lock: $reboot_chk";
  31. $_REQUEST["controlaction"] = "tryno";
  32. }
  33. else if ($_REQUEST["controlaction"] && $reboot_chk =="") {
  34. $apcport = explode(',',$apcport);
  35. foreach ($apcport as $port) {
  36. $apcport = str_replace(',','',$port);
  37. $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!</b><br /></p>";
  38. $return=array();
  39. if ($reboot_chk =="") {exec($shell_command, $return);}
  40. $time = time() - 3600;
  41. touch($filename, $time);
  42. }
  43. }
  44. {/php}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement