<?php
if(empty($_GET['id'])):
echo "<li><a href='admin.php?id=new'>Zasl?n? novinek registrovan?m u?ivatel?m</a></li>";
elseif($_GET['id']=='new'):
?>
<form action="admin.php" method="get">
<table width="500" border="0" cellpadding="10" cellspacing="0" bgcolor="#8080ff">
<tr>
<td><textarea cols="25" rows="10" name="zprava"></textarea>
<input type="hidden" name="id" value="ok" /></td>
<td><input type="submit" name="akce" value="Odeslat reg. u?ivatel?m" /></td>
</tr>
</table>
</form>
<?php
endif;
if($_GET['id']=='ok' AND (!empty($_GET['zprava']))):
// pos?l?me zpr?vu?
require("config.php");
// na?ten? konfigurace datab?ze
$zprava=$_GET['zprava'];
@$vysledek=MySQL_Query("SELECT email FROM seznam WHERE overeno='OK'");
// v?b?r email? z datab?ze
if(!$vysledek):
// o?et?en? chyby
echo "V datab?zi nen? ??dn? reg. u?ivatel";
exit;
endif;
$predmet="Novinky!";
$hlavicka="From: info.hlava@seznam.czrn";
while($zaznam=MySQL_Fetch_Array($vysledek)):
$bccx[]=$zaznam['email'];
// na?ten? email? do pole
endwhile;
$bcc.="Bcc: ".Implode($bccx, ",")."rn";
// odd?len? email? ??rkou
$hlavicka.=$bcc."Mime-Version: 1.0rnX-Mailer: TESTrnContent-Type: text/plain; charset=windows-1250rn";
mail("", "$predmet", "$zprava", "$hlavicka");
// posl?n? emailu
$users = mysql_fetch_row(mysql_query("SELECT COUNT(id) FROM seznam WHERE overeno='OK'"));
// kolika lidem se email odeslal
echo "Posl?no: ".$users[0]." u?ivatel?m";
endif;
?>
M?lo by to poslat emaily. ale v?dy to uk??e ?e se to odeslalo 1 u?ivateli (tedy m?) ale nic nedojde