#!/usr/bin/perl

print "Content-Type: Text/HTML\n\n";

use CGI ':standard';
use Vpanel 1.00;
require $header;
require $accountinfo;
$domainnname = find_domain ($mainuser);

# Define the tab which appears to the front
$tab_section = $tabnum_website;

# Output the content associated with this tab
print "<body class=section-$tab_section>";

# display tabs
require $tabdisplay;

$flag = "ftp";
$user = param ('new_ftp_user');
$password = param ('new_password');
$directory = param('new_directory');

print_header ("Creation of a new FTP user for $domainname");

# first check the page hasn't been refreshed and the user is already awaiting insertion

$user_addition_result = add_user($flag, $user, $password, $domainname, $directory);

if ( $user_addition_result == 0 )
{
	print "The user $user wasn't added as it seems to exist already.<BR>";
} else {
	print<<INFO;

	Your new user information is summarised below.
	Please keep this information in a safe place for future reference. <br><br>
	User: <b>$user</b><BR>
	Password: <b>$password</b><BR>
	Directory: <b>$directory</b>

INFO
	show_time_to_change();
	print_email_confirmation($domainname);
}
require $footer;
