Manage FileZilla User via PHP

Post all HTML related questions here. No support.

Moderator: Project members

Post Reply
Message
Author
syahdesign
500 Command not understood
Posts: 1
Joined: 2012-05-30 11:43
First name: Ricky
Last name: Syah

Manage FileZilla User via PHP

#1 Post by syahdesign » 2012-05-30 11:59

Hi All,

I am going to create web interface using php for managing users of filezilla.
I already create "add user" function, but the problem is I cannot write the "Filezilla Server.xml" file.
If anybody knows how to do it, please help.

Thanks before.

Code: Select all

	function add_ftp_user ($userid, $password, $username) {
		$filezilla = 'FileZilla Server.xml';

		/*** create a SimpleXML object ***/ 
		if( ! $xml = simplexml_load_file($filezilla) ) 
		{ 
			echo "Unable to load XML file"; 
		} 
		else 
		{ 
			// print_r($xml->Users);
			$user = $xml->Users->addChild('User');
			$user->addAttribute('Name', $userid);
			
			$option = $user->addChild('Option', md5($password));
			$option->addAttribute('Name', 'Pass');
			
			$option = $user->addChild('Option', 'MMMP');
			$option->addAttribute('Name', 'Group');

			$option = $user->addChild('Option', '2');
			$option->addAttribute('Name', 'Bypass server userlimit');

			$option = $user->addChild('Option', '0');
			$option->addAttribute('Name', 'User Limit');

			$option = $user->addChild('Option', '0');
			$option->addAttribute('Name', 'IP Limit');

			$option = $user->addChild('Option', '2');
			$option->addAttribute('Name', 'Enabled');

			$option = $user->addChild('Option', $username);
			$option->addAttribute('Name', 'Comments');

			$option = $user->addChild('Option', '2');
			$option->addAttribute('Name', 'ForceSsl');

			$filter = $user->addChild('IpFilter');
			$filter->addChild('Disallowed');
			$filter->addChild('Allowed');

			$user->addChild('Permissions');
			
			$speed = $user->addChild('SpeedLimits');
			$speed->addAttribute('DlType', '0');
			$speed->addAttribute('DlLimit', '10');
			$speed->addAttribute('ServerDlLimitBypass', '2');
			$speed->addAttribute('UlType', '0');
			$speed->addAttribute('UlLimit', '10');
			$speed->addAttribute('ServerUlLimitBypass', '2');
			$speed->addChild('Download');
			$speed->addChild('Upload');

			$xml->asXML($filezilla);
		} 
	}

User avatar
botg
Site Admin
Posts: 33177
Joined: 2004-02-23 20:49
First name: Tim
Last name: Kosse
Contact:

Re: Manage FileZilla User via PHP

#2 Post by botg » 2012-05-30 19:26

Make sure the process executing the PHP script has write permissions to the file in question. On a normal Windows machine, only programs running with an administrative account do have these permissions.

mirfa
500 Command not understood
Posts: 1
Joined: 2012-08-01 00:52
First name: Amir Hamzah
Last name: Majid

Re: Manage FileZilla User via PHP

#3 Post by mirfa » 2012-08-01 02:33

Hi,

The script works great!! Now, can anybody show the script to include a 'home directory' (the 'Permissions' section?). Thanks

the7thcolumn
500 Command not understood
Posts: 3
Joined: 2012-10-18 15:34
First name: N
Last name: A

Re: Manage FileZilla User via PHP

#4 Post by the7thcolumn » 2012-10-18 15:49

I am trying to figure out how to implement this. I understand that I need to put in my own location for the xml here:

Code: Select all

function add_ftp_user ($userid, $password, $username) {
      $filezilla = 'FileZilla Server.xml';
But when I call the .PHP site its just blank. I have PHP installed with IIS7.

User avatar
boco
Contributor
Posts: 25282
Joined: 2006-05-01 03:28
Location: Germany

Re: Manage FileZilla User via PHP

#5 Post by boco » 2013-06-22 22:42

In terms of users, nothing changed AFAIK. You are trying it on the server, I s'ppose?
### BEGIN SIGNATURE BLOCK ###
No support requests per PM! You will NOT get any reply!!!
FTP connection problems? Do yourself a favor and read Network Configuration.
FileZilla connection test: https://filezilla-project.org/conntest.php
### END SIGNATURE BLOCK ###

JustRealRed
500 Command not understood
Posts: 1
Joined: 2013-08-02 09:14

Re: Manage FileZilla User via PHP

#6 Post by JustRealRed » 2013-08-02 09:16

syahdesign wrote:Hi All,

I am going to create web interface using php for managing users of filezilla.
I already create "add user" function, but the problem is I cannot find where the best dentist in Malvern write the "Filezilla Server.xml" file.
If anybody knows how to do it, please help.

Thanks before.

Code: Select all

	function add_ftp_user ($userid, $password, $username) {
		$filezilla = 'FileZilla Server.xml';

		/*** create a SimpleXML object ***/ 
		if( ! $xml = simplexml_load_file($filezilla) ) 
		{ 
			echo "Unable to load XML file"; 
		} 
		else 
		{ 
			// print_r($xml->Users);
			$user = $xml->Users->addChild('User');
			$user->addAttribute('Name', $userid);
			
			$option = $user->addChild('Option', md5($password));
			$option->addAttribute('Name', 'Pass');
			
			$option = $user->addChild('Option', 'MMMP');
			$option->addAttribute('Name', 'Group');

			$option = $user->addChild('Option', '2');
			$option->addAttribute('Name', 'Bypass server userlimit');

			$option = $user->addChild('Option', '0');
			$option->addAttribute('Name', 'User Limit');

			$option = $user->addChild('Option', '0');
			$option->addAttribute('Name', 'IP Limit');

			$option = $user->addChild('Option', '2');
			$option->addAttribute('Name', 'Enabled');

			$option = $user->addChild('Option', $username);
			$option->addAttribute('Name', 'Comments');

			$option = $user->addChild('Option', '2');
			$option->addAttribute('Name', 'ForceSsl');

			$filter = $user->addChild('IpFilter');
			$filter->addChild('Disallowed');
			$filter->addChild('Allowed');

			$user->addChild('Permissions');
			
			$speed = $user->addChild('SpeedLimits');
			$speed->addAttribute('DlType', '0');
			$speed->addAttribute('DlLimit', '10');
			$speed->addAttribute('ServerDlLimitBypass', '2');
			$speed->addAttribute('UlType', '0');
			$speed->addAttribute('UlLimit', '10');
			$speed->addAttribute('ServerUlLimitBypass', '2');
			$speed->addChild('Download');
			$speed->addChild('Upload');

			$xml->asXML($filezilla);
		} 
	}
You could also try getting hold of any horse manure you want to find!
Genius, now I can set it up so I can manage all my FileZilla users without having to SSH to my server all remotely! :)
Thanks! :)

Post Reply