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

## können noch kunden angelegt werden?
$id = safe_query( "select count(kunde) as anzahlkunden from kunden where anbieter = ? ", TRUE, new SQLString( $PHP_AUTH_USER ) );
$werte = db_fetch_array($id);
$anzahlkunden = $werte["anzahlkunden"];
$id = safe_query( "select maxkunden, maxkundenlimit from anbieter where anbieter = ? ", TRUE, new SQLString( $PHP_AUTH_USER ) );
$werte = db_fetch_array($id);
$maxkunden = $werte["maxkunden"];
$maxkundenlimit = $werte["maxkundenlimit"];
if (($maxkunden <> "-1") && ($anzahlkunden >= $maxkunden))
	{
	 $fehlertext = ltext("kune1_error1",array($anzahlkunden,$maxkunden));
	 if ($maxkundenlimit == 0)
		{
		 $fehlertext .= ltext("kune1_error2");
		 $fehlertitel = ltext("kune1_errortitle");
		}
	}
## /können noch kunden angelegt werden?

## angebote holen
$angebotsid = safe_query( "select name, ident from angebote where anbieter = ? ", TRUE, new SQLString( $PHP_AUTH_USER ) );
## /angebote holen

?>

<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>
      <? if (($maxkundenlimit == "0") || ($anzahlkunden < $maxkunden) || ($maxkunden == "-1")) { ?>
      <form method="post" action="kunden_neu2.php">
            <td class="titel-3" >
              <? echo ltext("kune1_cell_description"); ?>
              </td>
            <td class="titel-3" >
              <? echo ltext("kune1_cell_input"); ?>
              </td>
          </tr>
          <tr > 
            <td>
              <? echo ltext("kune1_cell_seltemplate"); ?>
              </td>
            <td> 
              <select name="ident">
                <option value="standard">
                <? echo ltext("kune1_select_value1"); ?>
                </option>
                <?
while ($werte = db_fetch_array($angebotsid))
	{
	 $name = $werte["name"];
	 $ident = $werte["ident"];
	 echo "<option value=\"$ident\">$name</option>\n";
	}
?>
              </select>
            </td>
          </tr>
          <tr > 
            <td >&nbsp;</td>
            <td><? echo std_button(ltext("kune1_button1"), "javascript:doChange()"); ?></td>
        <? if (!istleer($kunde)) { ?>
        <input type="hidden" name="updaten" value="ja">
        <input type="hidden" name="kunde" value="<? echo $kunde; ?>">
        <? } ?>
      </form>
      <? } ?>
</tr>
</TABLE>
</BODY>
</HTML>

<?
db_close();
?>
