Requirements

- Web server: any web server which can run PHP. The most popular one is Apache.
- PHP: at least version 4.2.3. net2ftp works under Safe Mode.
- Disk space: 5 MB for net2ftp (2 MB if you remove the plugins), and a few MB for the temporary files.

Installation procedure
1 - Unzip all the files on your computer, and upload them to your server.
2 - The /temp directory should be chmodded to 777 (you can use net2ftp.com to do this).
3 - Set your settings in the settings.inc.php file. (Read "Next steps" below for more details.)
4 - A database is only required if you want to log the actions of the users. To create the tables, execute the SQL queries below (also in the "create_tables.sql" file). This can be done easily in PhpMyAdmin, the popular front-end to MySQL.
# # Table structure for table `net2ftp_logAccess` # DROP TABLE IF EXISTS net2ftp_logAccess; CREATE TABLE net2ftp_logAccess ( date date NOT NULL default '0000-00-00', time time NOT NULL default '00:00:00', remote_addr text NOT NULL, remote_port text NOT NULL, http_user_agent text NOT NULL, page text NOT NULL, ftpserver text NOT NULL, username text NOT NULL, state text NOT NULL, state2 text NOT NULL, directory text NOT NULL, file text NOT NULL, http_referer text NOT NULL, KEY index1 (date,time,ftpserver(100),username(50)) ) TYPE=MyISAM; # -------------------------------------------------------- # # Table structure for table `net2ftp_logConsumptionFtpserver` # DROP TABLE IF EXISTS net2ftp_logConsumptionFtpserver; CREATE TABLE net2ftp_logConsumptionFtpserver ( date date NOT NULL default '0000-00-00', ftpserver varchar(255) NOT NULL default '0', dataTransfer int(10) unsigned default '0', executionTime mediumint(8) unsigned default '0', PRIMARY KEY (date,ftpserver) ) TYPE=MyISAM; # -------------------------------------------------------- # # Table structure for table `net2ftp_logConsumptionIpaddress` # DROP TABLE IF EXISTS net2ftp_logConsumptionIpaddress; CREATE TABLE net2ftp_logConsumptionIpaddress ( date date NOT NULL default '0000-00-00', ipaddress varchar(15) NOT NULL default '0', dataTransfer int(10) unsigned default '0', executionTime mediumint(8) unsigned default '0', PRIMARY KEY (date,ipaddress) ) TYPE=MyISAM; # -------------------------------------------------------- # # Table structure for table `net2ftp_logError` # DROP TABLE IF EXISTS net2ftp_logError; CREATE TABLE net2ftp_logError ( date date NOT NULL default '0000-00-00', time time NOT NULL default '00:00:00', ftpserver text NOT NULL, username text NOT NULL, message text NOT NULL, backtrace text NOT NULL, state text NOT NULL, state2 text NOT NULL, directory text NOT NULL, remote_addr text NOT NULL, remote_port text NOT NULL, http_user_agent text NOT NULL, KEY index1 (date,time,ftpserver(100),username(50)) ) TYPE=MyISAM; # -------------------------------------------------------- # # Table structure for table `net2ftp_logLogin` # DROP TABLE IF EXISTS net2ftp_logLogin; CREATE TABLE net2ftp_logLogin ( date date NOT NULL default '0000-00-00', time time NOT NULL default '00:00:00', ftpserver text NOT NULL, username text NOT NULL, remote_addr text NOT NULL, remote_port text NOT NULL, http_user_agent text NOT NULL, KEY index1 (date,time,ftpserver(100),username(50)) ) TYPE=MyISAM;
Next steps

- Important settings in settings.inc.php:
  - Enter an Admin panel password. If no password is entered, the Admin panel is not accessible.
  - Turn logging on or off (requires a MySQL database).
  - Choose if you want to set a daily consumption limit (requires a MySQL database). Since version 0.81, it is possible to restrict each user's daily data transfer volume and script execution time. By default the data transfer volume is set to 50 MB per day and the script execution time to 1000 seconds per day - but this may be changed. Both figures are logged per IP address, and per FTP server. Once the daily consumption limit is reached, you will still be able to browse FTP servers, but the transfer of data to/from the server will be blocked. If you need unrestricted access to net2ftp, contact your net2ftp Administrator or install net2ftp on your own web server.
- Set authorizations in settings_authorizations.inc.php:
  - Allow the users to connect to any FTP server, or only to a restricted list of FTP servers
  - Ban certain FTP servers
  - Ban certain IP addresses; users connecting from these addresses will not be able to use the website
  - Allow the users to connect to any FTP server port, or only to one port
  - Set the default login directory -- this is not restrictive, users can get out of it
  - Set the default root directory per user -- this is restrictive, users cannot get out of it when they are using net2ftp. However, this is not a secure method of restricting the access; it is much safer to set this on the FTP server itself
- To allow large file uploads and transfers, you may have to change these settings:
  - in the file php.ini (directory C:\windows or /etc): upload_max_filesize, post_max_size, max_execution_time, memory_limit
  - in the file php.conf (directory /etc/httpd/conf.d): LimitRequestBody
- Protect the /temp and the /admin directories. If you use the Apache web server, use .htaccess and .htpasswd files to do this -- sample files are provided (username admin, password net2ftp).
  - .htaccess file: set the path to the .htpasswd file
  - .htpasswd file: enter a list of usernames and encrypted passwords (the admin panel can be used to generate encrypted passwords)
- In your php.ini file, register_globals can be set to "off" (this is more secure), but the application will off course also work if it is set to "on".
- The files are transmitted using the BINARY mode by default. There is a list of file extensions (txt, php, ...) which are transmitted in ASCII mode. Edit this list if needed, it is located in /includes/filesystem.inc.php. Look for function ftpAsciiBinary.
- When a file is edited in the textarea, and transferred using the ASCII mode, net2ftp replaces CR-LF by LF. This is because some FTP servers replace LF by CR-LF. This is done in file /includes/filesystem.inc.php, in the function ftp_writefile. (CR = Carriage Return = ASCII character 13. LF = Line Feed = ASCII character 10.)

Integration of net2ftp in an existing website
Integrating the login form
If your website runs PHP: in your existing script, include the PHP file "net2ftp_loginform.inc.php" and use the function "net2ftp_loginform()" to print the net2ftp login form -- see the file example_login_page.php. This will provide all functionality: the PHP function will read the net2ftp settings files and adjust the form automatically. For example, if only a list of FTP servers are allowed, the FTP server textbox will be changed a dropdown box.
If your website does not run PHP: simply copy the login form HTML -- see the file example_login_form.html. This will provide basic client-side functionality: the login form + the Javascript function which checks if the username and password are entered.
Linking directly to a particular net2ftp page
It is possible to direct users to a particular net2ftp page (browse a particular directory, upload page, ...). Log in, go to the page you want to link to, and click on the Bookmark button: . The next page will show you the link to use; this link does not contain any login information (username or password). When the users click on the link, they will be prompted for their login information by a popup window.
Integrating the other pages
If you not only want to integrate the login form, but also all the other pages, you will have to change the code in html.inc.php. This is where the HTML start and end output is generated: header, link to stylesheets, ...
net2ftp in other applications
Xoops
net2ftp version 0.80 has been ported to Xoops.

- Thread on the Xoops forum: http://www.xoops.org/modules/newbb/viewtopic.php?topic_id=22708&forum=29
- Download page: http://www.bassmanthemes.x8r.com/modules/mydownloads/

Mambo
net2ftp Mambo component: http://mamboforge.net/projects/com-net2ftp/.
Web-based control panels

- Zpanel: http://www.thezpanel.com/
- Web-cp (as of version 0.6): http://www.web-cp.net/demo.php

Known bugs and limitations

- There is a bug in the PHP FTP function ftp_get() which causes end-of-line characters to be wrongly translated. As a result, \r\n becomes \r on Windows when using the ASCII mode. There is a workaround: on the net2ftp login screen, the BINARY mode is chosen by default. Refer to http://bugs.php.net/bug.php?id=27633 for more details.
  UPDATE 2004-12-13: A patch has been posted for this bug on the PHP internals mailing list.
- You've entered a username/password in settings.inc.php. When you want to access the Admin panel, a popup asks you for your username/password. Even if you fill something in, the popup keeps coming a few times, and then you get an error message.
  This problems only occurs if PHP is run as CGI module; it does not occur when PHP is run as Apache module. Technically speaking, for some reason **outside of net2ftp**, the $_SERVER['PHP_AUTH_USER'] and $_ENV['REMOTE_USER'] variables are not filled in.
  There is a workaround: create a .htaccess file in the /net2ftp directory with the following code
  <IfModule mod_rewrite.c> RewriteEngine on RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization},L] </IfModule>
  This will ensure that another variable ($HTTP_AUTHORIZATION) would be filled in. If this workaround doesn't work for you, there is nothing else that can be done within net2ftp.
- Symlinks are not yet handled well. Currently, they are displayed on the Browse Screen, but you can't do anything with it except clicking on the name. If the symlink points to a directory, you will be directed to that directory -- but if it points to a file, net2ftp will redirect you to the root directory of the FTP server...
- The root directory authorizations can currently only be set per user -- not per user and FTP server. This limitation will be solved in one of the next versions.

Notes regarding Windows servers
IF YOUR WEB SERVER RUNS ON WINDOWS
If you can log in but you cannot see any directory or file in the Browse Screen, then it is probably caused by a filesystem permission problem on your web server.
Quote from the PHP bug report database:
ftp_rawlist requires write permissions to the system's tempoarary directory.
IIS's default installation does not include this in the permissions for IUSR.
The bug is in system configuration, not PHP.
This was discussed in the following PHP bug reports:
http://bugs.php.net/bug.php?id=8874
http://bugs.php.net/bug.php?id=13720
http://bugs.php.net/bug.php?id=16057
IF YOUR FTP SERVER IS THE IIS FTP SERVER
In the FTP server's configuration, set it for UNIX style directory listings rather than MSDOS style listings.
Beta functions
Beta functions can be turned on or off in settings.inc.php. This is to be able to give you a feeling of where the development is going, without putting live production environments at risk. If you want to join the development team, read the Developer section.