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

if ((ereg("[^A-Za-z0-9 ]", $login)) || (strlen($login) > 35))	{
	$fehlertext = ltext("topwnb_error1");
	include("tools_pwschutz_aendern.php");
	exit();
								}

if (!valid_pw($pass1))	{
	$fehlertext = ltext("topwnb_error2");
	include("tools_pwschutz_aendern.php");
	exit();
											}

if ($pass1 != $pass2)	{
	$fehlertext = ltext("topwnb_error3");
	include("tools_pwschutz_aendern.php");
	exit();
			}

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

## prüfen, ob benutzer schon da
$id = safe_query( "select * from users where kunde = ?  and parent = ?  and login = ? ", TRUE, new SQLString( $PHP_AUTH_USER ), new SQLInteger( $ident ), new SQLString( $login ) );
if (db_num_rows($id) > 0)	{
	$fehlertext = ltext("topwnb_error4");
	db_close();
	include("tools_pwschutz_aendern.php");
	exit();
				}
## //

$pass = crypt_pw($pass1);
safe_query( "insert into users (login, pass, longpw, kunde, parent) VALUES (  ? ,  '',  ? ,  ? ,  ?  )", TRUE, new SQLString( $login ), new SQLString( $pass ), new SQLString( $PHP_AUTH_USER ), new SQLInteger( $ident ) );
$id = safe_query( "select * from htaccess where pfad = ?  and kunde = ? ", TRUE, new SQLString( $pfad ), new SQLString( $PHP_AUTH_USER ) );
if (db_num_rows($id) < 1)	{
safe_query( "insert into htaccess (pfad, kunde) VALUES (  ? ,  ?  )", TRUE, new SQLString( $pfad ), new SQLString( $PHP_AUTH_USER ) );
				}

safe_query( "update allgemein set htaccess='1'", TRUE );
db_close();

$fehlertitel = ltext("topwnb_errortitle");
$fehlertext = ltext("topwnb_error5");
include("tools_pwschutz_aendern.php");
exit();
?>
