<?
########## 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_once("../include/cron_functions.php");

db_connect($db_host, $db_user, $db_pass);

$loUser = new SQLString( $PHP_AUTH_USER );

## userdaten ermitteln und anzeigen, wenn angezeigt werden soll
$id = safe_query2( "select * from kunden where kunde = ? ", $loUser );
$werte = db_fetch_array($id);
$id = db_query("SELECT * FROM admin");
$admin = db_fetch_array($id);
$name = $werte["name"];
$firstname = $werte["firstname"];
$firma = $werte["firma"];
$anschrift = $werte["anschrift"];
$plz = $werte["plz"];
$ort = $werte["plzort"];
$telefon = $werte["telefon"];
$fax = $werte["fax"];
$emailadresse = $werte["emailadresse"];
$kundennummer = $werte["kundennummer"];
$freifeldname1 = $werte["freifeldname1"];
$freifeldname2 = $werte["freifeldname2"];
$freifeldname3 = $werte["freifeldname3"];
$freifeldwert1 = $werte["freifeldwert1"];
$freifeldwert2 = $werte["freifeldwert2"];
$freifeldwert3 = $werte["freifeldwert3"];
$anmeldedatum = $werte["anmeldedatum"];
$kundendatenanzeigen = $werte["kundendatenanzeigen"];

$maxpop = $werte["maxpop"];
$maxkb = $werte["maxkb"];
$kbhomedir = $werte["kbhomedir"];
$kbdb = $werte["kbdb"];
$kbgesamt = $kbhomedir + $kbdb;
$maxmysql = $werte["maxmysql"];
$maxemail = $werte["maxemail"];
$maxautoresponder = $werte["maxautoresponder"];
$maxftp = $werte["maxftp"];
$maxtransfer = $werte["maxtransfer"];
$maxsubdomains = $werte["maxsubdomains"];
$shell = $werte["shell"];
$statistik = $werte["statistik"];
$pwschutz = $werte["pwschutz"];
$fehlerseiten = $werte["fehlerseiten"];
$webftp = $werte["webftp"];
$webmail = $werte["webmail"];

$maxkb = $werte["maxkb"];
$kbgesamt = $kbgesamt;
$maxtransfer = $werte["maxtransfer"];
$maxsubdomains = $werte["maxsubdomains"];
$maxatdomains = $werte["maxatdomains"];
$maxpop3 = $werte["maxpop"];
$maxftp = $werte["maxftp"];
$maxemail = $werte["maxemail"];
$maxautoresponder = $werte["maxautoresponder"];
$maxmysql = $werte["maxmysql"];
$maxcronjobs = $werte["maxcronjobs"];
$dirlist = $werte["dirlist"];
$maxmaillist = $werte['maxmaillist'];
if ( !$admin["majordomo"] )
  $maxmaillist = 0;

$php = $werte["php"];
$ftp = $werte["ftp"];
$perl = $werte["perl"];
$ssi = $werte["ssi"];
$phpupload = $werte["phpupload"];
$wap = $werte["wap"];
$coldfusion = $werte["coldfusion"];
$spamfilter = $werte["spamfilter"];
$frontpage = $werte["frontpage"];

if ($ftp == 1) { $features .= "FTP, "; }
if ($php == 1) { $features .= "PHP, "; }
if ($phpupload == 1) { $features .= "PHP-Upload, "; }
if ($perl > 0) { $features .= "Perl, "; }
if ($ssi == 1) { $features .= "SSI, "; }
if ($wap == 1) { $features .= "Wap, "; }
if (($coldfusion == 1) && $admin["coldfusion"]) { $features .= "ColdFusion, "; }
if ($spamfilter == 1) { $features .= "Spam filter, "; }
if (($frontpage == 1) && $admin["frontpage"]) { $features .= $lang_text["alfr_title"].", "; }
$features = substr($features, 0, strlen($features) -2);

$id = safe_query2( "select count(account) as pop from pop3 where kunde = ? ", $loUser );
$werte = db_fetch_array($id);
$pop = $werte["pop"];

$id = safe_query2( "select domain from domains where kunde = ?  and richtigedomain='1' order by domain", $loUser );
while ($werte = db_fetch_array($id))
	{
	 $domain = $werte["domain"];
	 $domainliste .= $domain.", ";
	}
$domainliste = substr($domainliste,0,strlen($domainliste) - 2);

$id = safe_query2( "select count(account) as ftp from ftp where kunde = ? ", $loUser );
$werte = db_fetch_array($id);

$ftp = $werte["ftp"];

$id = safe_query2( "select count(domain) as subdomains from domains where kunde = ?  and richtigedomain = 0", $loUser );
$werte = db_fetch_array($id);
$subdomains = $werte["subdomains"];

$id = safe_query2( "SELECT COUNT(*) AS atd FROM atdomains, domains WHERE domains.kunde = ? " .
									 " AND domains.id=atdomains.id_from", $loUser );
$werte = db_fetch_array($id);
$atdomains = $werte["atd"];


$id = safe_query2( "select count(ident) as email from email where kunde = ? ", $loUser );
$werte = db_fetch_array($id);
$email = $werte["email"];

$id = safe_query2( "select count(ident) as autoresponder from autoresponder where kunde = ? ", $loUser );
$werte = db_fetch_array($id);
$autoresponder = $werte["autoresponder"];

$monat = date("n");
$jahr = date("Y");
$monatstr = $lang_months[$monat];

$id = safe_query2( "select (sum(ftp) + sum(web) + sum(email)) as gesamttransfer from transfer ".
									 "where kunde = ?  and monat = ?  and jahr = ?  and geloescht = 0", 
									 $loUser, new SQLInteger( $monat ), new SQLInteger( $jahr ) );
$werte = db_fetch_array($id);
$gesamttransfer = $werte["gesamttransfer"];

##anzahl mysqldbs
$id = safe_query2( "select count(datenbank) as mysql from mysql_datenbanken where kunde = ? ", $loUser );
$werte = db_fetch_array($id);
$anzahlmysql = $werte["mysql"];
##anzahl mysqldbs


$id = safe_query2("SELECT COUNT(*) AS cnt FROM idn_aliases ".
									"INNER JOIN domains ON ( domains.id = idn_aliases.domain_id ) WHERE domains.kunde = ?",
									$loUser );
$werte = db_fetch_array($id);
$idn = $werte["cnt"];

$id = safe_query2( "SELECT COUNT(*) AS cnt FROM maillist ".
									 " INNER JOIN domains ON ( domains.id = maillist.domain_id ) WHERE domains.kunde = ?",
									 $loUser );
$werte = db_fetch_array($id);
$maillist = $werte["cnt"];



## cron jobs
$anzahlcronjobs = count_cron_jobs_user($PHP_AUTH_USER);
## cron jobs

?>
<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> 
      <b><? echo ltext("alst_title1"); ?></b><br>
      <? echo ltext("alst_descr1"); ?><br>
      <table class="tblbgcolor" align="left" border="1" cellpadding="3" cellspacing="0" bordercolorlight="#CCCCCC" bordercolordark="#FFFFFF">
      <?
if ($kundendatenanzeigen == 1) {
?>
      <tr><td colspan=2 class="titel-3" ><? echo ltext("alst_title2"); ?></td></tr>
        <? if (!istleer($name) || !istleer($firstname)) { ?>
        <tr> 
          <td> 
            <div align=right> 
              <? echo ltext("alst_cell_name"); ?>
              </div>
          </td>
          <td>             
            <? echo $firstname."&nbsp;".$name; ?>
            </td>
        </tr>
        <? } 
if (!istleer($firma)) { ?>
        <tr> 
          <td> 
            <div align=right> 
             
              <? echo ltext("alst_cell_firm"); ?>
              </div>
          </td>
          <td> 
             
            <? echo $firma; ?>
            </td>
        </tr>
        <? } 
if (!istleer($anschrift)) { ?>
        <tr> 
          <td> 
            <div align=right> 
              <? echo ltext("alst_cell_address"); ?>
              </div>
          </td>
          <td> 
             
            <? echo $anschrift; ?>
            </td>
        </tr>
        <? }
if (!istleer($plz) || !istleer($ort)) { ?>
        <tr> 
          <td> 
            <div align="right"> 
              <? echo ltext("alst_cell_city"); ?>
              </div>
          </td>
          <td> 
            <? echo $plz."&nbsp;".$ort; ?>
            </td>
        </tr>
        <? }
if (!istleer($telefon)) { ?>
        <tr> 
          <td> 
            <div align="right"> 
              <? echo ltext("alst_cell_tel"); ?>
              </div>
          </td>
          <td> 
            <? echo $telefon; ?>
            </td>
        </tr>
        <? }
if (!istleer($fax)) { ?>
        <tr> 
          <td> 
            <div align=right> 
              <? echo ltext("alst_cell_fax"); ?>
              </div>
          </td>
          <td> 
             
            <? echo $fax; ?>
            </td>
        </tr>
        <? }
if (!istleer($emailadresse)) { ?>
        <tr> 
          <td> 
            <div align=right> 
              <? echo ltext("alst_cell_email"); ?>
              </div>
          </td>
          <td> 
             
            <? echo $emailadresse; ?>
            </td>
        </tr>
        <? }
if (!istleer($kundennummer)) { ?>
        <tr> 
          <td> 
            <div align="right"> 
              <? echo ltext("alst_cell_cid"); ?>
              </div>
          </td>
          <td>  
            <? echo $kundennummer; ?>
            </td>
        </tr>
        <? }
if (!istleer($freifeldwert1)) { ?>
        <tr> 
          <td> 
            <div align="right"> 
              <? echo $freifeldname1; ?>
              </div>
          </td>
          <td>  
            <? echo $freifeldwert1; ?>
            </td>
        </tr>
        <? }
if (!istleer($freifeldwert2)) { ?>
        <tr> 
          <td> 
            <div align="right"> 
              <? echo $freifeldname2; ?>
              </div>
          </td>
          <td>  
            <? echo $freifeldwert2; ?>
            </td>
        </tr>
        <? }
if (!istleer($freifeldwert3)) { ?>
        <tr> 
          <td> 
            <div align="right"> 
              <? echo $freifeldname3; ?>
              </div>
          </td>
          <td> 
            <? echo $freifeldwert3; ?>
             </td>
        </tr>
        <? } ?>
         
      <? } ?>
       
      <tr><td colspan=2 class="titel-3" ><? echo ltext("alst_title3"); ?></td></tr>
        <TR> 
          <TD> 
            <DIV align=right> 
              <? echo ltext("alst_cell_login"); ?>
              </DIV>
          </TD>
          <TD> 
            
            <? echo $PHP_AUTH_USER ?>
            </TD>
        </TR>
        <TR> 
          <TD> 
            <div align="right">
              <? echo ltext("alst_cell_domains"); ?>
              </div>
          </TD>
          <TD>
             
            <?
 echo $domainliste;
?>
            </TD>
        </TR>
        <TR> 
          <TD> 
            <DIV align=right>
              <? echo ltext("alst_cell_du"); ?>
              </DIV>
          </TD>
          <TD <? if (($kbgesamt > $maxkb) && ($maxkb <> -1)) { echo "bgColor=".$fehlerfarbe; } ?>> 
            
            
            <? echo sinnv_kbwert($kbgesamt,ltext("g_nolimit"))." (".sinnv_kbwert($maxkb,ltext("g_nolimit")).")"; ?>
            </TD>
        </TR>
        <? if (($maxpop != 0) || ($pop != 0)) { ?>
        <TR> 
          <TD>
            <DIV align=right>
              <? echo ltext("alst_cell_pop3"); ?>
              </DIV>
          </TD>
          <TD <? if (($pop > $maxpop) && ($maxpop <> -1)) { echo "bgColor=".$fehlerfarbe; } ?>> 
            
            
            <? echo sinnv_intwert($pop,ltext("g_nolimit"))." (".sinnv_intwert($maxpop,ltext("g_nolimit")).")"; ?>
            </TD>
        </TR>
        <? }
if (($maxemail != 0) || ($email != 0)) { ?>
        <TR> 
          <TD>
            <DIV align=right>
              <? echo ltext("alst_cell_email"); ?>
              </DIV>
          </TD>
          <TD <? if (($email > $maxemail) && ($maxemail <> -1)) { echo "bgColor=".$fehlerfarbe; } ?>> 
            
            
            <? echo sinnv_intwert($email,ltext("g_nolimit"))." (".sinnv_intwert($maxemail,ltext("g_nolimit")).")"; ?>
            </TD>
        </TR>
        <? }
if (($maxautoresponder != 0) || ($autoresponder != 0)) { ?>
        <TR> 
          <TD>
            <DIV align=right>
              <? echo ltext("alst_cell_autoresponder"); ?>
              </DIV>
          </TD>
          <TD <? if (($autoresponder > $maxautoresponder) && ($maxautoresponder <> -1)) { echo "bgColor=".$fehlerfarbe; } ?>> 
            
            
            <? echo sinnv_intwert($autoresponder,ltext("g_nolimit"))." (".sinnv_intwert($maxautoresponder,ltext("g_nolimit")).")"; ?>
            </TD>
        </TR>
        <? }
if (($maxftp != 0) || ($ftp != 0)) { ?>
        <TR> 
          <TD>
            <div align="right">
              <? echo ltext("alst_cell_ftp"); ?>
              </div>
          </TD>
          <TD <? if (($ftp > $maxftp) && ($maxftp <> -1)) { echo "bgColor=".$fehlerfarbe; } ?>> 
            
            <? echo sinnv_intwert($ftp,ltext("g_nolimit"))." (".sinnv_intwert($maxftp,ltext("g_nolimit")).")"; ?>
            </TD>
        </TR>
        <? } ?>
        <TR> 
          <TD>
            <div align="right">
              <? echo ltext("alst_cell_traffic"); ?>
              <? echo "$monatstr $jahr"; ?>
              </div>
          </TD>
          <TD <? if (($gesamttransfer > $maxtransfer) && ($maxtransfer <> -1)) { echo "bgColor=".$fehlerfarbe; } ?>> 
            
            <? echo sinnv_kbwert($gesamttransfer,ltext("g_nolimit"))." (".sinnv_kbwert($maxtransfer,ltext("g_nolimit")).")"; ?>
            </TD>
        </TR>
        <? if (($maxsubdomains != 0) || ($subdomains != 0)) { ?>
        <TR> 
          <TD>
            <div align="right">
              <? echo ltext("alst_cell_subdomain"); ?>
              </div>
          </TD>
          <TD <? if (($subdomains > $maxsubdomains) && ($maxsubdomains <> -1)) { echo "bgColor=".$fehlerfarbe; } ?>> 
            
            <? echo sinnv_intwert($subdomains,ltext("g_nolimit"))." (".sinnv_intwert($maxsubdomains,ltext("g_nolimit")).")"; ?>
            </TD>
        </TR>
        <tr>
          <td>
            <div align="right">
              <? echo ltext("alst_cell_atdomains"); ?>
              </div>
          </td>
          <td <? if (($atdomains > $maxatdomains) && ($maxatdomains <> -1)) { echo "bgcolor=\"$fehlerfarbe\""; } ?>>
            <? echo sinnv_intwert($atdomains,ltext("g_nolimit"))." (".sinnv_intwert($maxatdomains,ltext("g_nolimit")).")"; ?></td>
        </tr>
        <? }
if (($maxmysql != 0) || ($mysql != 0)) { ?>
        <TR> 
          <TD>
            <div align="right">
              <? echo ltext("alst_cell_mysql"); ?>
              </div>
          </TD>
          <TD <? if (($mysql > $maxmysql) && ($maxmysql <> -1)) { echo "bgColor=".$fehlerfarbe; } ?>> 
            
            <? echo sinnv_intwert($anzahlmysql,ltext("g_nolimit"))." (".sinnv_intwert($maxmysql,ltext("g_nolimit")).")"; ?>
            </TD>
        </TR>
        <? } ?>

<? if($maxcronjobs != 0): ?>
        <TR> 
          <TD>
            <div align="right">
              <? echo ltext("alst_cell_cron"); ?>
              </div>
          </TD>
          <TD <? if (($anzahlcronjobs > $maxcronjobs) && ($maxcronjobs <> -1)) { echo "bgColor=".$fehlerfarbe; } ?>> 
            
            <? echo sinnv_intwert($anzahlcronjobs,ltext("g_nolimit"))." (".sinnv_intwert($maxcronjobs,ltext("g_nolimit")).")"; ?>
            </TD>
        </TR>
<? endif; ?>

<? if($maxmaillist != 0): ?>
        <TR> 
          <TD>
            <div align="right">
              <? echo ltext("alst_cell_maillist"); ?>
              </div>
          </TD>
          <TD <? if (($maillist > $maxmaillist) && ($maxmaillist <> -1)) { echo "bgColor=".$fehlerfarbe; } ?>> 
            
            <? echo sinnv_intwert($maillist,ltext("g_nolimit"))." (".sinnv_intwert($maxmaillist,ltext("g_nolimit")).")"; ?>
            </TD>
        </TR>
<? endif; ?>

<?
if ($shell == 1) { ?>
        <TR> 
          <TD>
            <div align="right">
              <? echo ltext("alst_cell_shell"); ?>
              </div>
          </TD>
          <TD>
            <? echo ltext("alst_cell_shell_active"); ?>
            </TD>
        </TR>
        <? } ?>
        <? if (strlen($features) > 0) { ?>
        <TR> 
          <TD>
            <div align="right">
              <? echo ltext("alst_cell_features"); ?>
              </div>
          </TD>
          <TD>
            <? echo $features; ?>
            </TD>
        </TR>
<? } if ($dirlist > 0) { ?>
        <tr> 
          <td  align="right">
            <? echo ltext("alst_cell_dirlist"); ?>
            </td>
          <td>
            <? if ($dirlist == 1) { echo ltext("alst_deactivated"); } else { echo ltext("alst_activated"); } ?>
            <a class=data href="allgemein_dirlistchange.php">
            <? echo ltext("alst_cell_link1"); ?>
            </a></td>
        </tr>
<? } if ($perl > 0) { ?>
        <tr> 
          <td align="right">
            <? echo ltext("alst_cell_cgiperl"); ?>
            </td>
          <td>
            <? if ($perl == 1) { echo ltext("alst_deactivated"); } else { echo ltext("alst_activated"); } ?>
            <a class=data href="allgemein_cgichange.php">
            <? echo ltext("alst_cell_link1"); ?>
            </a></td>
        </tr>
	<? } ?>
      <tr><td colspan=2><? echo ltext("alst_descr2"); ?></td></tr> 
      </TABLE>
    </TD>
  </TR>
</TABLE>
</BODY>
</HTML>
<?
db_close();
?>
