Location: PHPKode > projects > phpMyPrepaid > phpmyprepaid/www/include/middlemans/voicecom.php
<?php

class middlemans {
    var $reply_in = "SEND_OK: ";
    var $reply_out;
    var $mail_msg = "";
    var $mail_to = "hide@address.com";
    var $mail_from = "hide@address.com";
    var $mail_fromname = "PhpMyPrePaid";
    
    function init(){
//	echo "<br>\n";
        foreach($_POST as $key => $value) {
    	    if (is_array($value) && $key == "query") {
    		foreach($value as $keya => $valuea) {
		    if ($keya == "msisdn")
    			$this->mail_msg .= "GSM nomber: ".$valuea."\n\n";
    		    if ($keya == "timestamp"){
    	    		$dt[0] = substr($valuea, 0, 4);
	    		$dt[1] = substr($valuea, 4, 2);
	    		$dt[2] = substr($valuea, 6, 2);
	    		$tm[0] = substr($valuea, 8, 2);
	    		$tm[1] = substr($valuea, 10, 2);
	    		$tm[2] = substr($valuea, 12, 2);
    			$this->mail_msg .= "Date/time: ".join($dt, "-")." ".join($tm, ":")."\n\n";
    			}
    		    $_SESSION["query_".$keya] = $valuea;
//		    echo $keya."=>".$valuea."<br>\n";
		}
	    }
//	    else{
//    		echo $key."=>".$value."<br>\n";
//	    }
	}


    }
    
    function reply($reply = "") {
	$this->ReplyToMail();
	echo ($reply == "" ? $this->reply_in : $reply);
	
    }
        
    function ReplyToMail($mailfrom = "", $mailfromname = "", $mailto = "") {
//        $newencode = new ConvertCharset;
        $mail = new phpmailer();
        
        $this->mail_to = ($mailto == "")? $this->mail_to : $mailto;
        $mail->From = $this->mail_from = ($mailfrom == "") ? $this->mail_from : $mailfrom;
        $mail->FromName = $this->mail_fromname = ($mailfromname == "") ? $this->mail_fromname : $mailfromname;    
        $mail->Mailer = "mail";
        
//	$this->mail_msg =$newencode->Convert($this->mail_msg,"utf-8","gsm0338",true);
	$mail->Subject = $text_body;
//	$mail->AltBody = $text_body;
	$mail->AddAddress($this->mail_to);
    if (!$mail->Send())
//	echo "Error mail";
	$mail->ClearAddresses();
    
//	echo $this->mail_msg;
    }
    
    function execute($msg) {
	print($this->reply_out = trim($msg, "\n  "));
    }
}
?>
Return current item: phpMyPrepaid