Probier mal ob meine bei dir funktioniert.
PHP-Code:
<?
userstatus();
$_POST['antwort'] = htmlentities ($_POST['antwort']);
$_POST['betreff'] = htmlentities ($_POST['betreff']);
$spr = 5; // IP-Sperre in Minuten für neue Supportanfrage
$rows = mysql_num_rows(db_query("SELECT * FROM ".$db_prefix."_support WHERE status='0' AND subid=0"));
function newmail() {
global $betreibermail, $domain, $seitenname;
if($rows == 0) {
$text = 'Guten Tag!
Es sind eine oder mehrere neue Supportanfragen auf '.$seitenname.' eingegangen.
Bitte gehen Sie in Ihr Adminforce ('.$domain.'/adminforce/)
und beantworten Sie die vorhandenen Supportanfrage(n).
Mit freundlichen Grüßen,
'.$seitenname;
usermail($betreibermail, 'Supportanfrage auf '.$seitenname.' eingegangen', $text, '"'.$seitenname.'" <'.$betreibermail.'>') or die('Versandfehler');
}
}
$support_reload = mysql_num_rows(db_query("SELECT * FROM ".$db_prefix."_reloads WHERE tan='Supportanfrage' AND uid='".$_SESSION['uid']."' AND bis >= ".time()));
if(isset($_REQUEST['antworten']) == 1 && $support_reload == 0 && isset($_POST['antwort'])) {
$rows = mysql_num_rows(db_query("SELECT * FROM ".$db_prefix."_support WHERE status='0' AND subid=0"));
if($rows == 0) { newmail(); }
db_query("INSERT INTO ".$db_prefix."_support (uid,subid,betreff,text,zeit) VALUES ('".$_SESSION['uid']."','".$_REQUEST['id']."','".$_POST['betreff']."','".$_POST['antwort']."','".time()."')");
db_query("UPDATE ".$db_prefix."_support SET status=0 WHERE id='".$_REQUEST['id']."'");
$new_reload = time()+($spr*60);
db_query("INSERT INTO ".$db_prefix."_reloads (ip,uid,tan,bis) VALUES ('".$ip."','".$_SESSION['uid']."','Supportanfrage','".$new_reload."')") or die(mysql_error());
}
if(isset($_REQUEST['neueanfrage']) == 1 && $support_reload == 0 && isset($_POST['antwort'])) {
$rows = mysql_num_rows(db_query("SELECT * FROM ".$db_prefix."_support WHERE status='0' AND subid=0"));
if($rows == 0) { newmail(); }
db_query("INSERT INTO ".$db_prefix."_support (uid,subid,betreff,text,zeit) VALUES ('".$_SESSION['uid']."','0','".$_POST['betreff']."','".$_POST['antwort']."','".time()."')");
$new_reload = time()+($spr*60);
db_query("INSERT INTO ".$db_prefix."_reloads (ip,uid,tan,bis) VALUES ('".$ip."','".$_SESSION['uid']."','Supportanfrage','".$new_reload."')") or die(mysql_error());
}
$support_reload = mysql_num_rows(db_query("SELECT * FROM ".$db_prefix."_reloads WHERE tan='Supportanfrage' AND uid='".$_SESSION['uid']."' AND bis >= ".time()));
if($support_reload > 0) {
head("Hinweis");
?><center><b>Aus Sicherheitsgründen können Sie eine neue Supportanfrage erst in einigen Momenten stellen.</b></center><?
foot(); }
if(isset($_REQUEST['act']) == "show") {
$sql = db_query("SELECT * FROM ".$db_prefix."_support WHERE uid='".$_SESSION['uid']."' AND subid=0 AND id='".$_REQUEST['id']."'");
if(mysql_num_rows($sql) > 0) {
$res = mysql_fetch_array($sql);
head("Anfrage");
?>
<table width="100%" cellpadding="5" cellspacing="1" border="0" bgcolor="#4B69FF">
<tr bgcolor="#0099CC" style="color: #ffffff;">
<td width="100%"><b><? echo $res['betreff']; ?><b></td>
</tr>
<tr bgcolor="#E2E2E2">
<td><font face="Courier New" size="2" color="black"><? echo nl2br($res['text']); ?><hr size="1" width="95%"><div align="right"><font size=1 color="black"><? 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='".$_SESSION['uid']."' AND subid=".$res['id']." ORDER BY zeit ASC");
while($reply = mysql_fetch_array($repsql)) {
?>
<table width="100%" cellpadding="5" cellspacing="1" border="0" bgcolor="#E2E2E2">
<tr bgcolor="#0099CC">
<td width="100%"><b><? echo $reply['betreff']; ?><b></td>
</tr>
<tr bgcolor="#E2E2E2">
<td><font face="Courier New" size="2" color="black"><? echo nl2br($reply['text']); ?><hr size="1" width="95%"><div align="right"><font size=1 color="black"><? echo date("d.m.Y H:i", $reply['zeit']); ?></font></div></font></td>
</tr>
</table>
<br />
<?
}
if(mysql_num_rows($repsql) == 0) { ?><center><font color="black"><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=/intern/support&id=<? echo $_REQUEST['id']; ?>&antworten=1" method="POST">
<tr>
<td width="30%">
Betreff: <br />
<input type="text" name="betreff" size="67" maxlength="255" value="RE: <? echo $res['betreff']; ?>"></td>
</tr>
<tr>
<td>
Antwort: <br />
<textarea name="antwort" cols="70" 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 color="black"><b>Thema geschlossen. Keine Antwort mehr möglich !</b></font></center><?
foot();
}
} else {
head("Fehler!");
?><center><font color="black"><b>Falsche Ticket-ID übergeben!</b></font></center><?
foot();
} }
if(!isset($_REQUEST['act'])) {
$sql = db_query("SELECT * FROM ".$db_prefix."_support WHERE uid='".$_SESSION['uid']."' AND subid=0");
head("Bisherige Supportanfragen");
?>
<table width="100%" cellpadding="1" cellspacing="1" border="0" bgcolor="#4B69FF">
<tr bgcolor="#0099CC">
<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="#E2E2E2">
<td align="center"><font color="black"><? echo $ticket['id']; ?></font></td>
<td><b><a href="?content=/intern/support&act=show&id=<? echo $ticket['id']; ?>"><? echo $ticket['betreff']; ?></a></b></td>
<td align="center"><font color="black"><? echo $status; ?></font></td>
<td align="center"><font color="black"><? echo date("d.m.Y H:i", $ticket['zeit']); ?></font></td>
</tr>
<?
} } else {
?>
<tr bgcolor="#E2E2E2">
<td align="center" colspan="4"><font color="black"><b>Keine Supportanfragen vorhanden !</b></font><br /></td>
</tr>
<? } ?>
</table>
<?
foot();
head("Neue Supportanfrage");
?><div align="center">
<table border="0" cellpadding="4" cellspacing="0" align="center">
<form action="?content=/intern/support&neueanfrage=1" method="POST">
<tr>
<td width="30%"><b>
Betreff: </b><br />
<input type="text" name="betreff" size="67" maxlength="255" value="Kein Betreff"></td>
</tr>
<tr>
<td><b>
Anfrage: </b><br />
<textarea name="antwort" cols="70" rows="8"></textarea>
</td>
</tr>
</table>
<p align="center">
<input type="submit" class="button" value="Anfrage stellen">
<input type="reset" class="button" value="Zurücksetzen">
</form>
</p></div>
<?
foot();
}
/* Ab hier darf NICHTS (!!!) veraendert werden! */
echo '<font size=1 color="black"><center><b>Powered by <a href="http://www.cash4more.de" target="_blank"><i><b><font color="black">Honni</b></i></a></b></center></font>';
?>