ok
Direktori : /home/gainstransformin/www/Gains_admin/cron_job/ |
Current File : /home/gainstransformin/www/Gains_admin/cron_job/db_back_up.php |
<?php // Report all errors error_reporting(E_ALL); // Same as error_reporting(E_ALL); ini_set("error_reporting", E_ALL); ///////////////////////////////////////////////////////////////agriserach define ('DOCUMENT_ROOT', '/home/flyctsofttech/public_html/kripa_enterprises/dashboard/' ); // define ('DOCUMENT_ROOT', '/home/honesttradingco/public_html/Gains_admin/' ); // $dir = dirname(__FILE__); // require_once($dir.'/swift/swift_required.php'); $email="kiranc9911@gmail.com"; $DBUSER="flyctsof_kripa_enterpricess"; $DBPASSWD="Flyct@9911"; $DATABASE="flyctsof_kripa_enterpricess"; $filename = DOCUMENT_ROOT . 'DB_BACKUP/kripa_enterprises_'.date('m-d-Y').'.sql.gz'; // $temp_filepath='author.jpg'; // $cmd = "mysqldump -u $DBUSER --password=$DBPASSWD $DATABASE | gzip --best > " . $filename; //echo "okkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk".exec($cmd); $cmd = "mysqldump -u $DBUSER --password=$DBPASSWD $DATABASE | gzip --best > " . $filename; exec( $cmd ); $to = 'kiranc9911@gmail.com'; //sender $from = 'kripaenterprises@flyctsofttech.com'; $fromName = 'Database Backup'; //email subject $subject = 'kripa_enterprises Generate the Daily Back Of Your DataBase On Date '.date('d-M-Y'); //attachment file path $file = $filename; //email body content $htmlContent = '<h1>kripa_enterprises Database Back </h1>'; //header for sender info $headers = "From: $fromName"." <".$from.">"; //boundary $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; //headers for attachment $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; //multipart boundary $message = "--{$mime_boundary}\n" . "Content-Type: text/html; charset=\"UTF-8\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $htmlContent . "\n\n"; //preparing attachment if(!empty($file) > 0){ if(is_file($file)){ $message .= "--{$mime_boundary}\n"; $fp = @fopen($file,"rb"); $data = @fread($fp,filesize($file)); @fclose($fp); $data = chunk_split(base64_encode($data)); $message .= "Content-Type: application/octet-stream; name=\"".basename($file)."\"\n" . "Content-Description: ".basename($file)."\n" . "Content-Disposition: attachment;\n" . " filename=\"".basename($file)."\"; size=".filesize($file).";\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n"; } } $message .= "--{$mime_boundary}--"; $returnpath = "-f" . $from; //send email $mail = @mail($to, $subject, $message, $headers, $returnpath); $mail = @mail($to1, $subject, $message, $headers, $returnpath); //email sending status echo $mail?"<h1>Mail sent.</h1>":"<h1>Mail sending failed.</h1>"; ?>