<?
########## 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 ($skfrontpage < 1)
	{
	 $fehlertext = ltext("kufr_error1");
	 db_close();
	 include("kunden_start.php");
	 exit();
	}

$founduser = 0;

if (isset($searchfp)) {
    $id = safe_query( "select kunde from kunden where kunde = ?  and anbieter = ? ", TRUE, new SQLString( $kunde ), new SQLString( $PHP_AUTH_USER ) );
    if (db_num_rows($id) > 0) {
        $founduser = 1;
    } else {
		 $fehlertext = ltext("kufr_error2");
		 $fehlertitel = ltext("kufr_errortitle1");
    }
}

# get number of users
$id = safe_query( "select kunde from kunden where anbieter = ? ", TRUE, new SQLString( $PHP_AUTH_USER ) );
$numberofusers = db_num_rows($id);

?>

<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();
}
<?
echo js_f_call_help('kufr_title1', 'kufr_descr1');
?>
</script>
<table class="tblbgcolor" align="left" border="1" cellpadding="3" cellspacing="0" bordercolorlight="#CCCCCC" bordercolordark="#FFFFFF">
<?
if ($founduser == 0) {
	?>
	<form method="post" action="kunden_frontpage.php">
          <tr >
            <td  colspan="2" align="left"><b><? echo ltext("kufr_cell_title1"); ?></b></td>
          </tr>
          <tr >
            <td >
              <input type="text" name="kunde">
            </td>
            <td  align="left" valign="middle"><? echo ltext("kufr_cell_keys"); ?></td>
          </tr>
          <tr > 
            <td >&nbsp; </td>
            <td  align="left" valign="middle"> 
			<input type="hidden" name="searchfp" value="1">
			<? echo std_button(ltext("kufr_button1"), "javascript:doChange()"); ?></td>
          </tr>
<? } ?>
<tr><td colspan=3>
<a class=data href="kunden_frontpage_list.php"><? echo ltext("kufr_list"); ?> (<? echo $numberofusers; ?>)</a></td></tr>
<?
if ($founduser == 1) {
$id = safe_query( "select kunde, name from kunden where kunde = ?  and anbieter = ? ", TRUE, new SQLString( $kunde ), new SQLString( $PHP_AUTH_USER ) );
?>

        <tr >
          <td class="titel-3" >
      
            <? echo ltext("kufr_cell_user"); ?>
            </td>
          <td class="titel-3" >
      
            <? echo ltext("kufr_cell_name"); ?>
            </td>
          <td class="titel-3" >
      
            <? echo ltext("kufr_cell_action"); ?>
            </td>
        </tr>
        <?
$werte = db_fetch_array($id);

                 $kunde = $werte["kunde"];
                 $name = $werte["name"];

                 if (istleer($name))
                        {
                         $name = "".ltext("kufr_unknownname")."";
                        }

$id2 = safe_query( "select domain from domains where kunde = ?  and richtigedomain='3' and frontpage='1' and anbieter = ? ", TRUE, new SQLString( $kunde ), new SQLString( $PHP_AUTH_USER ) );
if (db_num_rows($id2) > 0) { $frontpage = 1; } else { $frontpage = 0; }
?>
        <tr >
          <td  height="15">
            <? echo $kunde; ?>
            </td>
          <td  align="left" valign="middle" height="15">
            <? echo $name; ?>
            </td>
          <td  align="left" valign="middle" height="15"><a class=data href="kunden_frontpage_upd.php?kunde=<? echo $kunde; ?>">
            <? if ($frontpage == 1) { echo "<b>".ltext("kufr_fpdeact")."</b>"; } else { echo "<b>".ltext("kufr_fpact")."</b>"; } ?>
            </a></td>
        </tr>
<? } ?>
</TABLE>
</form>
</BODY>
</HTML>
<?
db_close();
?>
