Location: PHPKode > projects > WH Community > wh_community/admin/newsletter.php
<?php include('files/header.php'); ?>
<div id="content-outer">
<div id="content">

	<div id="page-heading">
		<h1><?php echo $lang_admin['newsletter']; ?></h1>
	</div>
	
	<table border="0" width="100%" cellpadding="0" cellspacing="0" id="content-table">
	<tr>
		<th rowspan="3" class="sized"><img src="files/shared/side_shadowleft.jpg" width="20" height="300" alt="shadow_l"></th>
		<th class="topleft"></th>
		<td id="tbl-border-top">&nbsp;</td>
		<th class="topright"></th>
		<th rowspan="3" class="sized"><img src="files/shared/side_shadowright.jpg" width="20" height="300" alt="shadow_r"></th>
	</tr>
	<tr>
		<td id="tbl-border-left"></td>
		<td><div id="content-table-inner">
			<div id="table-content">
			<p><?php
			
			$config = array();
			$config['abs']['name'] = $titel;
			$config['abs']['mail'] = $webmaster;
			
			if(!isset($_GET['action']))$_GET['action'] = 'form';
			switch($_GET['action']) {
			
			case'form':
			
			?></p>
			<table width="100%">
			<tr>
			<td><p><?php
			
			$abfrage = mysql_query("SELECT user_id FROM users"); 
			$total = mysql_num_rows($abfrage); 
			echo '<strong>' . $total . ' ' . $lang_admin['receiver_newsletter'] . '</strong>';
			
			?><br><br>
			<form action="?action=send" method="POST">
			<input type="text" name="betreff" size="45" class="fields"> <strong><?php echo $lang_admin['subject']; ?></strong><br><br>
			<strong><?php echo $lang_admin['msg_newsletter']; ?></strong><br>
			<textarea name="text" cols="50" rows="10" class="fields"><?php echo $lang_admin['good_day']; ?></textarea><br><br>
			<input type="submit" value="Senden" class="button">
			</form></p></td>
			</tr>
			</table>
			<p><?php
			
			break;
			case'send':
			$query = mysql_query("SELECT user_id, user_name, user_email FROM users");
			$i = 0;
			
			while($ds = mysql_fetch_assoc($query)) {
			$_POST['text'] = str_replace("{user_name}", $ds['user_name'], $_POST['text']);
			mail($ds['user_email'], $_POST['betreff'], $_POST['text'], "From: " . $config['abs']['name'] . "<" . $config['abs']['mail'] . ">");
			$i++;
			}
			
			echo '<p><u>' . $i . '</u> ' . $lang_admin['success_newsletter'] . '</p>';
			break;
			}
			
			?></p>
			</div>
		</div></td>
		<td id="tbl-border-right"></td>
	</tr>
	<tr>
		<th class="sized bottomleft"></th>
		<td id="tbl-border-bottom">&nbsp;</td>
		<th class="sized bottomright"></th>
	</tr>
	</table>
			
	<div class="clear"></div>
		 
	</div>

	<div class="clear">&nbsp;</div>

</div>
<div class="clear">&nbsp;</div>
</div>
<?php include('files/footer.php'); ?>
Return current item: WH Community