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

include_once("auth.php");

if ($loeschen <> "ja")
	{
	 $fehlertext = ltext("anaelo2_error1",array($anbieter));
	 $fehlertitel = ltext("anaelo2_errortitle");
	 include("anbieter_aendern.php");
	 exit();

  } else {

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

##schauen ob anbieter kunden hat
$id = db_query("select kunde from kunden where anbieter='$anbieter'");
$zeilen = db_num_rows($id);
if ($zeilen > 0)
{
 db_close();
 $fehlertext = ltext("anaelo2_error2",array($zeilen));
 include("anbieter_aendern.php");
 exit();
}
##/schauen ob anbieter kunden hat

## wie veile ips werden wieder freigegeben?
$id = db_query("select ip from ipadressen where anbieter='$anbieter'");
$zeilen = db_num_rows($id);
## /wie veile ips werden wieder freigegeben?

db_query("delete from anbieter where anbieter='$anbieter'");
db_query("delete from angebote where anbieter='$anbieter'");

db_query("delete from skins where cuser='$anbieter'");

$res_skins = db_query("select * from custom_skins where owner_type='reseller' and anbieter='$anbieter'");
while ($row_skins = db_fetch_array($res_skins)) {
	global $sbindir;
	$skin_id = $row_skins['id'];
	exec("$sbindir/skinmng.pl --skin skin_$skin_id --del_skin", $out, $ret);
	if ($ret != 0) {
		echo "<p><b>Error:</b> failed execution of skinmng.pl:<pre>" .implode("\n", $out) . "</pre></p>";
	}
}
db_query("delete from custom_skins where owner_type='reseller' and anbieter='$anbieter'");

db_query("update transfer set anbieter='geloesch' where anbieter='$anbieter'");
db_query("update ipadressen set anbieter='' where anbieter='$anbieter'");
db_query("update ereignisse set geloescht='1' where anbieter='$anbieter'");

$fehlertext = ltext("anaelo2_error3",array($anbieter));
$fehlertitel = ltext("anaelo2_errortitle");
db_close();
include("anbieter_aendern.php");

	}
?>
