<?  
//
//  cP Account Creator Version 0.4 Beta Build 01
//  Password Protected Directory and User Creation MOD
//  Copyright (C) 2004 Brian Freeman
//  All Rights Reserved.
//
//  This script set is distributed as is with absolutely no warranty.
//  Users of this script set agree to use at their own risk.
//  Questions or comments?  Contact webmaster@freemans-web.com
//
//

if($add_ftp==1) {

//  The password protected directory name
$dir = 'protected';

//  Must be directed to the users base directory.  '/' is replaced by '%2F'
$pword_dir="%2Fhome2%2F$ownername%2Fpublic_html%2F$email%2F$dir";

//  Secure directory resource name
$resource_name="Test";

//  Will create an index.php file in the users base directory.  Please edit the skel_index.php file with your content
$file="skel_index.php";
$fp = fopen($file, 'r');


// set up basic connection
$conn_id = ftp_connect($host);

// login with username and password
$login_result = ftp_login($conn_id, "$email@$domain", $password);


// try to create the directory $dir
if (ftp_mkdir($conn_id, $dir)) {
 echo "successfully created $dir\n";
} else {
 echo "There was a problem while creating $dir\n";
}


echo "Current directory: " . ftp_pwd($conn_id) . "\n";


if (ftp_fput($conn_id, $file, $fp, FTP_ASCII)) {
   echo "Successfully uploaded $file\n";
} else {
   echo "There was a problem while uploading $file\n";
}

// try to rename $olf_file to $new_file
if (ftp_rename($conn_id, $file, "index.php")) {
 echo "successfull\n";
} else {
 echo "There was a problem \n";
}



// close the connection
ftp_close($conn_id);



$request = "/frontend/$cpmod/htaccess/changepro.html?protected=1&resname=$resouce_name&dir=$pword_dir&action=Save";

$result = cprq($host,$port,$ownername,$reseller_pass,$request);

$show = strip_tags($result);

if ($debugon==1) {
echo "$show<br><br>";
}

$request = "/frontend/$cpmod/htaccess/newuser.html?user=$email&pass=$password&dir=$pword_dir&action=Add%2Fmodify+authorized+user";

$result = cprq($host,$port,$ownername,$reseller_pass,$request);

$show = strip_tags($result);

if ($debugon==1) {
echo "$show<br><br>";
}
echo "Your password protected directory is \'$dir\' and your username is $email with a password of $password.";
}
end;


?>







