Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 18.116.86.134
<?php
function backupdb($aobj_context)
{
session_start();
$FUNIVCODE = $_SESSION['FUNIVCODE'];
require_once("cManualMailer.php");
$dbhost = '72.167.46.92';
$dbuser = 'resultsg_logu';
$dbpass = 'log159';
// $myArray = json_decode(sendarr, true);
$dbname =stripslashes($_POST['sendarr']);
$val = explode(',',$dbname);
$phpmailer_path = $aobj_context->main_src."";
//$path = substr_replace($phpmailer_path,'bkp',60));
for($k=0;$k<count($val);$k++)
{
$name[] = $val[$k];
$backup_file = 'office_'.$val[$k] . '_'.date("Y-m-d") . '.gz';
$backup_filename.='<br>'.$backup_file;
$command = "mysqldump --opt -h ".$dbhost." --user ".$dbuser." --password=".$dbpass." ".$val[$k]." | gzip >". $backup_file;
exec($command);
}
$backup_zip="krvw_oasis_".$val[0]."_".date("Y-m-d");
$command = "zip ".$backup_zip." office_*".date("Y-m-d").'.gz';
exec($command);
$command = "rm office_*".date("Y-m-d").'.gz';
exec($command);
$phpmailer_path=$aobj_context->main_src."/libs/phpmailer/class.phpmailer.php";
$phpmailer_smtp=$aobj_context->main_src."/libs/phpmailer/class.smtp.php";
ini_set("display_errors","On");
//require("phpmailer/class.phpmailer.php");
//require("phpmailer/class.smtp.php");
require($phpmailer_path);
require($phpmailer_smtp);
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->SMTPSecure = "ssl";
$mail->Mailer = "smtp";
$mail->Host = "smtp.zoho.com"; // SMTP server
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Port = 465; // set the SMTP port for the GMAIL server
$mail->Username = "support@logisys.org"; // SMTP account username
$mail->Password = "logisys124"; // SMTP account password */
$mail->From = "support@logisys.org";
$mail->FromName = "Mohan";
$mail->AddAddress("support@logisys.org","Logisys");
$mail->AddReplyTo("support@logisys.org","Logisys");
$mail->WordWrap = 50; // set word wrap
$filepath = "72.167.46.92/bkp/";
$mail->IsHTML(true); // send as HTML zip_entry_filesize($filepath . $backup_zip))
$file_size = filesize($filepath . $backup_zip);
$mail->Subject = 'Backup taken. File name: '.$backup_zip;
$mail->Body = 'Backup taken at '.$FUNIVCODE.' File name: '.$backup_zip.'. <br>Contains <br> '.$backup_filename;
$mail->AltBody = "This is the text-only body";
if(!$mail->Send())
{
echo "Message was not sent <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
else
{
echo "Message has been sent";
}
echo "<br><a href='{$backup_zip}.zip' style = 'color:blue'>Download file</a>";
}
?>
|