<?
########## 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");

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

$id = safe_query( "select * from admin", TRUE );
$werte = db_fetch_array($id);
$skmysql = $werte["mysql"];
$quota = $werte["quota"];


$id = safe_query( "select kunde from kunden where kunde = ? ", TRUE, new SQLString( $kunde ) );
$zeilen = db_num_rows($id);
if ($zeilen <> 1)
	{
	 $kunde2 = strtolower($kunde);
	 $id = safe_query( "SELECT domain, kunde, anbieter FROM domains WHERE domain LIKE ? AND richtigedomain = 1", TRUE,
			 new SQLString("%$kunde2%") );
	 $id3 = safe_query( "SELECT kunde FROM kunden WHERE LOWER(name) LIKE ?", TRUE, new SQLString("%$kunde2%") );
	 if ((db_num_rows($id) + db_num_rows($id3)) < 1)
		{
		 $fehlertext = ltext("eihtkusu_error1");
		 include("einstellungen_httpd_kunde.php");
		 exit();
		}
	 if ((db_num_rows($id) == 1) && (db_num_rows($id3) == 0))
		{
		 $daten = db_fetch_array($id);
		 $kunde = $daten["kunde"];
		 include("einstellungen_httpd_kunde_aendern.php");
		 exit();
		}
	 if ((db_num_rows($id3) == 1) && (db_num_rows($id) == 0))
		{
		 $daten = db_fetch_array($id3);
		 $kunde = $daten["kunde"];
		 include("einstellungen_httpd_kunde_aendern.php");
		 exit();
		}
	 if ((db_num_rows($id) + db_num_rows($id3)) > 1)
		{
		 while ($daten = db_fetch_array($id))
			{
			 $kunde = $daten["kunde"];
			 $einfuegen = "ja";
			 for ($n = 0; $n < count($ergebnis); $n++)
				{
				 if ($ergebnis[$n] == $kunde) $einfuegen = "nein";
				}
			 if ($einfuegen == "ja") $ergebnis[] = $kunde;
			}
		 while ($daten = db_fetch_array($id3))
			{
			 $kunde = $daten["kunde"];
			 $einfuegen = "ja";
			 for ($n = 0; $n < count($ergebnis); $n++)
				{
				 if ($ergebnis[$n] == $kunde) $einfuegen = "nein";
				}
			 if ($einfuegen == "ja") $ergebnis[] = $kunde;
			}
		}
	} else
	{
	 include("einstellungen_httpd_kunde_aendern.php");
	 exit();
	}


## kundendaten in array

for ($i = 0; $i < count($ergebnis); $i++)
	{
	 $kunde = $ergebnis[$i];
	 $id = safe_query( "select name, anbieter from kunden where kunde = ? ", TRUE, new SQLString( $kunde ) );
	 $werte = db_fetch_array($id);
	 $name = $werte["name"];
	 $anbieter = $werte["anbieter"];
	 if (istleer($name))
		{
		 $name = "<font color=#666666>".ltext("eihtkusu_noname")."";
		}
	 $id2 = safe_query( "select domain from domains where kunde = ?  and richtigedomain=1", TRUE, new SQLString( $kunde ) );
	 $domains = "";
	 while ($werte2 = db_fetch_array($id2))
		{
		 if (!istleer($werte2["domain"]))
			{
			 $domains .= $werte2["domain"] . "<br>";
			}
		}
	 if (istleer($domains))
		{
		 $domains = "<font color=#666666>".ltext("eihtkusu_nodomain")."";
		}
	 $tabelle[] = array("kunde" => $kunde, "name" => $name, "domains" => $domains, "anbieter" => $anbieter);
	}

## /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('', 'eihtkusu_title1');
?>
</script>
        <tr >
          <td  height="15" class="titel-3" >
            <? echo ltext("eihtkusu_cell_user"); ?>
            </td>
          <td  align="left" valign="middle" height="15" class="titel-3" >
            <? echo ltext("eihtkusu_cell_name"); ?>
            </td>
          <td  align="left" valign="middle" height="15" class="titel-3" >
            <? echo ltext("eihtkusu_cell_domains"); ?>
            </td>
          <td  align="left" valign="middle" height="15" class="titel-3" >
            <? echo ltext("eihtkusu_cell_reseller"); ?>
            </td>
          <td  align="left" valign="middle" height="15" class="titel-3" >
            <? echo ltext("eihtkusu_cell_select"); ?>
            </td>
        </tr>
        <?
	for ($i = 0; $i < (count($tabelle)); $i++)
		{
		 $kunde = $tabelle[$i]["kunde"];
		 $name = $tabelle[$i]["name"];
		 $domains = $tabelle[$i]["domains"];
		 $anbieter = $tabelle[$i]["anbieter"];
?>
        <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">
            <? echo $anbieter; ?>
            </td>
          <td  align="left" valign="middle" height="15"><a class=data href="einstellungen_httpd_kunde_aendern.php?kunde=<? echo $kunde; ?>">
            <? echo ltext("eihtkusu_cell_select"); ?>
            </a></td>
        </tr>
        <?
		}
?>
</table>
</BODY>
</HTML>
<?
db_close();
?>
