<?php
include "scrinit.php";
	require_once 'soapClient.class.php';
	$ws=new WebsmsClient($cfg);

	$sender = "chemlab";
	$credits1=$ws->getCredits();
	$mes1=$_SESSION['mes'];
	$onoma=$_SESSION['onoma'];
	$des=$_SESSION['tel'];
	echo "<br>";
	$i=0;
	foreach ($des as $t)
	{
		
		if (!empty($t) or $t <> 0)
		{
		$mes=$onoma[$i]." ".$mes1[$i];
	    $res=$ws->submitSM($sender,$t,$mes,"GSM");
		if ($res)
		{  
			$dtm = date('Y-m-d H:i:s');
		    $sql = $dbcon->prepare("update loizos set date=?,snd='1' ");
            $sql->execute([$dtm]);
		}
		echo "<br>".$mes." ".$t;
		$i++;
		}
	}
	echo "<br>";
	$mes=$mes1." ".$mes2;
	echo "ΕΧΟΥΝ ΣΤΑΛΕΙ ".$i."΄ΜΗΝΥΜΑΤΑ";
	$credits2=$ws->getCredits();
	echo "<p>";
	echo "<p>"."ΑΡΧΙΚΕΣ ΜΟΝΑΔΕΣ:".$credits1."</p>";
	echo "<p>"."ΥΠΟΛΟΙΠΟΜΕΝΕΣ ΜΟΝΑΔΕΣ:".$credits2."</p>";
	/*if($credits1 > $credits2)
	{
		$sql = $dbcon->prepare("insert into smsoutmes (smscode,mes,senderpmp,source) values(?,?,?,?)");
        $sql->execute([$smc,$mes,$usr,$fl]);
	}
	*/

	
?>
<br /><br />
<a  href=<?php echo $menu;?> style="color:blue "  > <button> Επιστροφή στο Μενού   </a>
</body>
</html>