Navigation
Last Seen Users
Jabel< 5 mins
progy00:11:55
moss01:06:21
wepo03:10:05
samadi03:24:38
Mesue03:40:06
Agung Taufiq...03:52:00
max_og_mule04:18:33
Zombarxos05:12:46
Nighthawk-Inc05:26:47

Members: 27,772
Newest: progy
Downloads v7
Downloads v6
One-click Translation
Translate This Site

Member Poll
Which version of PHP-Fusion are you using?

6.xx.xx
6.xx.xx
4% [20 Votes]

7.00.xx
7.00.xx
8% [39 Votes]

7.01.xx
7.01.xx
8% [42 Votes]

7.02.xx
7.02.xx
81% [417 Votes]

Votes: 518
You must login to vote.
Started: 26/03/2012 11:58

Polls Archive
Login
Username

Password



Not a member yet?
Click here to register.

Forgotten your password?
Request a new one here.
Connect via Facebook
Connect via Facebook
Our Coders
Shoutbox
You must login to post a message.

17-06-2013 04:03
info jadwal imsakiyah 2013 Thumb Up! semoga bermanfaat

16-06-2013 20:57

16-06-2013 20:56

16-06-2013 20:55

16-06-2013 20:55

16-06-2013 20:54

16-06-2013 05:39

16-06-2013 05:35

16-06-2013 05:25

16-06-2013 05:23

Shoutbox Archive
In memoriam

Nick Jones
1973-2011

Sponsors
View Thread
Who is here? 1 guest(s)
 Print Thread
"Auto DB Backup panel with email" email changes
quiki
Hi, Is it possible to make the backup infusion send an email to a specific mail address instead of the site owner's address? Great infusion btw, works very good with sites I use the site mail on.

Maybe it's possible to change something here: $email_to = $settings['siteemail']; // ???

Hoping anyone have looked into this before.


Regards

<?php
/*---------------------------------------------------+
| PHP-Fusion 6 Content Management System
+----------------------------------------------------+
| Copyright (c) 2003-2008 Nick Jones
| http://www.php-fu...
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
+----------------------------------------------------+
| Database Backup developed by CrappoMan
| email:
+----------------------------------------------------*/
/*-----------------------------------------------------------------------------------------------------------------------------------
Backup Yapma Ve Gönderme Kodu 1.2:
Kodlayan: SoulSmasher - www.soulsmasher.net
phpfusion-tr.com - PHP Fusion Türkiye Resmi Destek Sitesi
Kodlarda örnek olarak Auto Db Backup ve Christoph2k nın attachmentlı mail sistemi kodları kullanılmıştır
\-----------------------------------------------------------------------------------------------------------------------------------*/
if(file_exists(INFUSIONS."auto_mail_backup_panel/locale/".$settings['locale'].".php"))
{
include INFUSIONS."auto_mail_backup_panel/locale/".$settings['locale'].".php";
} else {
include INFUSIONS."auto_mail_backup_panel/locale/English.php";
}
/*******************BURALARI KENDİNİZE GÖRE DÜZENLEYEBİLİRSİNİZ***********************/

$silmek = true; //backup gönderdikten sonra ftpden silmek için true, ftpden silmemek için false yazın

// Değişkenler - bilmediklerinize dokanmayın
define('A_WAIT_TIME', 60*60*24); // bekleme süresi, 1 gün için 60*60*24
define('A_DB_DIR', ADMIN.'db_backups/'); // backup klasörü (777 chmodlu olmalıdır)
define('A_TOUCH_FILE', A_DB_DIR.'aw_last_update');
define('A_GZ_BACKUP', true); // gzip desteği açıksa true, değilse false
define('A_ENDOL', "\n"); // default: "\n"
define('DBNAME', $db_name); //database adını define ettik daha hızlı çalışır - buna dokanmayın
/*********************************************************************************************/

//email yapma kodu - bu da benim eserim :) - www.soulsmasher.net
if (substr($_SERVER['HTTP_HOST'], 0, 4) == "www.") {
$domainadi = substr($_SERVER['HTTP_HOST'], 4);
} else {
$domainadi = $_SERVER['HTTP_HOST'];
}
$email_from = "mailbackup@".$domainadi; // email kimdenmiş
$email_subject = $locale['konuadi']; // Email Konu Adı
$email_message = $locale['yedekmesaji']; // Message that the email has in it
$email_to = $settings['siteemail']; // Who the email is too - EMAİL GİDECEK ADRES, YÖNETİCİ MAİLİNE GİDİYOR STANDART OLARAK
$headers = "From: ".$email_from;
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
$headers .= "\nMIME-Version: 1.0\n" .
"Content-Type: multipart/mixed;\n" .
" boundary=\"{$mime_boundary}\"";

$email_message .= $locale['backupburada']."\n\n" .
"--{$mime_boundary}\n" .
"Content-Type:text/html; charset=\"".$locale['charset']."\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$email_message . "\n\n";

/************BURADAN AŞAĞISINA BİLMİYORSANIZ DOKANMAYIN*****************/
if(!defined("IN_FUSION")) {
die();
}

//hash oluşturma
mt_srand((double)microtime()*1000000); //memoryde random için yer ayarlıyor
$backup_rand = rand(1000000, 9999999);
$backup_hash = substr(md5($backup_rand), 8, 8); //önce globaldi şimdi fonsiyon geliştirildi :)
//hash bitti

// FUNCS
function need_backup($file) {
if(file_exists($file)) {
$mtime = filemtime($file);
return((time()-$mtime) > A_WAIT_TIME);
}
return true;
}


//from administration/db_backup.php
function gzcompressfile($source,$level=false){
$dest = $source.'.gz';
$mode = 'wb'.$level;
$error = false;
if($fp_out = gzopen($dest,$mode)) {
if($fp_in=fopen($source,'rb')) {
while(!feof($fp_in)) {
gzputs($fp_out,fread($fp_in,1024*512));
}
fclose($fp_in);
} else {
$error=true;
}
gzclose($fp_out);
} else {
$error=true;
}
if($error) {
return false;
} else {
return $dest;
}
}


// partly from administration/db_backup.php
function do_backup($thehash) {
//global $db_name;
$query_id = dbquery("SHOW TABLES FROM `".DBNAME."`");
if(!$query_id || !dbrows($query_id)) {
return false;
}
while($row = dbarray($query_id)) {
foreach($row as $key => $val) {
$db_tables[$val] = $val;
}
}

ob_start();
@ob_implicit_flush(0);
echo "#----------------------------------------------------------".A_ENDOL;
echo "# PHP-Fusion SQL Data Dump".A_ENDOL;
echo "# Database Name: `".DBNAME."`".A_ENDOL;
echo "# Table Prefix: `".DB_PREFIX."`".A_ENDOL;
echo "# Date: `".date("d/m/Y H:i")."`".A_ENDOL;
echo "# Auto sendmail Mod Made From awAutoDBBackup".A_ENDOL;
echo "#----------------------------------------------------------".A_ENDOL;
dbquery('SET SQL_QUOTE_SHOW_CREATE=1');
foreach($db_tables as $table){
$column_list = array();
$num_fields = 0;
@set_time_limit(1200);
dbquery("OPTIMIZE TABLE `".$table."`");

echo A_ENDOL."#".A_ENDOL."# Structure for Table `".$table."`".A_ENDOL."#".A_ENDOL;
echo "DROP TABLE IF EXISTS `$table`;".A_ENDOL;
$row = dbarraynum(dbquery("SHOW CREATE TABLE `".$table."`"));
echo $row[1].";".A_ENDOL;
$result = dbquery("SELECT * FROM ".$table);
if($result && dbrows($result)) {
echo A_ENDOL."#".A_ENDOL."# Table Data for `".$table."`".A_ENDOL."#".A_ENDOL;
$num_fields = mysql_num_fields($result);
for($i=0; $i<$num_fields; $i++) {
$column_list[] = "`".mysql_field_name($result, $i)."`";
}
}

while($row = dbarraynum($result)){
$data_list = array();
for($i=0; $i<$num_fields; $i++) {
if(!isset($row[$i])){
$data_list[] = "NULL";
} elseif($row[$i]=="0" || $row[$i]!="") {
$type = mysql_field_type($result, $i);
if($type=="tinyint"||$type=="smallint"||$type=="mediumint"||$type=="int"||$type=="bigint"||$type=="timestamp") {
$data_list[] = $row[$i];
} else {
$search_array=array('\\','\'',"\x00","\x0a","\x0d","\x1a");
$replace_array=array('\\\\','\\\'','\0','\n','\r','\Z');
$row[$i]=str_replace($search_array,$replace_array,$row[$i]);
$data_list[] = "'$row[$i]'";
}
} else {
$data_list[] ="''";
}
}

echo "INSERT INTO `$table` (".implode(", ", $column_list).") VALUES (".implode(", ", $data_list).");".A_ENDOL;
}
}
$contents = ob_get_contents();
ob_end_clean();

/* mt_srand((double)microtime()*1000000);
$backup_rand = rand(1000000, 9999999);
$backup_hash = substr(md5($backup_rand), 8, 8); */
$file = "backup_".$thehash."_".date('Y-m-d_Hi').".sql";
$fp = @fopen(A_DB_DIR.$file,"w");
if(!$fp) {
return false;
}
$ok = fwrite($fp,$contents);
fclose($fp);

if(A_GZ_BACKUP) {
if(gzcompressfile(A_DB_DIR.$file, 9)!=false) {
unlink(A_DB_DIR.$file);
}
}
return true;
}


// ACTION
$err_txt = "";
if((iSUPERADMIN && isset($_GET['force_backup']))
|| need_backup(A_TOUCH_FILE)) {
if(is_dir(A_DB_DIR) && is_writeable(A_DB_DIR)) {
@umask(0111);
if(@touch(A_TOUCH_FILE)) {
if(!do_backup($backup_hash)) {
$err_txt = $locale['aw_err_db'];
}
} else {
$err_txt = str_replace("%s", A_TOUCH_FILE,
$locale['aw_err_touch']);
}
} else {
$err_txt = str_replace("%s", "<b>".A_DB_DIR."</b>",
$locale['aw_err_write']);
}
/********************************************** Dosyamız ********************************************/
$backupfilegz = A_DB_DIR."backup_".$backup_hash."_".date('Y-m-d_Hi').".sql.gz";
$backupfilenormal = A_DB_DIR."backup_".$backup_hash."_".date('Y-m-d_Hi').".sql";

if(A_GZ_BACKUP)
{
$fileatt = $backupfilegz; // dosya adresi
$fileatt_type = "application/zip"; // dosya türü - dokanmayın
$fileatt_name = "backup_".$backup_hash."_".date('Y-m-d_Hi').".sql.gz"; // gidecek dosyanın adı
} else {
$fileatt = $backupfilenormal; // dosya adresi
$fileatt_type = "application/zip"; // dosya türü - dokanmayın
$fileatt_name = "backup_".$backup_hash."_".date('Y-m-d_Hi').".sql"; // gidecek dosyanın adı
}
$file = fopen($fileatt,'rb');
$data = fread($file,filesize($fileatt));
fclose($file);

$data = chunk_split(base64_encode($data));

$email_message .= "--{$mime_boundary}\n" .
"Content-Type: {$fileatt_type};\n" .
" name=\"{$fileatt_name}\"\n" .
"Content-Disposition: attachment;\n" .
" filename=\"{$fileatt_name}\"\n" .
"Content-Transfer-Encoding: base64\n\n" .
$data . "\n\n" .
"--{$mime_boundary}\n";


unset($data);
unset($file);
unset($fileatt);
unset($fileatt_type);
unset($fileatt_name);



/******************************************ikinci dosya göndermek isytersek (şimdilik gereksiz)*******************************/
/*
$fileatt = ""; // Path to the file
$fileatt_type = "application/octet-stream"; // File Type
$fileatt_name = ""; // Filename that will be used for the file as the attachment

$file = fopen($fileatt,'rb');
$data = fread($file,filesize($fileatt));
fclose($file);


$data = chunk_split(base64_encode($data));

$email_message .= "Content-Type: {$fileatt_type};\n" .
" name=\"{$fileatt_name}\"\n" .
//"Content-Disposition: attachment;\n" .
//" filename=\"{$fileatt_name}\"\n" .
"Content-Transfer-Encoding: base64\n\n" .
$data . "\n\n" .
"--{$mime_boundary}--\n";
unset($data);
unset($file);
unset($fileatt);
unset($fileatt_type);
unset($fileatt_name);
*/
/********************************************** ayar bitişi ********************************************/

if (file_exists($backupfilenormal) || file_exists($backupfilegz))
{ //backup yapmadan maili atmasın değil mi :)
$ok = @mail($email_to, $email_subject, $email_message, $headers);

if($ok) {
openside("&nbsp;");
echo $locale['aw_mailgitti'];
closeside();
} else {
openside("&nbsp;");
echo $locale['aw_mailgitmedi'];
closeside();
}

if ($silmek == true) //eğer true ya yarlanırsa mail gönderdikten sonra ftp den yedeği siliyor
{
opendir(A_DB_DIR);
if (file_exists($backupfilenormal))
{
unlink($backupfilenormal);
echo $locale['silmek'];
}
if (file_exists($backupfilegz))
{
unlink($backupfilegz);
echo $locale['silmek'];
}
//closedir(A_DB_DIR);
}

} //file exists in sonu

} //actionun bitişi

// GUI
if(iSUPERADMIN) {
openside($p_data['panel_name']);

echo "<div style='text-align:center;'>";
if(empty($err_txt)) {
echo $locale['aw_last'] . "<br />"
. showdate("shortdate", filemtime(A_TOUCH_FILE));
if(iSUPERADMIN) {
echo "<p><a href='".FUSION_SELF."?force_backup=1'>"
.$locale['AWAU010']."</a>\n";
}
} else {
echo $err_txt;
}

echo "</div>";
echo "<table cellpadding='0' cellspacing='0' border='0' align='right'><tr><td align='right'>";
echo "<a href='http://www.soulsmasher.net' target='_blank' title='Auto Mail Backup Panel 1.2 By SoulSmasher'>&#169;</a>";
echo "</td></tr></table>";
closeside();
}

//arkamızı temizleyelim
unset ($backup_rand); //güvenlik için
unset($backup_hash); //güvenlik için
?>

Edited by quiki on 10-07-2009 05:43
 
Smokeman
Hi.

We should find the following line:
Download source  Code
$email_to = $settings['siteemail'];



- and change it to:
Download source  Code
$email_to = "your email here";



Edited by Smokeman on 10-07-2009 09:20
 
Web
quiki
ok, thx Smile
 
quiki
Hm, that did'nt work with just placing the e-mail address there. Any other suggestions?
 
quiki
*bump*
Anyone else know how to do this?
 
Smokeman
I don't understand it not work that way..

Hmm, where can i DL that exactly version you have ??

Tell me and I will take a look at it for myself. Yep!
 
Web
quiki
Hi Smokeman, thx for looking into it:

http://www.phpfus...amp;id=171
 
foc_in_gaura
Just CHMOD with 777 the "administration/db_backups/aw_last_update" file.
Easy. This error appear mostly when you move to another host. You forget to chmod that file back Smile !

Good luck!

P.S. After postin I realised that this thread is inactive for more than 1 year Smile !
Edited by foc_in_gaura on 05-08-2010 11:55
 
Web
Jump to Forum:
Similar Threads
Thread Forum Replies Last Post
[submission]MG Login Panel - English v7 Mod/Infusion Locale Submit / Request 5 18-06-2013 23:47
Looking for hotest thread panel v7 Mod/Infusion Locale Submit / Request 17 28-05-2013 01:33
Donation panel how ? General Chat 1 23-05-2013 12:13
::Slideshow Random Photo Panel V6.01.16:: Mod Request 6 09-05-2013 23:12
2 Tables in 1 Panel Coding Support 1 29-04-2013 02:21