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

include_once( "auth.php" );
include_once( "../include/class.SQLFieldSet.php" );
include_once( "../include/class.SQLInteger.php" );

global $DEBUG;
//$DEBUG=1;

$req = "ja";

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

if (istleer($speicherplatz)) { $speicherplatz = 0; }
if (istleer($maxkb)) { $maxkb = 0; }
if (istleer($maxpop)) { $maxpop = 0; }
if (istleer($maxemail)) { $maxemail = 0; }
if (istleer($maxautoresponder)) { $maxautoresponder = 0; }
if (istleer($maxftp)) { $maxftp = 0; }
if (istleer($maxtransfer)) { $maxtransfer = 0; }
if (istleer($maxsubdomains)) { $maxsubdomains = 0; }
if (istleer($maxmysql)) { $maxmysql = 0; }
if (istleer($maxcronjobs)) { $maxcronjobs = 0; }
if (istleer($maxmaillist)) { $maxmaillist = 0; }


if (!ereg("^(0|-?[1-9][0-9]*)$",$maxkb)) 
 {
  $fehlertext = ltext("anne2_error1");
  db_close();
  include("angebote_neu.php");
  exit();
 }
## /muss...

if (istleer($name))
 {
  $fehlertext = ltext("anne2_error2");
  db_close();
  include("angebote_neu.php");
  exit();
 }

## MB/GB in KB bei "max. Speicherplatz vom Anbieter" umwandeln
if (($maxkb <> -1) && ($kbtyp == "MB"))
	{
	 $maxkb2 = $maxkb * 1024;
	}
else 
	{
	 $maxkb2 = $maxkb;
	}
## /MB/GB in KB bei "max. Speicherplatz vom Anbieter" umwandeln

if ((($maxkb2 < 1) && ($maxkb2 <> -1)) || ($maxkb2 > 2147283647) || ($maxkb2 < -1))
 {
  $fehlertext = ltext("anne2_error3");
  db_close();
  include("angebote_neu.php");
  exit();
 }

if (($maxpop > 8388607) || ($maxpop < -1) || (!ereg("^(0|-?[1-9][0-9]*)$",$maxpop)))
 {
  $fehlertext = ltext("anne2_error4");
  db_close();
  include("angebote_neu.php");
  exit();
 }

if (($maxemail > 8388607) || ($maxemail < -1) || (!ereg("^(0|-?[1-9][0-9]*)$",$maxemail)))
 {
  $fehlertext = ltext("anne2_error5");
  db_close();
  include("angebote_neu.php");
  exit();
 }

# wenn email < pop dann fehler
if ((($maxemail < $maxpop) && ($maxpop > 0) && ($maxemail <> -1)) || (($maxpop == -1) && ($maxemail <> -1)))
 {
  $fehlertext = ltext("anne2_error6");;
  db_close();
  include("angebote_neu.php");
  exit();
 }
# /wenn email < pop dann fehler

if (($maxautoresponder > 8388607) || ($maxautoresponder < -1) || (!ereg("^(0|-?[1-9][0-9]*)$",$maxautoresponder)))
 {
  $fehlertext = ltext("anne2_error7");
  db_close();
  include("angebote_neu.php");
  exit();
 }

# wenn email < autoresponder dann fehler
if ((($maxemail < $maxautoresponder) && ($maxautoresponder > 0) && ($maxemail <> -1)) || (($maxautoresponder == -1) && ($maxemail <> -1)))
 {
  $fehlertext = ltext("anne2_error8");
  db_close();
  include("angebote_neu.php");
  exit();
 }
# /wenn email < pop dann fehler


if (($maxftp > 8388607) || ($maxftp < -1) || (!ereg("^(0|-?[1-9][0-9]*)$",$maxftp)))
 {
  $fehlertext = ltext("anne2_error9");
  db_close();
  include("angebote_neu.php");
  exit();
 }

if (($ftp == 0) && ($maxftp != 0))
	{
	 $fehlertext = ltext("anne2_error10");
	 db_close();
	 include("angebote_neu.php");
	 exit();
	}

if (($maxtransfer < -1) || (!ereg("^(0|-?[1-9][0-9]*)$",$maxtransfer)))
 {
  $fehlertext = ltext("anne2_error11");
  db_close();
  include("angebote_neu.php");
  exit();
 }

## MB/GB in KB bei "max. transfer vom Anbieter" umwandeln
if ($maxtransfer <> -1) {
$maxtransfer2 = $maxtransfer * 1024; }
else { $maxtransfer2 = $maxtransfer; }
## /MB/GB in KB bei "max. transfer vom Anbieter" umwandeln

if ($maxtransfer2 > 2147283647)
 {
  $fehlertext = ltext("anne2_error12");
  db_close();
  include("angebote_neu.php");
  exit();
 }

if (($maxsubdomains > 8388607) || ($maxsubdomains < -1) || (!ereg("^(0|-?[1-9][0-9]*)$",$maxsubdomains)))
 {
  $fehlertext = ltext("anne2_error13");
  db_close();
  include("angebote_neu.php");
  exit();
 }

if (($maxmysql > 32767) || ($maxmysql < -1) || (!ereg("^(0|-?[1-9][0-9]*)$",$maxmysql)))
 {
  $fehlertext = ltext("anne2_error14");
  db_close();
  include("angebote_neu.php");
  exit();
 }

if (($wildcard > $maxsubdomains) && ($maxsubdomains != -1)) {
  $fehlertext = ltext("anne2_error15");
  db_close();
  include("angebote_neu.php");
  exit();
}

if (($frontpage == 1) && ($fehlerseiten == 1))
{
	$fehlertext = ltext("anne2_error23");
	db_close();
	include("angebote_neu.php");
	exit();
}

if (($frontpage == 1) && ($pwschutz == 1))
{
	$fehlertext = ltext("anne2_error24");
	db_close();
	include("angebote_neu.php");
	exit();	 
}
	
if (isset($shell)){
  if ($shell==2){
    $shell=0;
    $scponly=1;
  }else{
    $scponly=0;
  }
}else{
  $shell=0;
  $scponly=0;
}

if (($shell == 1) && ($ftp == 0)){
  $fehlertext = ltext("anne2_error16");
  db_close();
  include("angebote_neu.php");
  exit();
}


if (($stdcgi == 1) && ($perl != 1))
	{
	 $fehlertext = ltext("anne2_error17");
	 db_close();
	 include("angebote_neu.php");
	 exit();
	}

if (($maxcronjobs > 32767) || ($maxcronjobs < -1) || (!ereg("^(0|-?[1-9][0-9]*)$",$maxcronjobs)))
 {
  $fehlertext = ltext("anne2_error20");
  db_close();
  include("angebote_neu.php");
  exit();
 }	

if (($maxmaillist < -1) || (!ereg("^(0|-?[1-9][0-9]*)$",$maxmaillist)))
 {
  $fehlertext = ltext("anne2_error22");
  db_close();
  include("angebote_neu.php");
  exit();
 }	

if(!$spamfilter)
  $spamfilter='0';
if(!$dirlist)
  $dirlist='0';
if(!$coldfusion)
  $coldfusion='0';
if(!$wildcard)
  $wildcard='0';
if(!$atdomains)
  $atdomains='0';

$loFields = new SQLFieldSet( array( 'name' => array( $name, 'C' ),
																		'maxpop' => $maxpop,
																		'maxkb' => $maxkb2,
																		'maxmysql' => $maxmysql,
																		'maxemail' => $maxemail,
																		'maxautoresponder' => $maxautoresponder,
																		'maxftp' => $maxftp,
																		'maxtransfer' => $maxtransfer2,
																		'maxsubdomains' =>	$maxsubdomains,
																		'maxcronjobs' => $maxcronjobs,
																		'php' => $php,
																		'ftp' => $ftp,
																		'wildcard' => $wildcard,
																		'maxatdomains' => $atdomains,
																		'perl' => $perl,
																		'modpython' => $modpython,
																		'ssi' => $ssi,
																		'shell' => $shell,
																		'scponly' => $scponly,	
																		'statistik' => $statistik,
																		'pwschutz' => $pwschutz,
																		'fehlerseiten' => $fehlerseiten,
																		'webftp' => $webftp,
																		'webmail' => $webmail,
																		'stdcgi' => $stdcgi,
																		'phpupload' => $phpupload,
																		'wap' => $wap,
																		'frontpage' => $frontpage,  
																		'coldfusion' => $coldfusion,
																		'dirlist' => $dirlist,
																		'spamfilter' => $spamfilter,
																		'maxidn' => -1,
																		'maxmaillist' => $maxmaillist
																		)
														 );
	
## /Eingabevariablen auf Typengültigkeit überprüfen

if ( is_numeric( $ident ) ) {
  $sql="UPDATE angebote SET ".$loFields->getSQLUpdate()." WHERE ident = ? AND anbieter = ?";

  safe_query2( $sql, new SQLInteger($ident), new SQLString($PHP_AUTH_USER));

  $fehlertitel = ltext("anne2_errortitle");
  $fehlertext = ltext("anne2_error18",array($name));

} else {
	$loFields->addField( 'anbieter', $PHP_AUTH_USER, 'C' );
	list( $lcFlds, $lcVals ) = $loFields->getSQLInsert();
	$sql = "INSERT INTO angebote ($lcFlds) VALUES ($lcVals)";
	
	db_query($sql);

	$fehlertitel = ltext("anne2_errortitle");
	$fehlertext = ltext("anne2_error18",array(StripSlashes($name)));
}
db_close();
include("angebote_start.php");
exit();
?>
