<?
########## 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 (!checkPopLogin($PHP_AUTH_USER, $altpw))
	{ 
	 $fehlertext = ltext("pop_alpw2_error1");
	 include("allgemein_pwaendern.php"); 
	 exit();
	}
if ($neupw1 != $neupw2)
	{
	 $fehlertext = ltext("pop_alpw2_error3");
	 include("allgemein_pwaendern.php");
	 exit();
	}
if (!valid_pw($neupw1))
	{
	 $fehlertext = ltext("pop_alpw2_error4");
	 include("allgemein_pwaendern.php");
	 exit();
	}
$neupw = crypt_pw($neupw1);
db_connect($db_host, $db_user, $db_pass);
setUserParam($PHP_AUTH_USER, 'password', $neupw1);
setUserParam($PHP_AUTH_USER, 'old_password', $altpw);
safe_query2( "UPDATE pop3 SET longpw = '$neupw' where account = ?", new SQLString($PHP_AUTH_USER));
db_query("update allgemein set newpwd=1");
db_close();
$fehlertitel = ltext("pop_alpw2_errortitle");
$fehlertext = ltext("pop_alpw2_error5");
header("Location: ./allgemein_pwaendern.php?fehlertext=".urlencode($fehlertext)."&fehlertitel=".urlencode($fehlertitel));
?>
