Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $ip='109.230.234.170';
- $port=8080;
- $admin_pass='';
- $bcast_pass='';
- $ssh_username='shoutcast';
- $ssh_password='';
- $web_port=801;
- $ssh_port=22;
- if(!isset($ip,$port,$admin_pass,$bcast_pass,$web_port,$ssh_port)) die("missing one or more required variables to execute.");
- function executeCheck($ip,$port,$web=false,$resp1=false)
- {
- if(!$web)
- {
- $f=@fsockopen($ip,$port,$errno,$errstr,1);
- if(!$f) return false;
- elseif($f) return true;
- else return false;
- }
- elseif($web)
- {
- $g=@file_get_contents($web);
- if($g)
- {
- return $g;
- }
- else
- {
- if($resp1) return $resp1;
- else return true;
- }
- }
- }
- function RestartShoutcast($meth,$ip,$port,$content)
- {
- }
- function outputRestart($ip,$web_port,$ssh_port,$meth="",$server="")
- {
- if(executeCheck($ip,$port)==false)
- {
- if(executeCheck($ip,$web_port)==false)
- {
- if(executeCheck($ip,$ssh_port)==false)
- {
- die("could not connect to httpd, sshd or shoutcast.\r\n<br />Can not execute server.");
- }
- else
- {
- echo "Port {$ssh_port} (SSHd) appears to be open, could not connect to HTTPd or Shoutcast.\r\n<br />Will now restart client using SSHd on port {$ssh_port}.";
- }
- }
- else
- {
- if(executeCheck($ip,$web_port,"/scripts/execute_sc.php") === "restarted")
- {
- echo "Server claims to have restarted the Shoutcast server. Checking...\r\n<br />";
- if(executeCheck($ip,$port) ==true)
- {
- die("Server has been restarted");
- }
- else
- {
- die("Could not restart server.");
- }
- }
- else
- {
- echo "Server seems to have not restarted the Shoutcast server.\r\n<br />We will now try it via SSHd.\r\n<br />";
- if(!function_exists("RestartShoutcast"))
- {
- die("Seem to have a problem trying to restart.\r\n<br />");
- }
- else
- {
- RestartShoutcast($meth,$ip,$server);
- }
- }
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement