Advertisement
Guest User

Untitled

a guest
Feb 19th, 2016
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.63 KB | None | 0 0
  1. <? include 'config.php';
  2. set_time_limit(0);
  3. ignore_user_abort(true);
  4. $apikey = 'JONADIOhaniduonaoiu';
  5. if(isset($_GET['apikey'])){
  6. if($_GET['apikey'] == $apikey){
  7. $database = new DB();
  8. $database->query("SELECT * FROM `database`")->run();
  9. foreach ( $database->results () as $result ) {
  10. $prod = new DB();
  11. $prod->query("SELECT * FROM `database` WHERE id='".$result->id."'")->run();
  12. $after = $prod->first()->after;
  13. $pw = $prod->first()->password;
  14. $username_db = $prod->first()->username;
  15. $db_db = $prod->first()->database;
  16. $host_db = $prod->first()->host;
  17. $uid = $prod->first()->userid;
  18. $back = new DB();
  19. $back->query("SELECT * FROM `backups` WHERE db='".$result->id."' ORDER BY id DESC LIMIT 1")->run();
  20. $backtime = $back->first()->zeit;
  21. $after2 = 60*60*$after;
  22. $update = date( "d.m.Y H:i:s", strtotime( $backtime )+ $after*60*60);
  23. $date = date('d.m.Y H:i:s');
  24. $date2 = date('Y.m.d H:i:s');
  25. //echo $date.'<br>';
  26. $backtime2 = $backtime + $after2;
  27. echo $date;
  28. echo $update;
  29. if(strtotime($date) >= strtotime($update)){
  30. function random_string($length) {
  31. $key = '';
  32. $keys = array_merge(range(0, 9), range('a', 'z'));
  33.  
  34. for ($i = 0; $i < $length; $i++) {
  35. $key .= $keys[array_rand($keys)];
  36. }
  37.  
  38. return $key;
  39. }
  40.  
  41. $filename = random_string(16);
  42. $password = urlencode($pw);
  43. // create curl resource
  44. $ch = curl_init();
  45.  
  46. // set url
  47. 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."");
  48.  
  49. //return the transfer as a string
  50. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  51.  
  52. // $output contains the output string
  53. $output = curl_exec($ch);
  54.  
  55. // close curl resource to free up system resources
  56. curl_close($ch);
  57.  
  58. $output = (int)$output;
  59. if($output == 0){
  60. $user = new DB();
  61. $user->query("SELECT * FROM `users` WHERE id='".$uid."'")->run();
  62. $username = $user->first()->username;
  63. $email = $user->first()->email;
  64. $wantmail = $user->first()->WantEmail;
  65. $maxbackups = $user->first()->mback;
  66. if($wantmail == 1){
  67. require 'classes/PHPMailer/PHPMailerAutoload.php';
  68.  
  69. $mail = new PHPMailer;
  70.  
  71. $mail->setFrom('backups@backport.pw', 'Backup Backport.pw');
  72. $mail->addAddress($email); // Name is optional
  73. $mail->isHTML(true); // Set email format to HTML
  74.  
  75. $mail->Subject = 'Backup for Database '.$db_db;
  76. $mail->Body = "
  77. <html xmlns=\"http://www.w3.org/1999/xhtml\">
  78. <head>
  79. <!-- Define Charset -->
  80. <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /><!-- Responsive Meta Tag -->
  81. <meta name=\"viewport\" content=\"width=device-width; initial-scale=1.0; maximum-scale=1.0;\" />
  82.  
  83. <title></title><!-- Responsive Styles and Valid Styles -->
  84. <link href='http://fonts.googleapis.com/css?family=Noto+Sans:400,700' rel='stylesheet' type='text/css' />
  85. <style type=\"text/css\">
  86. /*<![CDATA[*/
  87.  
  88.  
  89. body{
  90. width: 100%;
  91. background-color: #efefef;
  92. margin:0;
  93. padding:0;
  94. -webkit-font-smoothing: antialiased;
  95. }
  96.  
  97. p,h1,h2,h3,h4{
  98. margin-top:0;
  99. margin-bottom:0;
  100. padding-top:0;
  101. padding-bottom:0;
  102. }
  103.  
  104. span.preheader{display: none; font-size: 1px;}
  105.  
  106. html{
  107. width: 100%;
  108. }
  109.  
  110. table{
  111. font-size: 14px;
  112. border: 0;
  113. border-collapse:collapse;
  114. mso-table-lspace:0pt;
  115. mso-table-rspace:0pt;
  116. }
  117.  
  118. /* ----------- responsivity ----------- */
  119. @media only screen and (max-width: 640px){
  120. /*------ top header ------ */
  121. .rounded-edg-bg{width: 440px !important; height: 10px !important;}
  122. .main-header{line-height: 28px !important; font-size: 17px !important;}
  123. .subheader{width: 390px !important;}
  124. .main-subheader{line-height: 28px !important;}
  125.  
  126. /*----- main image -------*/
  127. .main-image img{width: 420px !important; height: auto !important;}
  128.  
  129. /*-------- container --------*/
  130. .container600{width: 430px !important;}
  131. .container580{width: 410px !important;}
  132. .container560{width: 390px !important;}
  133. .main-content{width: 408px !important;}
  134. /*-------- divider --------*/
  135. .divider img{width: 430px !important; height: 1px !important;}
  136.  
  137. /*-------- secions ----------*/
  138. .section-item{width: 390px !important; text-align: center !important;}
  139. .table-inside{width: 408px !important;}
  140. /*.section-img img{width: 390px !important; height: auto !important;}*/
  141. .table-rounded-edg-bg{width: 410px !important; height: 5px !important;}
  142.  
  143. /*-------- envelope graphique ------------*/
  144. .envelope-top600{width: 448px !important;}
  145. .envelope-top600 img{width: 448px !important;}
  146. .top-envelope600{width: 448px !important;}
  147. .top-envelope600 img{width: 448px !important;}
  148.  
  149. .middle-envelope600{width: 448px !important;}
  150. .middle-envelope600 img.left{width: 158px !important; height: 56px !important;}
  151. .middle-envelope600 img.right{width: 150px !important; height: 58px !important;}
  152. .footer-logo{width: 100px !important;}
  153.  
  154. .bottom-envelope600{width: 448px !important;}
  155. .bottom-envelope600 .left{width: 92px !important;}
  156. .bottom-envelope600 .right{width: 85px !important;}
  157. .bottom-envelope600 .unsubscribe{width: 200px !important;}
  158. .bottom-envelope600 .unsubscribe-text{line-height: 20px !important};
  159. }
  160.  
  161. @media only screen and (max-width: 479px){
  162.  
  163. /*------ top header ------ */
  164.  
  165. .main-header{line-height: 28px !important; font-size: 17px !important;}
  166. .subheader{width: 260px !important;}
  167. .main-subheader{line-height: 28px !important;}
  168.  
  169. /*----- main image -------*/
  170. .main-image img{width: 260px !important; height: auto !important;}
  171.  
  172. /*-------- container --------*/
  173. .container600{width: 270px !important;}
  174. .container580{width: 270px !important;}
  175. .container560{width: 250px !important;}
  176. .main-content{width: 268px !important;}
  177. /*-------- divider --------*/
  178. .divider img{width: 260px !important; height: 1px !important;}
  179.  
  180. /*-------- secions ----------*/
  181. .section-item{width: 250px !important; text-align: center !important;}
  182.  
  183. /*.section-img img{width: 250px !important; height: auto !important;}*/
  184.  
  185. /*-------- cta ----------*/
  186. .icon img{width: 20px !important; height: 20px !important;}
  187. .cta-text{text-align: center !important; line-height: 24px !important;}
  188.  
  189. /*-------- footer ------------*/
  190. /*-------- envelope graphique ------------*/
  191. .envelope-top600 {width: 278px !important;}
  192. .envelope-top600 img{width: 278px !important;}
  193. .top-envelope600{width: 278px !important;}
  194. .top-envelope600 img{width: 278px !important;}
  195.  
  196. .middle-envelope600{width: 278px !important;}
  197. .middle-envelope600 img.left{width: 158px !important; height: auto !important; display: none !important;}
  198. .middle-envelope600 img.right{width: 150px !important; height: auto !important; display: none !important;}
  199. .footer-logo{width: 100px !important;}
  200.  
  201. .bottom-envelope600{width: 278px !important;}
  202. .bottom-envelope600 .left{width: 92px !important; display: none !important;}
  203. .bottom-envelope600 .right{width: 85px !important; display: none !important;}
  204. .bottom-envelope600 .unsubscribe{width: 200px !important;}
  205. .bottom-envelope600 .unsubscribe-text{line-height: 20px !important;}
  206.  
  207. /*-------- social ------------*/
  208. .social-text{display: none !important;}
  209. }
  210.  
  211. /*]]>*/
  212. </style>
  213. </head>
  214.  
  215. <body leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">
  216. <!--======= preheader ======-->
  217. <span class=\"preheader\"><br /></span> <!--======= end preheader ======-->
  218.  
  219. <table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"#EFEFEF\">
  220. <!--========= logo ===========-->
  221.  
  222. <tr>
  223. <td height=\"50\"></td>
  224. </tr>
  225.  
  226. <tr>
  227. <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>
  228. </tr>
  229.  
  230. <tr>
  231. <td height=\"40\"></td>
  232. </tr><!--========= end logo ===========-->
  233.  
  234. <tr>
  235. <td align=\"center\">
  236. <table width=\"600\" cellpadding=\"0\" align=\"center\" cellspacing=\"0\" border=\"0\" class=\"container600\">
  237. <tr>
  238. <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>
  239.  
  240. <td align=\"center\">
  241. <table border=\"0\" align=\"center\" width=\"580\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"#E0E0E0\" class=\"container580\">
  242. <tr>
  243. <td height=\"1\"></td>
  244. </tr>
  245.  
  246. <tr>
  247. <td>
  248. <table border=\"0\" align=\"center\" width=\"578\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"#FFFFFF\" class=\"main-content\">
  249. <tr>
  250. <td height=\"15\"></td>
  251. </tr><!--========= main image ===========-->
  252.  
  253. <tr>
  254. <td>
  255. <table border=\"0\" align=\"center\" width=\"560\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"#E0E0E0\" class=\"container560\">
  256. <tr>
  257. <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>
  258. </tr>
  259. </table>
  260. </td>
  261. </tr><!--========= end main image ===========-->
  262.  
  263. <tr>
  264. <td height=\"40\"></td>
  265. </tr><!--========= main text ===========-->
  266.  
  267. <tr>
  268. <td align=\"center\">
  269. <table border=\"0\" width=\"560\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" class=\"container560\">
  270. <tr>
  271. <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>
  272. </tr>
  273.  
  274. <tr>
  275. <td height=\"20\"></td>
  276. </tr>
  277.  
  278. <tr>
  279. <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>
  280. </tr>
  281.  
  282. <tr>
  283. <td height=\"30\"></td>
  284. </tr>
  285. </table>
  286. </td>
  287. </tr><!--========= end main text ===========-->
  288.  
  289. <tr>
  290. <td height=\"50\"></td>
  291. </tr><!--============ divider ===========-->
  292.  
  293. <tr>
  294. <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>
  295. </tr><!--============ end divider ===========-->
  296.  
  297. <tr>
  298. <td height=\"50\"></td>
  299. </tr>
  300.  
  301. <tr>
  302. <td height=\"20\"></td>
  303. </tr>
  304. </table>
  305. </td>
  306. </tr>
  307. </table>
  308. </td>
  309.  
  310. <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>
  311. </tr>
  312. </table>
  313. </td>
  314. </tr><!--============ footer ===========-->
  315.  
  316. <tr>
  317. <td align=\"center\">
  318. <table width=\"600\" cellpadding=\"0\" align=\"center\" cellspacing=\"0\" border=\"0\" class=\"envelope-top600\">
  319. <tr>
  320. <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>
  321. </tr>
  322. </table>
  323. </td>
  324. </tr>
  325.  
  326. <tr>
  327. <td align=\"center\">
  328. <table width=\"600\" cellpadding=\"0\" align=\"center\" cellspacing=\"0\" border=\"0\" bgcolor=\"#FFFFFF\" class=\"top-envelope600\">
  329. <tr>
  330. <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>
  331. </tr>
  332. </table>
  333. </td>
  334. </tr>
  335.  
  336. <tr>
  337. <td align=\"center\" valign=\"top\">
  338. <table width=\"600\" cellpadding=\"0\" align=\"center\" cellspacing=\"0\" border=\"0\" bgcolor=\"#F7F7F7\" class=\"middle-envelope600\">
  339. <tr>
  340. <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>
  341.  
  342. <td align=\"center\">
  343. <table width=\"173\" cellpadding=\"0\" align=\"center\" cellspacing=\"0\" border=\"0\" bgcolor=\"#F7F7F7\" class=\"footer-logo\">
  344. <tr>
  345. <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>
  346. </tr>
  347. </table>
  348. </td>
  349.  
  350. <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>
  351. </tr>
  352. </table>
  353. </td>
  354. </tr>
  355.  
  356. <tr>
  357. <td align=\"center\">
  358. <table width=\"600\" cellpadding=\"0\" align=\"center\" cellspacing=\"0\" border=\"0\" bgcolor=\"#F7F7F7\" class=\"bottom-envelope600\">
  359. <tr>
  360. <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>
  361.  
  362. <td align=\"center\">
  363. <table width=\"350\" cellpadding=\"0\" align=\"center\" cellspacing=\"0\" border=\"0\" bgcolor=\"#F7F7F7\" class=\"unsubscribe\">
  364. <tr>
  365. <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 />
  366. <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>
  367. </tr>
  368. </table>
  369. </td>
  370.  
  371. <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>
  372. </tr>
  373. </table>
  374. </td>
  375. </tr>
  376.  
  377. <tr>
  378. <td height=\"50\"></td>
  379. </tr>
  380. </table>
  381. </body>
  382. </html>
  383. ";
  384. $mail->AltBody = 'HELLO';
  385.  
  386. if(!$mail->send()) {
  387. echo 'Message could not be sent.';
  388. echo 'Mailer Error: ' . $mail->ErrorInfo;
  389. } else {
  390. echo 'Message has been sent';
  391. }
  392. $backup = new DB();
  393. $backup->query("INSERT INTO `backups`(`name`, `zeit`, `userid`, `filename`, `db`) VALUES ('".$db_db."','".$date2."','".$uid."','".$filename."','".$result->id."')")->run();
  394. $backup = new DB();
  395. $backup->query("SELECT * FROM `backups` WHERE db = '". $result->id ."'")->run();
  396. $backupss = $backup->count();
  397. echo $maxbackups.'<br>';
  398. echo $backupss;
  399. if($backupss > $maxbackups){
  400. $back = new DB();
  401. $back->query("SELECT * FROM `backups` WHERE db = '". $result->id ."' ORDER BY zeit ASC LIMIT 1;")->run();
  402. $backid = $back->first()->id;
  403. $filenameback = $back->first()->filename;
  404.  
  405. $ch = curl_init();
  406.  
  407. // set url
  408. curl_setopt($ch, CURLOPT_URL, "http://37.59.143.236/delete.php?Apikey=JONADIOhaniduonaoiu&filename=".$filenameback."");
  409.  
  410. //return the transfer as a string
  411. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  412.  
  413. // $output contains the output string
  414. $output = curl_exec($ch);
  415.  
  416. // close curl resource to free up system resources
  417. curl_close($ch);
  418. $bck = new DB();
  419. $bck->query("DELETE FROM `backups` WHERE id = '".$backid."'")->run();
  420. echo $output;
  421. echo $filenameback;
  422. }
  423.  
  424.  
  425. }
  426. }else{
  427.  
  428. }
  429. }
  430. }
  431. }else{
  432. echo 'Apikey not true';
  433. }
  434. }else{
  435. echo 'Apikey not set.';
  436. }?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement