Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Cron execution:
- /usr/bin/php /var/www/Xion/XionCheckMail.php
- php file:
- <?php
- function MsgTo($to, $gateway, $msg) {
- $arr = explode(" ", $msg);
- $block = array();
- for($i=0; $i<count($arr); $i++) {
- if(strlen($data) + strlen($arr[$i]) < 150) {
- $data .= " " . $arr[$i];
- } else {
- $block[] = trim($data);
- $data = "";
- $i = $i-1;
- }
- }
- if(strlen($data) > 1) {
- $block[] = $data;
- }
- $count = count($block);
- $block = array_reverse($block);
- foreach ($block as $key=>$msg) {
- mail($to . '@' . $gateway, 'Xion', ($count-$key) . "/" . $count . "\n" . $msg, null, '-fXion@AcidShower.Com');
- echo "Message Sent: " . $to . "@" . $gateway . " - " . ($count-$key) . "/" . $count . $msg . "<br>";
- }
- }
- $mail = imap_open('{localhost:143/imap/notls}', 'xion', 'xion1337');
- $last = imap_num_msg($mail);
- if($last == '0') {
- die("Nothing to do...");
- }
- $header = imap_header($mail, $last);
- $header = explode("@", $header->fromaddress);
- $from = $header[0];
- $gateway = $header[1];
- $body = imap_body($mail, $last);
- imap_delete($mail, $last);
- imap_expunge($mail);
- imap_close($mail);
- $str = bin2hex($body);
- $str = explode("0d", $str);
- $body = pack("H*" , $str[0]);
- $body = trim($body);
- echo "From: " . $from . "<br>";
- echo "Gateway: " . $gateway . "<br>";
- echo "Body: " . $body . "<br>";
- //Server Stats Command
- if(substr($body, 0, 6) == "!stats") {
- $con = mysql_connect("localhost","AcidRain","platinumbus");
- if (!$con)
- {
- die('Could not connect: ' . mysql_error());
- }
- mysql_select_db("IceCast", $con);
- echo "Executing Stats:<br>";
- $IceCast = "Is Live";
- $SERVER = 'http://AcidShower.Com:8003';
- $STATS_FILE = '/status.xsl';
- $fp = fopen($SERVER.$STATS_FILE,'r');
- if(!$fp) {
- $IceCast = "Is Down";
- }
- $PlayFile = "../playlist.txt";
- $Count = count(file($PlayFile));
- $query = mysql_query("SELECT SUM(plays) FROM playcount");
- $playcount = mysql_result($query, 0);
- $query = mysql_query("SELECT * FROM current");
- $curr_track = mysql_result($query, 0, 'song');
- $curr_artist = mysql_result($query, 0, 'artist');
- $msg = "Acidic Radio: " . $IceCast . "\n";
- $msg .= "Total Tracks: " . $Count . "\n";
- $msg .= "Total Played: " . $playcount . "\n";
- $msg .= "Current Track: " . $curr_track . " by " . $curr_artist . "\n";
- $msg .= "FTP Server: Is Live\n";
- $msg .= "JKBot: Is Live\n";
- $msg .= "JKTrivia: Is Live\n";
- $msg .= "Mumble Server: Is Live\n";
- $msg .= "Http://AcidShower.Com\n";
- MsgTo($from, $gateway, $msg);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement