Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <? include 'config.php';
- set_time_limit(0);
- ignore_user_abort(true);
- $apikey = 'JONADIOhaniduonaoiu';
- if(isset($_GET['apikey'])){
- if($_GET['apikey'] == $apikey){
- $database = new DB();
- $database->query("SELECT * FROM `database`")->run();
- foreach ( $database->results () as $result ) {
- $prod = new DB();
- $prod->query("SELECT * FROM `database` WHERE id='".$result->id."'")->run();
- $after = $prod->first()->after;
- $pw = $prod->first()->password;
- $username_db = $prod->first()->username;
- $db_db = $prod->first()->database;
- $host_db = $prod->first()->host;
- $uid = $prod->first()->userid;
- $back = new DB();
- $back->query("SELECT * FROM `backups` WHERE db='".$result->id."' ORDER BY id DESC LIMIT 1")->run();
- $backtime = $back->first()->zeit;
- $after2 = 60*60*$after;
- $update = date( "d.m.Y H:i:s", strtotime( $backtime )+ $after*60*60);
- $date = date('d.m.Y H:i:s');
- $date2 = date('Y.m.d H:i:s');
- //echo $date.'<br>';
- $backtime2 = $backtime + $after2;
- echo $date;
- echo $update;
- if(strtotime($date) >= strtotime($update)){
- function random_string($length) {
- $key = '';
- $keys = array_merge(range(0, 9), range('a', 'z'));
- for ($i = 0; $i < $length; $i++) {
- $key .= $keys[array_rand($keys)];
- }
- return $key;
- }
- $filename = random_string(16);
- $password = urlencode($pw);
- // create curl resource
- $ch = curl_init();
- // set url
- curl_setopt($ch, CURLOPT_URL, "http://37.59.143.236/upload.php?apikey=JONADIOhaniduonaoiu&filename=".$filename."&host=".$host_db."&username=".$username_db."&password=".$password."&database=".$db_db."");
- //return the transfer as a string
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- // $output contains the output string
- $output = curl_exec($ch);
- // close curl resource to free up system resources
- curl_close($ch);
- $output = (int)$output;
- if($output == 0){
- $user = new DB();
- $user->query("SELECT * FROM `users` WHERE id='".$uid."'")->run();
- $username = $user->first()->username;
- $email = $user->first()->email;
- $wantmail = $user->first()->WantEmail;
- $maxbackups = $user->first()->mback;
- if($wantmail == 1){
- require 'classes/PHPMailer/PHPMailerAutoload.php';
- $mail = new PHPMailer;
- $mail->setFrom('backups@backport.pw', 'Backup Backport.pw');
- $mail->addAddress($email); // Name is optional
- $mail->isHTML(true); // Set email format to HTML
- $mail->Subject = 'Backup for Database '.$db_db;
- $mail->Body = "
- <html xmlns=\"http://www.w3.org/1999/xhtml\">
- <head>
- <!-- Define Charset -->
- <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /><!-- Responsive Meta Tag -->
- <meta name=\"viewport\" content=\"width=device-width; initial-scale=1.0; maximum-scale=1.0;\" />
- <title></title><!-- Responsive Styles and Valid Styles -->
- <link href='http://fonts.googleapis.com/css?family=Noto+Sans:400,700' rel='stylesheet' type='text/css' />
- <style type=\"text/css\">
- /*<![CDATA[*/
- body{
- width: 100%;
- background-color: #efefef;
- margin:0;
- padding:0;
- -webkit-font-smoothing: antialiased;
- }
- p,h1,h2,h3,h4{
- margin-top:0;
- margin-bottom:0;
- padding-top:0;
- padding-bottom:0;
- }
- span.preheader{display: none; font-size: 1px;}
- html{
- width: 100%;
- }
- table{
- font-size: 14px;
- border: 0;
- border-collapse:collapse;
- mso-table-lspace:0pt;
- mso-table-rspace:0pt;
- }
- /* ----------- responsivity ----------- */
- @media only screen and (max-width: 640px){
- /*------ top header ------ */
- .rounded-edg-bg{width: 440px !important; height: 10px !important;}
- .main-header{line-height: 28px !important; font-size: 17px !important;}
- .subheader{width: 390px !important;}
- .main-subheader{line-height: 28px !important;}
- /*----- main image -------*/
- .main-image img{width: 420px !important; height: auto !important;}
- /*-------- container --------*/
- .container600{width: 430px !important;}
- .container580{width: 410px !important;}
- .container560{width: 390px !important;}
- .main-content{width: 408px !important;}
- /*-------- divider --------*/
- .divider img{width: 430px !important; height: 1px !important;}
- /*-------- secions ----------*/
- .section-item{width: 390px !important; text-align: center !important;}
- .table-inside{width: 408px !important;}
- /*.section-img img{width: 390px !important; height: auto !important;}*/
- .table-rounded-edg-bg{width: 410px !important; height: 5px !important;}
- /*-------- envelope graphique ------------*/
- .envelope-top600{width: 448px !important;}
- .envelope-top600 img{width: 448px !important;}
- .top-envelope600{width: 448px !important;}
- .top-envelope600 img{width: 448px !important;}
- .middle-envelope600{width: 448px !important;}
- .middle-envelope600 img.left{width: 158px !important; height: 56px !important;}
- .middle-envelope600 img.right{width: 150px !important; height: 58px !important;}
- .footer-logo{width: 100px !important;}
- .bottom-envelope600{width: 448px !important;}
- .bottom-envelope600 .left{width: 92px !important;}
- .bottom-envelope600 .right{width: 85px !important;}
- .bottom-envelope600 .unsubscribe{width: 200px !important;}
- .bottom-envelope600 .unsubscribe-text{line-height: 20px !important};
- }
- @media only screen and (max-width: 479px){
- /*------ top header ------ */
- .main-header{line-height: 28px !important; font-size: 17px !important;}
- .subheader{width: 260px !important;}
- .main-subheader{line-height: 28px !important;}
- /*----- main image -------*/
- .main-image img{width: 260px !important; height: auto !important;}
- /*-------- container --------*/
- .container600{width: 270px !important;}
- .container580{width: 270px !important;}
- .container560{width: 250px !important;}
- .main-content{width: 268px !important;}
- /*-------- divider --------*/
- .divider img{width: 260px !important; height: 1px !important;}
- /*-------- secions ----------*/
- .section-item{width: 250px !important; text-align: center !important;}
- /*.section-img img{width: 250px !important; height: auto !important;}*/
- /*-------- cta ----------*/
- .icon img{width: 20px !important; height: 20px !important;}
- .cta-text{text-align: center !important; line-height: 24px !important;}
- /*-------- footer ------------*/
- /*-------- envelope graphique ------------*/
- .envelope-top600 {width: 278px !important;}
- .envelope-top600 img{width: 278px !important;}
- .top-envelope600{width: 278px !important;}
- .top-envelope600 img{width: 278px !important;}
- .middle-envelope600{width: 278px !important;}
- .middle-envelope600 img.left{width: 158px !important; height: auto !important; display: none !important;}
- .middle-envelope600 img.right{width: 150px !important; height: auto !important; display: none !important;}
- .footer-logo{width: 100px !important;}
- .bottom-envelope600{width: 278px !important;}
- .bottom-envelope600 .left{width: 92px !important; display: none !important;}
- .bottom-envelope600 .right{width: 85px !important; display: none !important;}
- .bottom-envelope600 .unsubscribe{width: 200px !important;}
- .bottom-envelope600 .unsubscribe-text{line-height: 20px !important;}
- /*-------- social ------------*/
- .social-text{display: none !important;}
- }
- /*]]>*/
- </style>
- </head>
- <body leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">
- <!--======= preheader ======-->
- <span class=\"preheader\"><br /></span> <!--======= end preheader ======-->
- <table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"#EFEFEF\">
- <!--========= logo ===========-->
- <tr>
- <td height=\"50\"></td>
- </tr>
- <tr>
- <td align=\"center\"><a href=\"\" style=\"display: block; width: 231px; height: 33px; border-style: none !important; border: 0 !important;\"><img width=\"231\" height=\"33\" border=\"0\" style=\"display: block; width: 231px; height: 33px\" src=\"http://backport.pw/img/mail/logo.png\" alt=\"logo\" /></a></td>
- </tr>
- <tr>
- <td height=\"40\"></td>
- </tr><!--========= end logo ===========-->
- <tr>
- <td align=\"center\">
- <table width=\"600\" cellpadding=\"0\" align=\"center\" cellspacing=\"0\" border=\"0\" class=\"container600\">
- <tr>
- <td align=\"center\" valign=\"top\"><img align=\"top\" src=\"http://backport.pw/img/mail/shadow-left.png\" style=\"display: block; width: 10px; height: 294px;\" width=\"10\" height=\"294\" border=\"0\" alt=\"\" /></td>
- <td align=\"center\">
- <table border=\"0\" align=\"center\" width=\"580\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"#E0E0E0\" class=\"container580\">
- <tr>
- <td height=\"1\"></td>
- </tr>
- <tr>
- <td>
- <table border=\"0\" align=\"center\" width=\"578\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"#FFFFFF\" class=\"main-content\">
- <tr>
- <td height=\"15\"></td>
- </tr><!--========= main image ===========-->
- <tr>
- <td>
- <table border=\"0\" align=\"center\" width=\"560\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"#E0E0E0\" class=\"container560\">
- <tr>
- <td align=\"center\" class=\"main-image\"><img src=\"http://backport.pw/img/mail/main-image2.png\" style=\"display: block; width: 560px; height: 274px;\" width=\"560\" height=\"274\" border=\"0\" alt=\"main image\" /></td>
- </tr>
- </table>
- </td>
- </tr><!--========= end main image ===========-->
- <tr>
- <td height=\"40\"></td>
- </tr><!--========= main text ===========-->
- <tr>
- <td align=\"center\">
- <table border=\"0\" width=\"560\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" class=\"container560\">
- <tr>
- <td align=\"center\" style=\"color: #454545; font-size: 18px; font-family: 'Noto Sans', Arial, sans-serif;\" class=\"main-header\">New Backup for Database ".$db_db."</td>
- </tr>
- <tr>
- <td height=\"20\"></td>
- </tr>
- <tr>
- <td align=\"center\" style=\"color: #9f9f9f; font-size: 13px; font-family: 'Noto Sans', Arial, sans-serif; line-height: 29px;\" class=\"main-subheader\">Your Backup for Database ".$db_db." was created Successfully, click <a href=\"http://backport.pw/backups.php\" style=\"color: #4fc1e9; text-decoration: none;\">here</a> to see and Download it.</td>
- </tr>
- <tr>
- <td height=\"30\"></td>
- </tr>
- </table>
- </td>
- </tr><!--========= end main text ===========-->
- <tr>
- <td height=\"50\"></td>
- </tr><!--============ divider ===========-->
- <tr>
- <td class=\"divider\" align=\"center\"><img src=\"http://backport.pw/img/mail/divider.png\" style=\"display: block; width: 565px; height: 1px;\" width=\"565\" height=\"1\" border=\"0\" alt=\"divider\" /></td>
- </tr><!--============ end divider ===========-->
- <tr>
- <td height=\"50\"></td>
- </tr>
- <tr>
- <td height=\"20\"></td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </td>
- <td align=\"center\" valign=\"top\"><img align=\"top\" src=\"http://backport.pw/img/mail/shadow-right.png\" style=\"display: block; width: 10px; height: 294px;\" width=\"10\" height=\"294\" border=\"0\" alt=\"\" /></td>
- </tr>
- </table>
- </td>
- </tr><!--============ footer ===========-->
- <tr>
- <td align=\"center\">
- <table width=\"600\" cellpadding=\"0\" align=\"center\" cellspacing=\"0\" border=\"0\" class=\"envelope-top600\">
- <tr>
- <td align=\"center\" style=\"line-height: 13px;\"><img src=\"http://backport.pw/img/mail/envelope-top.png\" style=\"display: block; width: 600px; height: 13px;\" width=\"600\" height=\"13\" border=\"0\" alt=\"\" /></td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td align=\"center\">
- <table width=\"600\" cellpadding=\"0\" align=\"center\" cellspacing=\"0\" border=\"0\" bgcolor=\"#FFFFFF\" class=\"top-envelope600\">
- <tr>
- <td align=\"center\"><img src=\"http://backport.pw/img/mail/top-envelope.png\" style=\"display: block; width: 600px; height: 78px;\" width=\"600\" height=\"78\" border=\"0\" alt=\"\" /></td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td align=\"center\" valign=\"top\">
- <table width=\"600\" cellpadding=\"0\" align=\"center\" cellspacing=\"0\" border=\"0\" bgcolor=\"#F7F7F7\" class=\"middle-envelope600\">
- <tr>
- <td align=\"center\" valign=\"top\"><img src=\"http://backport.pw/img/mail/middle-envelope-left.png\" style=\"display: block; width: 218px; height: 53px;\" width=\"218\" height=\"53\" border=\"0\" alt=\"\" class=\"left\" /></td>
- <td align=\"center\">
- <table width=\"173\" cellpadding=\"0\" align=\"center\" cellspacing=\"0\" border=\"0\" bgcolor=\"#F7F7F7\" class=\"footer-logo\">
- <tr>
- <td align=\"center\" valign=\"middle\"><img align=\"middle\" src=\"http://backport.pw/img/footer.png\" style=\"display: block; width: 43px; height: 42px;\" width=\"43\" height=\"42\" border=\"0\" alt=\"\" /></td>
- </tr>
- </table>
- </td>
- <td align=\"center\"><img src=\"http://backport.pw/img/mail/middle-envelope-right.png\" style=\"display: block; width: 209px; height: 53px;\" width=\"209\" height=\"53\" border=\"0\" alt=\"\" class=\"right\" /></td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td align=\"center\">
- <table width=\"600\" cellpadding=\"0\" align=\"center\" cellspacing=\"0\" border=\"0\" bgcolor=\"#F7F7F7\" class=\"bottom-envelope600\">
- <tr>
- <td align=\"center\" valign=\"top\"><img align=\"top\" src=\"http://backport.pw/img/mail/bottom-envelope-left.png\" style=\"display: block; width: 128px; height: 82px;\" width=\"130\" height=\"82\" border=\"0\" alt=\"\" class=\"left\" /></td>
- <td align=\"center\">
- <table width=\"350\" cellpadding=\"0\" align=\"center\" cellspacing=\"0\" border=\"0\" bgcolor=\"#F7F7F7\" class=\"unsubscribe\">
- <tr>
- <td align=\"center\" style=\"color: #9b9b9b; font-size: 11px; font-family: 'Noto Sans', Arial, sans-serif;\" class=\"unsubscribe-text\">You accepted to get a mail every Backup.<br />
- <a href=\"http://backport.pw/my-account.php\" style=\"text-decoration: none; color: #4fc1e9; line-height: 30px;\">Click here to receive no emails anymore.</a></td>
- </tr>
- </table>
- </td>
- <td align=\"center\" valign=\"top\"><img align=\"top\" src=\"http://backport.pw/img/mail/bottom-envelope-right.png\" style=\"display: block; width: 116px; height: 82px;\" width=\"120\" height=\"82\" border=\"0\" alt=\"\" class=\"right\" /></td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td height=\"50\"></td>
- </tr>
- </table>
- </body>
- </html>
- ";
- $mail->AltBody = 'HELLO';
- if(!$mail->send()) {
- echo 'Message could not be sent.';
- echo 'Mailer Error: ' . $mail->ErrorInfo;
- } else {
- echo 'Message has been sent';
- }
- $backup = new DB();
- $backup->query("INSERT INTO `backups`(`name`, `zeit`, `userid`, `filename`, `db`) VALUES ('".$db_db."','".$date2."','".$uid."','".$filename."','".$result->id."')")->run();
- $backup = new DB();
- $backup->query("SELECT * FROM `backups` WHERE db = '". $result->id ."'")->run();
- $backupss = $backup->count();
- echo $maxbackups.'<br>';
- echo $backupss;
- if($backupss > $maxbackups){
- $back = new DB();
- $back->query("SELECT * FROM `backups` WHERE db = '". $result->id ."' ORDER BY zeit ASC LIMIT 1;")->run();
- $backid = $back->first()->id;
- $filenameback = $back->first()->filename;
- $ch = curl_init();
- // set url
- curl_setopt($ch, CURLOPT_URL, "http://37.59.143.236/delete.php?Apikey=JONADIOhaniduonaoiu&filename=".$filenameback."");
- //return the transfer as a string
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- // $output contains the output string
- $output = curl_exec($ch);
- // close curl resource to free up system resources
- curl_close($ch);
- $bck = new DB();
- $bck->query("DELETE FROM `backups` WHERE id = '".$backid."'")->run();
- echo $output;
- echo $filenameback;
- }
- }
- }else{
- }
- }
- }
- }else{
- echo 'Apikey not true';
- }
- }else{
- echo 'Apikey not set.';
- }?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement