<?php


set_time_limit(300);
ini_set('memory_limit', '128M');
error_reporting(E_ALL);

# Open Connection to FTP Server
define('FTP_SERVER', '192.187.106.250');
define('FTP_PORT', 21);
define('FTP_TIMEOUT', 90);
define('FTP_USERNAME', 'rocketma');
define('FTP_PASSWORD', '1000sites!A');

# Check connection
if( !$ftp = ftp_connect (FTP_SERVER, FTP_PORT, FTP_TIMEOUT) ){
	die("Cannot connect to FTP");
}

# Check login
if( !ftp_login ($ftp, FTP_USERNAME, FTP_PASSWORD) ){
	die("Cannot login to FTP server");
}

ftp_pasv($ftp, true);
$ftpDir = ftp_pwd($ftp);
chdir( './temp/' ); //folder where email blast text files are saved before sending

//remove any spaces from user ID
$rocketblaster_id = str_replace(" ", "", $blast_id);

//send subscriber list to rocketmailer server
$remoteFile = "/public_html/blaster/in_files/".$rocketblaster_id."_subscriber_list.txt";
$localFile = "subscriber_list.txt";
ftp_put($ftp, $remoteFile, $localFile, FTP_BINARY);

//send email body & template file to rocketmailer server
$remoteFile = "/public_html/blaster/in_files/".$rocketblaster_id."_message_file.txt";
$localFile = "message_file.txt";
ftp_put($ftp, $remoteFile, $localFile, FTP_BINARY);

?>