Advertisement
Guest User

Untitled

a guest
Apr 2nd, 2012
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.45 KB | None | 0 0
  1. Cron execution:
  2. /usr/bin/php /var/www/Xion/XionCheckMail.php
  3. php file:
  4. <?php
  5. function MsgTo($to, $gateway, $msg) {
  6. $arr = explode(" ", $msg);
  7. $block = array();
  8.     for($i=0; $i<count($arr); $i++) {
  9.     if(strlen($data) + strlen($arr[$i]) < 150) {       
  10.         $data .= " " . $arr[$i];
  11.         } else {
  12.         $block[] = trim($data);
  13.         $data = "";
  14.         $i = $i-1;
  15.     }
  16.     }
  17.         if(strlen($data) > 1) {
  18.         $block[] = $data;
  19.         }
  20. $count = count($block);
  21. $block = array_reverse($block);
  22. foreach ($block as $key=>$msg) {
  23.     mail($to . '@' . $gateway, 'Xion', ($count-$key) . "/" . $count . "\n" . $msg, null, '-fXion@AcidShower.Com');
  24.     echo "Message Sent: " . $to . "@" . $gateway . " - " . ($count-$key) . "/" . $count . $msg . "<br>";
  25. }
  26. }
  27.  
  28. $mail = imap_open('{localhost:143/imap/notls}', 'xion', 'xion1337');
  29. $last = imap_num_msg($mail);
  30.     if($last == '0') {
  31.         die("Nothing to do...");
  32.     }
  33. $header = imap_header($mail, $last);
  34. $header  = explode("@", $header->fromaddress);
  35. $from = $header[0];
  36. $gateway = $header[1];
  37. $body = imap_body($mail, $last);
  38. imap_delete($mail, $last);
  39. imap_expunge($mail);
  40. imap_close($mail);
  41.  
  42. $str = bin2hex($body);
  43. $str = explode("0d", $str);
  44. $body = pack("H*" , $str[0]);
  45. $body = trim($body);
  46. echo "From: " . $from . "<br>";
  47. echo "Gateway: " . $gateway . "<br>";
  48. echo "Body: " . $body . "<br>";
  49.  
  50.  
  51. //Server Stats Command
  52. if(substr($body, 0, 6) == "!stats") {
  53.     $con = mysql_connect("localhost","AcidRain","platinumbus");
  54.     if (!$con)
  55.       {
  56.       die('Could not connect: ' . mysql_error());
  57.       }
  58.     mysql_select_db("IceCast", $con);
  59.  
  60.     echo "Executing Stats:<br>";
  61.     $IceCast = "Is Live";
  62.     $SERVER = 'http://AcidShower.Com:8003';
  63.     $STATS_FILE = '/status.xsl';
  64.     $fp = fopen($SERVER.$STATS_FILE,'r');
  65.     if(!$fp) {
  66.        $IceCast = "Is Down";
  67.     }
  68. $PlayFile = "../playlist.txt";
  69. $Count = count(file($PlayFile));
  70. $query = mysql_query("SELECT SUM(plays) FROM playcount");
  71. $playcount = mysql_result($query, 0);
  72. $query = mysql_query("SELECT * FROM current");
  73. $curr_track = mysql_result($query, 0, 'song');
  74. $curr_artist = mysql_result($query, 0, 'artist');
  75.  
  76. $msg = "Acidic Radio: " . $IceCast . "\n";
  77. $msg .= "Total Tracks: " . $Count . "\n";
  78. $msg .= "Total Played: " . $playcount . "\n";
  79. $msg .= "Current Track: " . $curr_track . " by " . $curr_artist . "\n";
  80. $msg .= "FTP Server: Is Live\n";
  81. $msg .= "JKBot: Is Live\n";
  82. $msg .= "JKTrivia: Is Live\n";
  83. $msg .= "Mumble Server: Is Live\n";
  84. $msg .= "Http://AcidShower.Com\n";
  85. MsgTo($from, $gateway, $msg);
  86. }
  87.  
  88.  
  89. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement