<?php
/*
 *
 * @copyright (c) 2009 animegame.eu
 * @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence
 *
 */

include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/config.inc.php');
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/designfunctions.inc.php');
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/fehlerausgabe.inc.php');
include_once ($_SERVER['DOCUMENT_ROOT'] . 'ag/include/parse.inc.php');
include_once ($_SERVER['DOCUMENT_ROOT'] . 'ag/include/messagefunctions.inc.php');

// GET-Section
// Kritisch (SQL-Injections)
$text = validateString($_REQUEST['text']);
// Unkritisch
$charm = $_REQUEST['charm'];

if($charm) {
	if($user_ida['clan'] <= 0){
		return;
	}
	$clans = mysql_query('SELECT id FROM user WHERE clan='.$user_ida['clan']);
		while($row = mysql_fetch_array($clans)) {
			sendMessage($user_ida['nickname'], $row['id'], 'Clan Nachricht', $text);	
//			mysql_query("INSERT nachricht SET von='$user_ida[nickname]', besitzer='$row[id]', betreff='Clan Nachricht', text='$text'");
		}
			
	displayErrorMessage(NULL,'Nachricht erfolgreich verschickt', '<a href="index.php?as=clan/post">weiter...</a>');
	exit;
}
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
	<input type="hidden" name="as" value="clan/post">
	<input type="hidden" name="charm" value="1">
<table cellpadding="0" cellspacing="0" width="100%" height="69">
	<!-- MSTableType="layout" -->
	<tr>
		<td height="18" valign="top" width="603" colspan="2" align="center">
		<b>Nachricht an Alle clan member</b></td>
	</tr>
		<tr>
		<td height="25" valign="top" colspan="2" align="center">&nbsp;<textarea id="input" rows="8" name="text" cols="40"></textarea></td>
	</tr>
		<tr>
		<td height="25" valign="top" colspan="2" align="center">&nbsp;<input id="input" type="submit" value="abschicken"></td>
	</tr>
</table>
</form>