Location: PHPKode > projects > Lite Outbound Manager > outbound/user_reg.php
<?php
		
	$usr_file = file_get_contents("data/users.xml");

	$xml = new SimpleXMLElement($usr_file);

	
	function insertNewUser ($login, $password, $ver_password, $users_xml){
		
		//controllo se la login esiste
		$login_exists = $users_xml->xpath("/users/user/login[.='".$login."']");
		if(!empty($login_exists[0]))
			return "error: ".$login." login already exists";
		
		if($password <> $ver_password)
			return 'error: password and confirm password don\'t match';
			
		//controlli ok, scrivo il nuovo utente sul file!
		$user = $users_xml->addChild('user');
		$user->addChild('login', strtolower($login));
		$user->addChild('password', crypt($password));
		
		if(file_put_contents("data/users.xml", $users_xml->asXML()))
			return "New User ".$login." ADDED SUCCESSFULLY";
		else return "error: cannot access users.xml";	
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>New user registration</title>
</head>

<body>
<?php 
$login = get_magic_quotes_gpc() ? addslashes($_POST['login']) : $_POST['login'];
//$password = get_magic_quotes_gpc() ? addslashes($_POST['password']) : $_POST['password'];
$password = $_POST['password']; 
$ver_password = get_magic_quotes_gpc() ? addslashes($_POST['ver_password']) : $_POST['ver_password'];

echo insertNewUser($login, $password, $ver_password, $xml); ?>
<p> <a href="admin.php">retourn to admin page</a> </p>
</body>
</html>
Return current item: Lite Outbound Manager