function nulluhr() { global $db; update_all_ranks(); $db->query('DELETE FROM ' . DB_PRE . 'ecp_messages WHERE fromdel = 1 AND del = 1'); $result = $db->query('SELECT ID FROM ' . DB_PRE . 'ecp_user WHERE (ondelete < ' . time() . ' AND ondelete != 0) OR (status = 0 AND registerdate < ' . (time() - DELETE_UNAKTIV * 86400) . ')'); while ($row = mysql_fetch_assoc($result)) { delete_user($row['ID']); } $result = $db->query('SELECT ID, money FROM ' . DB_PRE . 'ecp_user LEFT JOIN ' . DB_PRE . 'ecp_ranks ON (rID = rankID)'); while ($row = mysql_fetch_assoc($result)) { if ($row['money'] != '') { $db->query('UPDATE ' . DB_PRE . 'ecp_user_stats SET money = money + ' . $row['money'] . ' WHERE userID = ' . $row['ID']); } } if (BACKUP_AKTIV) { $last = $db->result(DB_PRE . 'ecp_stats', 'lastdbbackup', '1'); if (BACKUP_CYCLE == 'day' or $last + (BACKUP_CYCLE == 'month' ? 2592000 : 604800) < time()) { $backup_obj = new MySQL_Backup(); $backup_obj->server = MYSQL_HOST; $backup_obj->username = MYSQL_USER; $backup_obj->password = MYSQL_PASS; $backup_obj->database = MYSQL_DATABASE; $backup_obj->tables = array(); $backup_obj->drop_tables = true; $backup_obj->struct_only = false; $backup_obj->comments = true; $backup_obj->fname_format = 'd_m_y__H_i_s'; $string = get_random_string(8, 2); if ($backup_obj->Execute(MSB_SAVE, 'uploads/forum/' . $string . '.sql.gz', true)) { $m = new XMail(); // set from address and name $m->From(SITE_EMAIL); // add to address and name $m->AddTo(BACKUP_EMAIL); // set subject $m->Subject(BACKUP_AUTO); // set text/plain version of message $m->Text(DATE . ': ' . date('d.m.Y H:i:s')); // add attachment ('text/plain' file) $m->Attach(date('Y_m_d') . '.sql.gz', 'application/x-gzip'); $f = 'uploads/forum/' . $string . '.sql.gz'; $id = MIME::unique(); // add inline attachment '$f' file with ID '$id' $m->Attach(file_get_contents($f), FUNC::mime_type($f), null, null, null, 'attachment', $id); if (SMTP_AKTIV) { $c = $m->Connect(SMTP_HOST, (int) SMTP_PORT, SMTP_USER, SMTP_PASS, 'tls', 10, 'localhost', null, 'plain'); //or die(print_r($m->Result)); } if ($m->Send(SMTP_AKTIV ? $c : null)) { $db->query('UPDATE ' . DB_PRE . 'ecp_stats SET lastdbbackup = ' . strtotime('today 00:00:00')); } unlink('uploads/forum/' . $string . '.sql.gz'); } } } $result = $db->query('SELECT attachID, strname FROM ' . DB_PRE . 'ecp_forum_attachments WHERE (tID = 0 OR bID = 0) AND uploadzeit < ' . (time() - 1000)); while ($row = $db->fetch_assoc()) { @unlink('upload/forum/' . $row['attachID'] . '_' . $row['strname']); } $db->query('DELETE FROM ' . DB_PRE . 'ecp_forum_attachments WHERE (tID = 0 OR bID = 0) AND uploadzeit < ' . (time() - 1000)); // Buchungen durchf�hren $buchresult = $db->query('SELECT `ID`, `verwendung`, `intervall`, `betrag`, `nextbuch`, `tagmonat` FROM ' . DB_PRE . 'ecp_clankasse_auto WHERE nextbuch <= \'' . time() . '\''); while ($row = mysql_fetch_assoc($buchresult)) { $db->query('INSERT INTO ' . DB_PRE . 'ecp_clankasse_transaktion (`geld`, `verwendung`, `datum`, `userID`) VALUES (-' . $row['betrag'] . ', \'' . mysql_real_escape_string($row['verwendung']) . '\', ' . time() . ', 0)'); $db->query('UPDATE ' . DB_PRE . 'ecp_clankasse SET kontostand = kontostand - ' . $row['betrag']); switch ($row['tagmonat']) { case 1: $nextdate = strtotime('+ ' . (int) $row['intervall'] . ' month'); break; case 15: $nextdate = strtotime('+ ' . (int) $row['intervall'] . ' month'); break; case 28: $nextdate = strtotime('+ ' . (int) $row['intervall'] . ' month'); } $db->query('UPDATE ' . DB_PRE . 'ecp_clankasse_auto SET `nextbuch` = \'' . $nextdate . '\''); } $db->query('DELETE FROM ' . DB_PRE . 'ecp_forum_search WHERE datum < ' . (time() - 86400)); $result = $db->query('SELECT COUNT(sID) as anzahl, sID FROM ' . DB_PRE . 'ecp_server_stats GROUP BY sID'); while ($row = mysql_fetch_assoc($result)) { if ($row['anzahl'] > SERVER_MAX_LOG) { $db->query('DELETE FROM ' . DB_PRE . 'ecp_server_stats WHERE sID = ' . $row['sID'] . ' ORDER BY datum ASC LIMIT ' . ($row['anzahl'] - SERVER_MAX_LOG)); } } }
/* Purpose: - set Text and HTML version of message - add attachment - embed image into HTML */ // manage errors error_reporting(E_ALL); // php errors define('DISPLAY_XPM4_ERRORS', true); // display XPM4 errors //define('LOG_XPM4_ERRORS', serialize(array('type' => 1, 'destination' => '*****@*****.**', 'headers' => 'From: xpm4@domain.tld'))); // <- send mail //define('LOG_XPM4_ERRORS', serialize(array('type' => 3, 'destination' => '/var/tmp/XPM4.log'))); // <- append file // path to 'MIME.php' file from XPM4 package require_once '../MIME.php'; // get ID value (random) for the embed image $id = MIME::unique(); // set text/plain version of message $text = MIME::message('Text version of message.', 'text/plain'); // set text/html version of message $html = MIME::message('<b>HTML</b> version of <u>message</u>.<br><i>Powered by</i> <img src="cid:' . $id . '">', 'text/html'); // add attachment with name 'file.txt' $at[] = MIME::message('source file', 'text/plain', 'file.txt', 'ISO-8859-1', 'base64', 'attachment'); $file = 'xpertmailer.gif'; // add inline attachment '$file' with name 'XPM.gif' and ID '$id' $at[] = MIME::message(file_get_contents($file), FUNC::mime_type($file), 'XPM.gif', null, 'base64', 'inline', $id); // compose mail message in MIME format $mess = MIME::compose($text, $html, $at); // send mail $send = mail('*****@*****.**', 'Hello World!', $mess['content'], 'From: me@myaddress.net' . "\n" . $mess['header']); // print result echo $send ? 'Sent !' : 'Error !';
// path to 'MAIL.php' file from XPM4 package require_once '../MAIL.php'; // get ID value (random) for the embed image $id = MIME::unique(); // initialize MAIL class $m = new MAIL(); // set from address and name $m->From('*****@*****.**', 'My Name'); // add to address and name $m->AddTo('*****@*****.**', 'Client Name'); // set subject $m->Subject('Hello World!'); // set text/plain version of message $m->Text('Text version of message.'); // set text/html version of message $m->Html('<b>HTML</b> version of <u>message</u>.<br><i>Powered by</i> <img src="cid:' . $id . '">'); // add attachment ('text/plain' file) $m->Attach('source file', 'text/plain'); $f = 'xpertmailer.gif'; // add inline attachment '$f' file with ID '$id' $m->Attach(file_get_contents($f), FUNC::mime_type($f), null, null, null, 'inline', $id); // send mail echo $m->Send('client') ? 'Mail sent !' : 'Error !'; // optional for debugging ---------------- echo '<br /><pre>'; // print History print_r($m->History); // calculate time list($tm1, $ar1) = each($m->History[0]); list($tm2, $ar2) = each($m->History[count($m->History) - 1]); echo 'The process took: ' . (floatval($tm2) - floatval($tm1)) . ' seconds.</pre>';
if ($vssl != null && !$extensionLoaded) { echo 'Falha no envio. A extensão Open SSL não está habilitada no PHP.'; exit; } error_reporting(E_ALL); // manage php errors $from = trim($user); $to = trim($recipients); $toArray = explode(",", $recipients); $subj = trim($subject); $content = trim($mailBody); $content = nl2br($content); $message = MIME::message($content, 'text/html', null, 'UTF-8'); $attachment = null; foreach ($attachmentFiles as $filename => $path) { $attachment[] = MIME::message(file_get_contents($path), FUNC::mime_type($path), $filename, null, 'base64', 'attachment'); } // compose message in MIME format $mess = MIME::compose(null, $message, $attachment); // standard mail message RFC2822 $body = 'From: ' . $from . "\r\n" . 'To: ' . $to . "\r\n" . 'Subject: ' . $subj . "\r\n" . $mess['header'] . "\r\n\r\n" . $mess['content']; $conn = SMTP::connect($host, $port, $user, $pass, $vssl) or die('Falha na conexão - ' . print_r($_RESULT)); $sent = SMTP::send($conn, array($toArray[0]), $body, $from); if ($sent) { echo 'Email enviado com sucesso!'; } else { echo 'Falha no envio - ' . print_r($_RESULT); } SMTP::disconnect($conn); // Fecha a conexão com o banco de dados $dataConnector->CloseConnection();