<?php
session_start();
@set_time_limit(0);


include "ef8fds_sqlconnect.php"; 
$action = $_GET["action"];
if($action=='send' && ($_SESSION["my_id"]==1 || $_SESSION["my_id"]==3) && $_SESSION["mobile_logged_in"] && trim($_POST['sprava'])!='')
{
	$query = "SELECT mail FROM mobile_users WHERE active='a' AND news='1' and mail<>''";
	$result = mysql_query($query, $link);
	$mailov = 0;
	
	$subject = "4mobile news";
   	$sprava = nl2br(stripslashes($_POST["sprava"]));

   	$headers = "From:4mobile <news@4mobile.sk>\n";
   	$headers .= "Content-Type: text/html; charset=iso-8859-2\n";
   	$headers .= "Return-Path: news@4mobile.sk\n";
   	
//   	$sprava .= $headers;
	
	while($row=mysql_fetch_array($result))
	{
			$mailov ++;
			$komu = $row["mail"];
//			$komu = 'pesto@peterpech.com';
	//		$sprava = $row['mail'];
			mail($komu, $subject, $sprava, $headers);
	}
}
?>
<html>
<head>
<title>4mobile - Všetko pre Váš mobil</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
</head>

<body bgcolor="#ffffff">
<div id="Layer1" style="position:absolute; width:500px; height:120px; z-index:2; left: 165px; top: 120px; text-align:center" class=text>
<? if($_SESSION["mobile_logged_in"]==true){ 
	} 
	else {echo "<span class=info1><b>Nie ste prihlásený!</b></span><br>";}

if($_SESSION["log"]=='Pesto' || $_SESSION["log"]=='buchtik')
{
	include"form_mlist.php";
}
echo "<span class=info1>".$mailov." mailov | $test</span>";

?>
<code>
<?php echo $sprava; ?>
</code>
</div>
</body>
</html>
<? mysql_close($link); ?>
