Hi, I have recently started to use php scripts, and so far I have a basic (however working) login and registration system, which adds records to a MySql database. I am now trying to expand on this, and add some php code to my registration page which creates a file on my ftp account when a user submits their details. In other words, I would like a new "profile page" to be created when a valid new member registers to my site.
So far, I have the following, but it does not work. Any suggestions?
Also on this script are the registration form and an "include" to my variables details, e.g. $ftp_user.PHP Code:<?php
function ftp_copy($source_file, $destination_file)
{
$ftp_server = $ftpserver;
$ftp_user = $ftpuser;
$ftp_password = $ftppass;
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user, $ftp_password);
if((!$conn_id) || (!$login_result))
{
echo "FTP connection has failed!";
echo "Attempted to connect to $ftp_server for user $ftp_user";
}
$fh = fopen("/public_html/profiles/$userUsername","w");
if($fh==false){
ftp_close($conn_id);
die("unable to create file");
}
ftp_close($conn_id); ?>
Thanks in advance for any help.![]()



Reply With Quote

Bookmarks