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

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

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

## E-Mail loeschen
$id = safe_query( "select * from email where ident = ?  and kunde = ?  and neu = 0", TRUE, new SQLInteger( $ident ), new SQLString( $PHP_AUTH_USER ) );
if (db_num_rows($id) > 0)
	{
	 $werte = db_fetch_array($id);
	 $account = $werte["prefix"];
	 $domain = $werte["domain"];
	 $pop3 = $werte["pop3"];
	 $pfad = $werte["domain"];
	 $alias = $account."@".$domain;
	}
safe_query( "delete from email where ident = ?  and kunde = ? ", TRUE, new SQLInteger($ident), new SQLString($PHP_AUTH_USER) );
safe_query( "delete from autoresponder where ident = ?  and kunde = ? ", TRUE, new SQLInteger($ident), new SQLString($PHP_AUTH_USER) );

safe_query( "insert into delaccs (account, pfad, kunde, type) values (  ? ,  ? ,  ? ,  'alias' )", TRUE, new SQLString( $account ), new SQLString( $domain ), new SQLString( $PHP_AUTH_USER ) );

safe_query( "delete from webmail_sign where alias = ? ", TRUE, new SQLString($alias) );

$id = safe_query( "select account from pop3 where account = ? ", TRUE, new SQLString( $pop3 ) );
if (db_num_rows($id) == 1)
	{
	 $timestamp = time();
	 safe_query( "update pop3 set lastchange = ?  where kunde = ?  and account = ? ", TRUE, new SQLInteger( $timestamp ), new SQLString( $PHP_AUTH_USER ), new SQLString( $pop3 ) );
	}

$id = safe_query( "select kunde from email where kunde = ? ", TRUE, new SQLString( $PHP_AUTH_USER ) );
if (db_num_rows($id) < 1)
	{
	 safe_query( "update kunden set hatalias = 0 where kunde = ? ", TRUE, new SQLString( $PHP_AUTH_USER ) );
	}

safe_query( "update allgemein set aliases='1'", TRUE );
$fehlertitel = ltext("ememlo_error1");
$fehlertext = ltext("ememlo_error2");
db_close();
include("email_email.php");
exit();
## //
?>
