Create FTP account through PHP.....

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Ne0
Forum Commoner
Posts: 60
Joined: Sat Feb 14, 2004 11:48 am

Create FTP account through PHP.....

Post by Ne0 »

Ive searched and ive searched, from google to php.net to forums, and i cant seem to find anything.
I know I can make a webbased ftp, thats easy, but not what I want. I would like that when the users signup it creates a new FTP account for them.
Ive found things such as a "helper" program thats running as root, or modifying the PHP config file (wich i dont seem to have)...but nothing specific. And when i search for those, I can pull anything up.

Btw im using a FileZillaFTP server

thanks if you can help
User avatar
xjake88x
Forum Commoner
Posts: 50
Joined: Sun Aug 01, 2004 7:05 pm

Post by xjake88x »

Not 100% sure but my guess would be that:

FTP accounts are stored in like.. a file on the server that your php scripts can't access.. I think something special has to be installed on the server for PHP scripts to be able to add ftp accounts & stuff.. Like stuff installed on servers with control panels for webhosting etc.
Ne0
Forum Commoner
Posts: 60
Joined: Sat Feb 14, 2004 11:48 am

yea

Post by Ne0 »

yea, thats what im trying to do, make a webhost. I have found things like zpanel and cpanel and all that stuff, but i want to make my own. I have it all down except for the creation of a ftp account.

if anything ill resort to making a web-based ftp....but i dont realy want to.
User avatar
xjake88x
Forum Commoner
Posts: 50
Joined: Sun Aug 01, 2004 7:05 pm

Post by xjake88x »

Get web server software that supports it.. Or make your own its not really hard.. You can make a web server that supports PHP etc in Visual Basic. Then make a php function or something to add an FTP account, and that makes the webserver write the new account in the accounts database/registry/file/whatever.
Ne0
Forum Commoner
Posts: 60
Joined: Sat Feb 14, 2004 11:48 am

yes....

Post by Ne0 »

i already have a server set up with PHP CGI MySQL all the good stuff. I have the FileZilla FTP server up as well

what im trying to do is build a control panel for the host, i have everything i need, i just dont know how I can create an FTP account when a user signs up.

im probly just gonna make a web based file manager, i dont seem to be getting anywere

and i dont have a config file for the FTP, and if i do, then its not in the same folder as the rest of the ftp stuff.
LiquidPro
Forum Commoner
Posts: 37
Joined: Wed Aug 04, 2004 6:33 pm
Location: Akron, OH

Post by LiquidPro »

First of all... find the file that your FTP accounts are created in. If you're running a win32 system it will most likely be a *.ini file. Then, you have to set the permissions to allow the IUSR_<computer_name> account to access that (again, under win32). PHP will then be able to modify the file. You will have to access it through the full path name though (ex: D:\ftp\users.ini) and you shouldn't have a problem. You can most likely use the parse_ini_file() function to do it.

I hope that helped a little
Ne0
Forum Commoner
Posts: 60
Joined: Sat Feb 14, 2004 11:48 am

Post by Ne0 »

ok, i found the file, its an XML file? hmm, can i use the normal file editing functions in php for xml files? If so, then thank you eveyone, if not, or if there is an easier way, then that would be better.

thanks again
LiquidPro
Forum Commoner
Posts: 37
Joined: Wed Aug 04, 2004 6:33 pm
Location: Akron, OH

Post by LiquidPro »

You can use the regular file editing functions (fopen, fwrite, fclose, fread, etc.)... but make sure PHP has permission to edit the file, if it doesn't you're going to get permission denied errors.

If you want to read the accounts, you could either write your own XML parsing class (using mostly ereg) or use another XML function.

Goodluck
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

I prefer to have my programs authenticate against PAM.
And I use LDAP as the backend for PAM.
And there are many LDAP tools for PHP out there ;)
Ne0
Forum Commoner
Posts: 60
Joined: Sat Feb 14, 2004 11:48 am

Post by Ne0 »

ok, ive got it.
thank you everyone for your help and time.
Post Reply