hier der code.. ich benutze vms1
PHP-Code:
<?
if(isset($_REQUEST['antworten']) == 1) {
db_query("INSERT INTO ".$db_prefix."_support (uid,subid,betreff,text,zeit) VALUES ('".$_GET['uid']."','".$_REQUEST['id']."','".$_POST['betreff']."','".$_POST['antwort']."','".time()."')");
db_query("UPDATE ".$db_prefix."_support SET status=1 WHERE id='".$_REQUEST['id']."'");
}
if(isset($_REQUEST['act']) == "show") {
$sql = db_query("SELECT * FROM ".$db_prefix."_support WHERE uid='".$_GET['uid']."' AND subid=0 AND id='".$_REQUEST['id']."'");
if(mysql_num_rows($sql) > 0) {
$res = mysql_fetch_array($sql);
head("Anfrage von ".$res['uid']);
?>
<table width="100%" cellpadding="5" cellspacing="1" border="0">
<tr bgcolor="#467DA3" style="color: #ffffff;">
<td width="100%"><b><? echo $res['betreff']; ?><b></td>
</tr>
<tr bgcolor="#FAE5C4">
<td><font face="Courier New" size="2"><? echo nl2br($res['text']); ?><hr size="1" color="#000000" width="95%"><div align="right"><font size=1><? echo date("d.m.Y H:i", $res['zeit']); ?></font></div></font></td>
</tr>
</table>
<?
foot();
head("Antworten");
$repsql = db_query("SELECT * FROM ".$db_prefix."_support WHERE uid='".$_GET['uid']."' AND subid=".$_REQUEST['id']." ORDER BY zeit ASC");
while($reply = mysql_fetch_array($repsql)) {
?>
<table width="100%" cellpadding="5" cellspacing="1" border="0">
<tr bgcolor="#467DA3" style="color: #ffffff;">
<td width="100%"><b><? echo $reply['betreff']; ?><b></td>
</tr>
<tr bgcolor="#FAE5C4">
<td><font face="Courier New" size="2"><? echo nl2br($reply['text']); ?><hr size="1" color="#000000" width="95%"><div align="right"><font size=1><? echo date("d.m.Y H:i", $reply['zeit']); ?></font></div></font></td>
</tr>
</table>
<br />
<?
}
if(mysql_num_rows($repsql) == 0) { ?><center><font class="hinweis"><b>Noch keine Antworten vorhanden!</b></font></center><? }
foot();
if($res['status'] != 2) {
head("Eine Antwort schreiben");
?><div align="center">
<table border="0" cellpadding="4" cellspacing="0" align="center">
<form action="?content=/usersystem/support&uid=<? echo $_GET['uid']; ?>&id=<? echo $_REQUEST['id']; ?>&antworten=1" method="POST">
<tr>
<td width="30%">
Betreff: <br />
<input type="text" name="betreff" size="60" maxlength="255" value="RE: <? echo $res['betreff']; ?>"></td>
</tr>
<tr>
<td>
Antwort: <br />
<textarea name="antwort" cols="60" rows="8"></textarea>
</td>
</tr>
</table>
<p align="center">
<input type="submit" class="button" value="Antworten">
<input type="reset" class="button" value="Zurücksetzen">
</form>
</p></div>
<?
foot();
} else {
head("Hinweis!");
?><center><font class="hinweis"><b>Thema geschlossen. Keine Antwort mehr möglich !</b></font></center><?
foot();
}
} else {
head("Fehler!");
?><center><font class="hinweis"><b>Falsche Ticket-ID übergeben!</b></font></center><?
foot();
} }
if(!isset($_REQUEST['act'])) {
$sql = db_query("SELECT * FROM ".$db_prefix."_support WHERE subid=0 AND status=0");
head("Bisherige Supportanfragen");
?>
<table width="100%" cellpadding="1" cellspacing="1" border="0">
<tr bgcolor="#467DA3" style="color: #ffffff;">
<td align="center" width="5%"><b>ID<b></td>
<td align="center" width="60%"><b>Betreff<b></td>
<td align="center" width="20%"><b>Status<b></td>
<td align="center" width="15%"><b>Datum<b></td>
</tr>
<?
if(mysql_num_rows($sql) > 0) {
while($ticket = mysql_fetch_array($sql)) {
if($ticket['status'] == 0) { $status = "Unbeantwortet"; }
if($ticket['status'] == 1) { $status = "Beantwortet"; }
if($ticket['status'] == 2) { $status = "Geschlossen"; }
?>
<tr bgcolor="#FAE5C4">
<td align="center"><? echo $ticket['id']; ?></td>
<td><a href="?content=/usersystem/support&act=show&uid=<? echo $ticket['uid']; ?>&id=<? echo $ticket['id']; ?>"><? echo $ticket['betreff']; ?></a></td>
<td align="center"><? echo $status; ?></td>
<td align="center"><? echo date("d.m.Y H:i", $ticket['zeit']); ?></td>
</tr>
<?
} } else {
?>
<tr bgcolor="#FAE5C4">
<td align="center" colspan="4"><font class="hinweis"><b>Keine unbeantworteten Supportanfragen vorhanden !</b></font><br /></td>
</tr>
<? } ?>
</table>
<?
foot();
}
?>