[thelist] Windows program to upload via FTP without disclosing password

Andy Warwick mailing.lists at creed.co.uk
Sat Feb 16 12:21:07 CST 2002


Hi

I'm after a solution for Windows PCs that will allow a client to upload - via
FTP - images (JPEGs) into a specific folder on my web server without disclosing
the login name or password.

In an ideal world, the user would prepare the images to the correct dpi and
compression, then drop them onto the program icon, which would then log onto the
FTP server and upload the files.

What prevents me using a standard FTP client is that I want some way to conceal
the login and password from the user, so that he can't access other folders on
the server other than the folder 'hard-coded' into the program. (I'm not in a
position to simply set up an FTP account that serves only the individual
folder.)

I've got a solution working on the Mac with Applescript, in the form of a
read-only droplet with embedded login and password, but need something similar
for the Windows platform.

Any ideas?

TIA

Andy W

<tip type="Auto-include external PHP files" name"Andy Warwick">

If you like to keep your PHP code in a different file to your HTML, you can use
the PHP "auto-prepend" file with the following piece of code to auto-include the
files without thinking about it, or having any PHP code in the HTML to confuse
your fellow coders.

Place the following code in your PHP auto_prepend_file (which you set in the
php.ini file and gets added to every file served - see
http://www.php.net/manual/en/configuration.php), set apache to have PHP parse
files ending in .htm, and name any file you want auto-including with the same
filename as your HTMl file, save for a .php extension, placing it in the same
directory as the HTMl file, thus:

    public_html
    --- example.htm
    --- example.php

The file example.php will be auto-included in the file example.htm without any
visibile PHP code in the HTML file, as that's hidden in the auto_include file.

--- code for auto_include file ---

$include_file = ereg_replace ( '\.[a-zA-Z0-9_]+$', '.php', "$PHP_SELF" ) ;

$include_file = substr ( "$include_file", '1', strlen ( "$include_file" ) ) ;

if ( file_exists ( $include_file ) )
{
    include_once ( $include_file ) ;
}

--- end ---

The code simply finds the file's extension, replaces it with '.php', and if a
file with that name exists in the include path, auto-includes it.

Caveat: parsing all your HTML files in this manner will slow your server down a
fraction, so you might want to check the hit before using on a high-volume site.

</tip>



More information about the thelist mailing list