PageRenderTime 49ms CodeModel.GetById 23ms RepoModel.GetById 1ms app.codeStats 0ms

/phpmysqlautobackup/files/phpmysqlautobackup_extras.php

https://code.google.com/p/bilugcms/
PHP | 61 lines | 43 code | 3 blank | 15 comment | 6 complexity | c1f40289e732d00ccf1a7f3708029049 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, MPL-2.0-no-copyleft-exception
  1. <?php
  2. require_once("auth.php");
  3. /**********************************************************
  4. * phpMySQLAutoBackup *
  5. * Author: http://www.DWalker.co.uk *
  6. * Now released under GPL License *
  7. * *
  8. **********************************************************
  9. * Version Date Comment *
  10. * 0.2.0 7th July 2005 GPL release *
  11. * 0.3.0 19th June 2006 Upgrade *
  12. * - added ability to backup separate tables *
  13. * 0.4.0 Dec 2006 removed bugs/improved code *
  14. * 1.4.0 Dec 2007 improved faster version *
  15. **********************************************************/
  16. $phpMySQLAutoBackup_version="1.4.0";
  17. // ---------------------------------------------------------
  18. // For support and help please try the forum at: http://www.dwalker.co.uk/forum/
  19. function has_data($value)
  20. {
  21. if (is_array($value)) return (sizeof($value) > 0)? true : false;
  22. else return (($value != '') && (strtolower($value) != 'null') && (strlen(trim($value)) > 0)) ? true : false;
  23. }
  24. function xmail ($to_emailaddress,$from_emailaddress, $subject, $content, $file_name, $backup_type)
  25. {
  26. $mail_attached = "";
  27. $boundary = "----=_NextPart_000_01FB_010".md5($to_emailaddress);
  28. $mail_attached.="--".$boundary."\n"
  29. ."Content-Type: application/octet-stream;\n name=\"$file_name\"\n"
  30. ."Content-Transfer-Encoding: base64\n"
  31. ."Content-Disposition: attachment; \n filename=\"$file_name\"\n\n"
  32. .chunk_split(base64_encode($content))."\n";
  33. $mail_attached .= "--".$boundary."--\n";
  34. $add_header ="MIME-Version: 1.0\nContent-Type: multipart/mixed;\n boundary=\"$boundary\" \n\n";
  35. $mail_content="--".$boundary."\n"."Content-Type: text/plain; \n charset=\"iso-8859-1\"\n"."Content-Transfer-Encoding: 7bit\n\nBACKUP ESEGUITO CON SUCCESSO/BACKUP Successful...\n\nApri l'allegato per il file di Backup zippato\n\nPlease see attached for your zipped Backup file; $backup_type \nSe questo e' il primo backup e' consigliato verificare su un server di test che sia generato correttamente\n\nIf this is the first backup then you should test it restores correctly to a test server.\n\n phpMySQLAutoBackup is developed by http://www.dwalker.co.uk/ \n\n Have a good day now you have a backup of your MySQL db ;-) \n\nPlease consider making a donation at: \n http://www.dwalker.co.uk/make_a_donation.php \n (any amount is gratefully received)\n".$mail_attached;
  36. return mail($to_emailaddress, $subject, $mail_content, "From: $from_emailaddress\nReply-To:$from_emailaddress\n".$add_header);
  37. }
  38. function write_backup($gzdata, $backup_file_name)
  39. {
  40. $fp = fopen(LOCATION."../backups/".$backup_file_name, "w");
  41. fwrite($fp, $gzdata);
  42. fclose($fp);
  43. //check folder is protected - stop HTTP access
  44. /*if (!file_exists(".htaccess"))
  45. {
  46. $fp = fopen(LOCATION."../backups/.htaccess", "w");
  47. //fwrite($fp, "deny from all");
  48. fwrite($fp, "<Files ~ \"*.*\">");
  49. fwrite($fp, "Order allow,deny");
  50. fwrite($fp, "Deny from all");
  51. fwrite($fp, "Satisfy All");
  52. fwrite($fp, "</Files>");
  53. fclose($fp);
  54. }*/
  55. }
  56. ?>