Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.34 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. system("find /home/rr_user/ -mmin +5 -exec rm -f {} \;");
  24. $filename = '/home/rr_user/'.$serverid.'';
  25. if (file_exists($filename)) {
  26. echo "<p align=center><b>To Prevent File System Corruption we now limit reboots to one per five minutes</b><br /></p>";
  27. $reboot_chk = "1";
  28. echo "reboot $reboot_chk";
  29. }
  30. else
  31. {
  32. $reboot_chk = "0";
  33. echo "reboot $reboot_chk";
  34. }
  35.  
  36.  
  37. if ($_REQUEST["controlaction"] && $reboot_chk == "0") {
  38. $apcport = explode(',',$apcport);
  39. foreach ($apcport as $port) {
  40. $apcport = str_replace(',','',$port);
  41. $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>";
  42. $return=array();
  43. exec($shell_command, $return);
  44. touch($filename, $time);
  45. }
  46. }
  47. {/php}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement