net2ftp uses one script file (index.php) for all screens: login, browse, copy, ...
The functions are stored in different include files according to what they do:
- homepage.inc.php contains functions to print the login page and net2ftp homepage
- manage.inc.php contains the high-level functions to print the screens (copy, upload,...)
- filesystem.inc.php contains the low-level functions that execute FTP commands or local filesystem commands
- browse.inc.php contains all functions related to the browse screen (requesting the ftp_rawlist, parsing it, showing the output)
- authorizations.inc.php contains functions to check the authorizations
- html.inc.php contains functions which print the HTML header and footer
- httpheaders.inc.php contains the code that is related to sending HTTP headers (needed for example to trigger the Save As popup of your browser, when you want to download a file)
- registerglobals.inc.php registers the variables and does some preliminary checking
Two state variables (state and state2) determine which screen is shown.
Below is some sample code taken from index.php.
The login information and state variables are passed from screen to screen via forms.
There is a function to print the login information in an HTML form: printLoginInfo().
For the moment net2ftp doesn't use sessions.
This was to avoid session timeouts after 20 or 30 minutes; you can work without worrying about it for as long as you want.
In the meanwhile some users have pointed out on the forum how to avoid session timeouts, but I don't know what benefit sessions would bring.
There isn't really any information that has to be stored during a session.
Cookies are used to store the last FTP server, username and directory used.
net2ftp can be configured using the settings.inc.php file.
When a function needs to access a variable, this variable is declared as global in the beginning of the function.
These variables are never changed during the execution of the program.
The icons were developed by Everaldo, and can be downloaded from http://www.linuxcult.com/forum/crystal.php.
In the archive that can be downloaded there are several sets of icons, each with a different size. Net2ftp uses the 32x32 set.
The original icons are shown when the mouse moves over the image.
When the mouse is not over the image, a brighter image is shown.
This effect was obtained by using The Gimp to change the Brightness.
Here is how to do it:
Open the image with The Gimp, right-click on it, and select Image > Colors > Brightness-Contrast.
Move the slider until you get Brightness 70 (or just enter it).
Save the file as image_light.png and a second time as image_light.gif.
In (recent) Mozilla-based browsers, PNG images with a transparent background are shown fine.
In Internet Explorer however they are not.
Therefor the images were converted to the GIF format; this was also done with Gimp.
Depending on the browser, a PNG or GIF image is shown.
There are 3 kinds of icons:
- action icons: when you press on them, an action is triggered.
There is an onMouseOver effect and onClick event.
- mime icons: they indicate which kind of file is shown in the browse view. No onMouseOver effect.
- settings icons (not yet in use): they indicate if a setting is on or off
-- for example if the FTP transfer mode is ASCII or BINARY.
When the mode is ASCII, the ASCII icon is shown with a border, and there is no onMouseOver effect.
The BINARY icon is shown without a border and there is an onMouseOver effect.
The code for this FTP transfer mode is already written but not yet in use.
All the code behind icons is in the skins.inc.php file.
If you're interested in helping with the development of net2ftp, feel free!
Post a message on the forum telling which feature you'ld like to develop, just to make sure someone else isn't working on the same thing.
If you need help or would like some advice, don't hesitate.
Once you're done, send the code to David, who will test it and include it in the main distribution.
In the future we may start working together on a common development server at net2ftp.org.
- Multi-lingual support
- Currently only the last FTP server, username and directory are stored in a cookie. An improvement would be to store the last 5 servers/usernames/directories used and print a drop-down list.
- Let the user select the number of upload fields. Currently it has to be specified in the settings file (requested by Ajay)
- An install script would be great... Most users have a problem because they erased a character by mistake...
- The admin panel can also be improved a lot: graphic statistics, enhanced functions,...
- Allow the user to select the mode of transfer, i.e. binary, ascii or auto (requested by Ajay and Decsifo)
- The chmod functionality should recursively go through all subdirectories and files, if the user wants it. (requested by emonkey)
- List the files and directories together, so that manipulations like chmod, zip download etc can be done on them together. Currently these have to be done seperately (requested by Ajay)
- Add an upload field at the bottom of the directories listing as well as makenew dir etc for immediate creation, instead of going to a new page for this (requested by Ajay)
- Show thumbnails for graphic files
- Search files for given string
- Apache/MySQL specific tools: password-protect directories, custom error pages, run SQL queries
- Add more cases to the function (printURL in browse.inc.php) that maps the FTP location to a URL.
Some examples:
ftp.freeserver.com/username/dir/file.php can be mapped to
http://username.freeserver.com/dir/file.php OR
http://www.freeserver.com/username/dir/file.php OR
http://freeusers.freeserver.com/~username/dir/file.php
More exotic features:
- Command Line Interface (requested by edph)
- URL to FTP (meaning, you enter the URL of a picture in net2ftp, and net2ftp gets that picture and saves it on your FTP server; could be extended to any content, like a page, sound, ...) (requested by arie)
- Email to FTP: send a mail to a specific address, and enter some commands in the mail. They are executed by net2ftp, and the result is sent back by email.
- Upload progress bar
- One-time passwords. For the paranoids who are going on holiday and don't want to compromise their password -- and still want to update their site from a cybercafe
- Client-side encryption with javascript
- Make FTP files available via HTML link. For example: <img src="http://www.net2ftp.com/getfile.php?ftpserver=ftp.myserver.com&file=/home/david/mypicture.jpg">
- Sign a file (MD5)
- Urban reported a problem with symlinks: relative symlinks work, but absolute ones not.
When investigating this, it appeared that there are symlinks to directories, and symlinks to files.
The problem is that an ftp_rawlist request does not show any difference... no solution yet.
This can be tested on the public server ftp.belnet.be with username anonymous and password test@test.com -- any volunteers?
- Liz reported this on the forum in June 2003.
I just started using this, so im not sure if you guys are aware or not, but i
thought id point it out anyway. I can connect fine, browse through my folders
fine, nothing wrong there. The problem i come into is when i want to download
a file. Ill download it, and then ill come back to either download another or
do pretty much anything else and i get errors that wont let me do anything
else except refresh the page then making me log-in again. Not that this is a
really bad problem, but it makes downloading a bunch of files rather lengthly.
Let me know if this is known or its something on my end that i need to change.
thanks.
- Solve the problem that slower FTP sites cannot be reached sometimes with net2ftp.
This function may help: ftp_set_option(FTP_TIMEOUT_SEC)