<?
########## 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");

if ($neupw1 != $neupw2)
	{
	 $fehlertext = ltext("kuaepw2_error2");
	 include("kunden_aendern_pw.php");
	 exit();
	}
if (!valid_pw($neupw1))
	{
	 $fehlertext = ltext("kuaepw2_error3");
	 include("kunden_aendern_pw.php");
	 exit();
	}
$neupw = crypt_pw($neupw1);
db_connect($db_host, $db_user, $db_pass);

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

if($statistik){
	safe_query( "update kunden set longpw = ? , pw=1, statistiklongpw = ?  where kunde = ? and anbieter = ? ",
		 TRUE, new SQLString( $neupw ), new SQLString( $neupw ), new SQLString( $kunde ), new SQLString( $PHP_AUTH_USER ) );
	safe_query( "update allgemein set webalizerpw='1', newpwd='1'", TRUE );
}else{
	safe_query( "update kunden set longpw = ? , pw='1' where kunde = ?  and anbieter = ? ", 
		TRUE, new SQLString( $neupw ), new SQLString( $kunde ), new SQLString( $PHP_AUTH_USER ) );
	safe_query( "update allgemein set newpwd='1'", TRUE );
}	
$fehlertitel = "Hinweis:";
$fehlertext = ltext("kuaepw2_error4",array($kunde));
db_close();
include("kunden_aendern.php");
exit();
?>
