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

include_once( "../include/class.SQLString.php" );
include_once("auth.php");

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

$id = safe_query( "select frontpage, cssl, maxmysql from anbieter where anbieter = ? ", TRUE, new SQLString( $PHP_AUTH_USER ) );
$werte = db_fetch_array($id);
$skfrontpage = $werte["frontpage"];
$skssl = $werte["cssl"];
$maxmysql = $werte["maxmysql"];
if ($maxmysql != 0) $skmysql = 1;

if ($skssl < 1)
	{
	 $fehlertext = ltext("kuss_error1");
	 db_close();
	 include("kunden_start.php");
	 exit();
	}

## kundendaten in array
$id = safe_query( "select kunde from ipadressen where anbieter = ? ", TRUE, new SQLString( $PHP_AUTH_USER ) );

while ($werte = db_fetch_array($id))
	{
	 $kunde = $werte["kunde"];
	 if (!istleer($kunde))
		{
		 $id3 = safe_query( "select name from kunden where kunde = ?  and anbieter = ? ", TRUE, new SQLString( $kunde ), new SQLString( $PHP_AUTH_USER ) );
		 $werte3 = db_fetch_array($id3);
		 $name = $werte3["name"];

		 if (istleer($name))
			{
			 $name = "".ltext("kuaeku_nousername")."";
			}
		 $id2 = safe_query( "select domain from domains where kunde = ?  and richtigedomain=1 and anbieter = ?  order by domain", TRUE, new SQLString( $kunde ), new SQLString( $PHP_AUTH_USER ) );
		 $domains = "";
		 while ($werte2 = db_fetch_array($id2))
			{
			 if (!istleer($werte2["domain"]))
				{
				 $domains .= $werte2["domain"] . "<br>";
				}
			}
		 if (istleer($domains))
			{
			 $domains = "".ltext("kuaeku_nodomain")."";
			}

		 $id4 = safe_query( "select crt, privatekey from cssl where kunde = ?  and anbieter = ?  and loeschen = 0", TRUE, new SQLString( $kunde ), new SQLString( $PHP_AUTH_USER ) );
		 $werte4 = db_fetch_array($id4);
		 if ((!istleer($werte4["crt"])) && (!istleer($werte4["privatekey"]))) $linktext = ltext("kuss_link_edit"); else $linktext = ltext("kuss_link_new");

		 $tabelle[] = array("kunde" => $kunde, "name" => $name, "domains" => $domains, "linktext" => $linktext);
		}
	}

## /kundendaten in array
?>
<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">

<script>
<?
echo js_f_call_help('kuss_descr1', 'kuss_descr2');
?>
</script>

      <? 
if (count($tabelle) > 0)
	{
?>
        <tr > 
          <td  height="15" class="titel-3" >
            <? echo ltext("kuss_cell_user"); ?>
            </td>
          <td  align="left" valign="middle" height="15" class="titel-3" >
            <? echo ltext("kuss_cell_name"); ?>
            </td>
          <td  align="left" valign="middle" height="15" class="titel-3" >
            <? echo ltext("kuss_cell_domains"); ?>
            </td>
          <td  align="left" valign="middle" height="15" class="titel-3" >
            <? echo ltext("kuss_cell_action"); ?>
            </td>
        </tr>
        <?
	for ($i = 0; $i < (count($tabelle)); $i++)
		{
		 $kunde = $tabelle[$i]["kunde"];
		 $name = $tabelle[$i]["name"];
		 $domains = $tabelle[$i]["domains"];
		 $linktext = $tabelle[$i]["linktext"];
?>
        <tr > 
          <td  height="15">
            <? echo $kunde; ?>
            </td>
          <td  align="left" valign="middle" height="15">
            <? echo $name; ?>
            </td>
          <td  align="left" valign="middle" height="15">
            <? echo $domains; ?>
            </td>
          <td  align="left" valign="middle" height="15"><a class=data href="kunden_ssl_erstellen.php?kunde=<? echo $kunde; ?>">
            <? echo $linktext; ?>
            </a></td>
        </tr>
        <?
		}
?>
      <? } else { echo "<tr><td>".ltext("kuss_nouserwithip")."</td></tr>"; }
?>
</table>
</BODY>
</HTML>
<?
db_close();
?>
