<?
########## Confixx(R) 3.0 Professional ############
####### Copyright SWsoft, Inc. 2004-2005 ##########
#### http://www.sw-soft.com - info@sw-soft.com ####

include_once( "../include/class.SQLInteger.php" );
include_once( "../include/class.SQLString.php" );
include_once("auth.php");
include("../languages/".$shortlang."/scripts.inc.php");

## mysql verbindung aufbauen
db_connect($db_host, $db_user, $db_pass);
## /mysql verbindung aufbauen

$id = safe_query( "select code from ereignisse where code = ?  and anbieter = ?  and geloescht='0'", TRUE, new SQLInteger( $code ), new SQLString( $PHP_AUTH_USER ) );
$anzahlereignisse = db_num_rows($id);
if ($anzahlereignisse == 0)
	{
	 $fehlertext = ltext("alse2_error1");
	 include("allgemein_servermeldungen.php");
	 exit();
	}
$end = $start + $schritte;
?>
<HTML>
<HEAD>
<META content="text/html; charset=<? echo $lang_html_charset; ?>" http-equiv=Content-Type>
<LINK href="<?=$strSkinName?>/style.css" rel=stylesheet type=text/css>
</HEAD>

<BODY bgColor=#ffffff bottomMargin=0 leftMargin=0 topMargin=0 MARGINHEIGHT="0" MARGINWIDTH="0">
<br><? include("../fehler.inc.php"); ?>
<script>
function doChange()
{
document.forms[0].submit();
}
<?
echo js_f_call_help('', 'alse2_title1');
?>
</script>

<table class="tblbgcolor" align="left" border="1" cellpadding="3" cellspacing="0" bordercolorlight="#CCCCCC" bordercolordark="#FFFFFF">
<tr>
    <td valign="top"> 
      <? if ($anzahlereignisse > 0)  { ?> 
    	    <p><b>
	    <? 
		if ($code == 0) { 
		    echo ltext('errtype_notices'); 
		} elseif ($code == 1) { 
		    echo ltext('errtype_errors'); 
		} else { 
		    echo ltext('errtype_errors'); 
		} 
	    ?> 
            <? echo $start + 1; ?> 
	    - 
	    <? if ($anzahlereignisse > $end) { 
		    echo $end; 
		} else { 
		    echo $anzahlereignisse; 
		} 
	    ?>
	    </b></p>
            
            <table border="1" cellspacing="0" bordercolorlight="<? echo $color_dark_grey; ?>" cellpadding="3" bordercolordark="#ffffff" >
	    <tr>
		<td colspan="3" class="titel-3">
		    <? echo ltext("alse2_title2"); ?>
		</td>
	    </tr>
    	    <tr> 
        	<td class="titel-3" >
        	    <? echo ltext("alse2_cell_time"); ?>
        	</td>
        	<td class="titel-3" >
        	    <? echo ltext("alse2_cell_message"); ?>
        	</td>
        	<td class="titel-3" >
        	    <? echo ltext("alse2_cell_user"); ?>
        	</td>
    	    </tr>
    	    <?
		if ($db_type == "mysql")
		{
		    $id = safe_query( "SELECT * FROM ereignisse WHERE code = ? AND anbieter = ? AND geloescht = 0 ORDER BY ident DESC
			LIMIT ?, ?", TRUE, new SQLInteger($code), new SQLString($PHP_AUTH_USER), new SQLInteger($start), new SQLInteger($schritte) );
		} else
		{
		    $id = safe_query( "SELECT * FROM ereignisse WHERE code = ? AND anbieter = ? AND geloescht = 0 ORDER BY ident DESC
			LIMIT ?, ?", TRUE, new SQLInteger($code), new SQLString($PHP_AUTH_USER), new SQLInteger($schritte), new SQLInteger($start) );
		}

		while ($werte = db_fetch_array($id)) {

		    $datum = date($lang_format_datetime_long, $werte["timestamp"]);
	    ?> 
		<tr> 
        	    <td>
    			<? echo $datum; ?>
		    </td>
        	    <td>
			<? echo mlf_text($werte["nachricht"]); ?>
		    </td>
        	    <td>
			<? echo $werte["kunde"]; ?>&nbsp;
		    </td>
    		</tr>
    	    <? } ?>
    	    
    	    <tr>
		<? if ($start > 0) { ?>
		<td align="center">&nbsp;
		    <b><i>&lt;&lt;</i></b>
        	    <a class=data href="allgemein_servermeldungen2.php?code=<? echo $code; ?>&amp;start=<? echo $start - $schritte; ?>&amp;schritte=<? echo $schritte; ?>">
			<? echo ltext("alse2_link_back"); ?>
		    </a> 
		</td>
        	<? } ?>

		<? 
		if ( ($start > 0) && ($anzahlereignisse > $end) ) {
		    $colspannumb = 1; 
		} elseif ( ($start > 0) || ($anzahlereignisse > $end) ) {
		    $colspannumb = 2;
		} else {
		    $colspannumb = 3;
		}
		?>
		<td align="center" colspan=<? echo $colspannumb; ?>>
		    <a class=data href="allgemein_servermeldungen.php">
			<? echo ltext("alse2_link_selection"); ?>
		    </a>
		</td>

		<? if ($anzahlereignisse > $end) { ?> 
		    <td align="center">&nbsp;
        	    <a class=data href="allgemein_servermeldungen2.php?code=<? echo $code; ?>&amp;start=<? echo $start + $schritte; ?>&amp;schritte=<? echo $schritte; ?>">
			<? echo ltext("alse2_link_forward"); ?>
		    </a>
		    <b><i>&gt;&gt;</i></b>
		</td>
		<? } ?>
	    </tr>
    	    </table>
      <? } else { ?>
    	    
    	    <? if ($code == 0) { ?>
    		<b><i> 
    		    <? echo ltext("alse2_text1"); ?>
    		</i></b> 
    	    <? } ?>
    	    <? if ($code == 1) { ?>
    		<b><i> 
    		    <? echo ltext("alse2_text2"); ?>
    		</i></b> 
    	    <? } ?>
    	    <? if ($code == 2) { ?>
    		<b><i>
    		    <? echo ltext("alse2_text3"); ?>
    		</i></b>
    	    <? } ?>
       
      <? } ?>
    </td>
</tr>
</TABLE>
</BODY>
</HTML>

<?
db_close();
?>
