Page 1 of 1

Create FTP account through PHP.....

Posted: Wed Aug 04, 2004 9:36 am
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

Posted: Wed Aug 04, 2004 2:36 pm
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.

yea

Posted: Wed Aug 04, 2004 2:58 pm
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.

Posted: Wed Aug 04, 2004 3:14 pm
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.

yes....

Posted: Wed Aug 04, 2004 4:04 pm
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.

Posted: Wed Aug 04, 2004 6:52 pm
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

Posted: Wed Aug 04, 2004 9:24 pm
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

Posted: Thu Aug 05, 2004 1:27 am
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

Posted: Thu Aug 05, 2004 2:31 am
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 ;)

Posted: Thu Aug 05, 2004 10:29 am
by Ne0
ok, ive got it.
thank you everyone for your help and time.