<?
########## 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 kunde = ?  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;
$id = safe_query( "select statistik from kunden where kunde = ? ", TRUE, new SQLString( $PHP_AUTH_USER ) );
$werte = db_fetch_array($id);
$statistik = $werte["statistik"];
?>
<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();
}
</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("alse2_text_hints"); 
	} else { 
		echo ltext("alse2_text_error"); 
	} 
	    ?>
    	    <? echo $start + 1; ?>
    	    - 
    	    <? if ($anzahlereignisse > $end) { 
		    echo $end; 
	} else { 
		echo $anzahlereignisse; 
	} 
	    ?>
	    </b></p>
      	    <table border="1" cellpadding="3"bordercolorlight=<? echo $color_dark_grey; ?> cellspacing="0" bordercolorlight="#CCCCCC" 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 colspan=2 class="titel-3" >
		    <? echo ltext("alse2_cell_message"); ?>
		</td>
    	    </tr>
	    <!--
            <tr>
                <td align="center">&nbsp;
                <? if ($start > 0) { ?>
            	    <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>
                <td align="center">
            	    <a class=data href="allgemein_servermeldungen.php">
                	<? echo ltext("alse2_link_selection"); ?>
                    </a>
                </td>
                <td align="center">&nbsp;
                <? if ($anzahlereignisse > $end) { ?>
            	    <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>
	    -->
<?
 $loCode = new SQLInteger( $code );															 
 $loUser = new SQLString( $PHP_AUTH_USER );
 if ($db_type == "mysql") {
	 $sql = "select * from ereignisse where code=? and kunde=? ".
		 "and geloescht = 0 order by ident desc limit $start,$schritte";
 } else {
	 $sql = "select * from ereignisse where code=? and kunde=? ".
	 "and geloescht = 0 order by ident desc limit $schritte offset $start";
 }
 $id = safe_query2( $sql, $loCode, $loUser );
 while ($werte = db_fetch_array($id)) {

	 $datum = date($lang_format_datetime_long, $werte["timestamp"]);

	    ?>
    		<tr> 
        	    <td>
        		<? echo $datum; ?>
        	    </td>
        	    <td colspan=2>
        		<? echo mlf_text($werte["nachricht"]); ?>
        	    </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_nohints"); ?>
		</i></b>
    	    <? } ?>
    	    <? if ($code == 1) { ?>
		<b><i>
    		    <? echo ltext("alse2_noerrormessages"); ?>
		</i></b>
    	    <? } ?>
    	    <? if ($code == 2) { ?>
		<b><i>
    		    <? echo ltext("alse2_noerrors"); ?>
		</i></b>
    	    <? } ?>       
        <? } ?>
    </td>
</tr>
</TABLE>
</BODY>
</HTML>
<?
db_close();
?>
