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


# existiert die domain und geh&ouml;rt dem user?
$id = safe_query( "select domain from domains where kunde = ?  and domain = ? ", TRUE, new SQLString( $PHP_AUTH_USER ), new SQLString( $domain ) );
if (db_num_rows($id) < 1)
	{
	 $fehlertext = ltext("todolo_error1");
	 db_close();
	 include("tools_domains.php");
	 exit();
	}
# /existiert die domain und geh&ouml;rt dem user?


# sind emails mit der subdomain angelegt worden?
$id = safe_query( "select domain from email where domain = ?  and kunde = ? ", TRUE, new SQLString( $domain ), new SQLString( $PHP_AUTH_USER ) );
$anzahlemails = db_num_rows($id);
if ($anzahlemails > 0)
	{
	 $fehlertext = ltext("todolo_error2");
	 db_close();
	 include("tools_domains.php");
	 exit();
	}
# /sind emails mit der subdomain angelegt worden?

domain_aendern($domain, "loeschen", $PHP_AUTH_USER);
fpalias_aendern($domain, "loeschen", $PHP_AUTH_USER);
safe_query( "delete from domains where domain = ?  and kunde = ?  and richtigedomain='0' and cssl='0' and frontpage='0'", TRUE, new SQLString($domain), new SQLString($PHP_AUTH_USER) );

$id = safe_query( "select anbieter from kunden where kunde = ? ", TRUE, new SQLString( $PHP_AUTH_USER ) );
$werte = db_fetch_array($id);
$anbieter = $werte["anbieter"];

safe_query( "update allgemein set httpd='1'", TRUE );
safe_query( "update kunden set changedomains='1' where kunde = ? ", TRUE, new SQLString( $PHP_AUTH_USER ) );

set_countdomains($PHP_AUTH_USER);

$fehlertext = ltext("todolo_error4",array($domain));
$fehlertitel = ltext("todolo_error5");
db_close();
include("tools_domains.php");

?>
