Brewer
09-18-2002, 06:45 PM
Does anyone know where I can get a copy of a web based installer script. I need to create a custom installer script for my site and was hoping to get some ideas by looking at another script.
What I am tryign to do is have a user fill out a form with their FTP login information and the install path, and install a script from my server using the supplied information.
Thanks for your help.
Chr1s
09-19-2002, 05:59 PM
Here's an example on how to upload a file with PHP by FTP.
<?php
// set up basic connection
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// check connection
if ((!$conn_id) || (!$login_result)) {
echo "FTP connection has failed!";
echo "Attempted to connect to $ftp_server for user $ftp_user_name";
die;
} else {
echo "Connected to $ftp_server, for user $ftp_user_name";
}
// upload the file
$upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY);
// check upload status
if (!$upload) {
echo "FTP upload has failed!";
} else {
echo "Uploaded $source_file to $ftp_server as $destination_file";
}
// close the FTP stream
ftp_close($conn_id);
?>
You can read more about FTP in PHP here:
http://www.php.net/manual/en/ref.ftp.php
Brewer
09-19-2002, 06:42 PM
Thanks for the help. I was reading from the PHP site earlier today.
Chr1s
09-19-2002, 07:03 PM
A good thing about PHP.net is that lets say your looking for something related to FTP you could do www.php.net/ftp and it will search it up :D
Anyway, good luck.