'arolabs',
wwwdirectory => '/mounted-storage/home70b/sub001/sc16660-QHQQ/www'
),
array(
wwwname => 'luxevakantie',
wwwdirectory => '/mounted-storage/home70b/sub001/sc16660-QHQQ/luxevakantie.com'
)
);
//functions
function url_remove_lastslash($url){
if (substr($url,strlen($url)-1,1)=="/"){
return substr($url,0,strlen($url)-1);
}else{
return $url;
}
}
$results = array();
function getfiles($path_start) {
global $results;
$dir = @opendir($path_start);
while (false!=($file = @readdir($dir))) {
if ($file != "." && $file != "..") {
$file_path = url_remove_lastslash($path_start) . "/" . $file;
if(is_dir($file_path)){
getfiles ($file_path);
}
$date_mod = filemtime($file_path); //get last modified date of file
if(trim($date_mod) <> ""){
$date_mod = date("Y-m-d", $date_mod);
$yr = substr($date_mod,0,4); //display 'new' image if item not-older than 7days
$mnth = substr($date_mod,5,2);
$dy = substr($date_mod,8,2);
$newday = date("Y-m-d", mktime(0,0,0,$mnth,$dy + 2,$yr));
$now = date("Y-m-d");
//echo $yr .$mnth . $dy."
";
if (($now <= $newday) ) {
//echo $file_path . " " . $date_mod . " " . $now . " " . $newday. $yr .$mnth . $dy."
";
$results[$file_path][0] = $file_path ;
$results[$file_path][1] = $date_mod;
}
}
}
}
}
foreach ($settings as $setting){
$results = array();
$date_change = "";
$filename= "";
getfiles($setting['wwwdirectory']);
$mail_body .= "".$setting['wwwname']."
";
//sort by change date
foreach ($results as $key => $row) {
$date_change[$key] = $row[0];
$filename[$key] = $row[1];
}
//array_multisort($filename, SORT_DESC, $date_change, SORT_ASC, $results);
foreach ($results as $result){
$mail_body .= $result[1] . ": " . str_replace($setting['wwwdirectory'],"",$result[0])."
";
}
}
$headers="";
$headers .= "X-Sender: $from <$from>\n"; //
$headers .="From: $from <$from>\n";
$headers .= "Reply-To: $from <$from>\n";
$headers .= "Date: ".date("r")."\n";
$headers .= "Message-ID: <".date("YmdHis")."$from>\n";
$headers .= "Subject: $subject\n";
$headers .= "Return-Path: $from <$from>\n";
$headers .= "Delivered-to: $from <$from>\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html;charset=ISO-8859-9\n";
$headers .= "X-MSMail-Priority: Normal\n";
$headers .= "X-Mailer: Mail send from ".$domain."!\n";
//mail to customer
if(mail($to,$subject,$mail_body,$headers)){
echo "job executed succesfully";
}else{
echo "error executing job";
}
?>