home *** CD-ROM | disk | FTP | other *** search
/ Exame Informatica 139 / Exame Informatica 139.iso / Revista / Flash / Uniform Server / diskw / home / admin / www / phpMyBackupPro / index.php < prev    next >
Encoding:
PHP Script  |  2005-07-14  |  6.1 KB  |  126 lines

  1. <?php
  2. /*
  3.  +--------------------------------------------------------------------------+
  4.  | phpMyBackupPro                                                           |
  5.  +--------------------------------------------------------------------------+
  6.  | Copyright (c) 2004-2005 by Dirk Randhahn                                 |
  7.  | http://www.phpMyBackupPro.net                                                                                                                                                                                |
  8.  | version information can be found in definitions.php.                     |
  9.  |                                                                          |
  10.  | This program is free software; you can redistribute it and/or            |
  11.  | modify it under the terms of the GNU General Public License              |
  12.  | as published by the Free Software Foundation; either version 2           |
  13.  | of the License, or (at your option) any later version.                   |
  14.  |                                                                          |
  15.  | This program is distributed in the hope that it will be useful,          |
  16.  | but WITHOUT ANY WARRANTY; without even the implied warranty of           |
  17.  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            |
  18.  | GNU General Public License for more details.                             |
  19.  |                                                                          |
  20.  | You should have received a copy of the GNU General Public License        |
  21.  | along with this program; if not, write to the Free Software              |
  22.  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.|
  23.  +--------------------------------------------------------------------------+
  24. */
  25.  
  26. require_once("login.php");
  27. PMBP_print_header(ereg_replace(".*/","",$_SERVER['SCRIPT_NAME']));
  28.  
  29. // if PMBP_GLOBAL_CONF.php is not writeable
  30. if (!is_writeable(PMBP_GLOBAL_CONF)) echo "<div class=\"red_left\">".I_CONF_ERROR."</div>\n";
  31.  
  32. // if export directory is not writeable
  33. if (!is_writeable("./".PMBP_EXPORT_DIR)) echo "<div class=\"red_left\">".I_DIR_ERROR."</div>\n";
  34.  
  35. // if first use or no db-connection possible
  36. if (!@mysql_connect($CONF['sql_host'],$CONF['sql_user'],$CONF['sql_passwd']))  echo "<div class=\"red_left\">".C_WRONG_SQL."</div>\n";
  37. if ($CONF['sql_db']) if (!@mysql_select_db($CONF['sql_db'])) echo "<div class=\"red_left\">".C_WRONG_DB."</div>\n";
  38.  
  39. echo "<br><div class=\"bold_left\">".I_NAME." ".PMBP_VERSION."</div>";
  40. printf(I_WELCOME,"<a href=\"".PMBP_WEBSITE."\">".PMBP_WEBSITE."</a>");
  41.  
  42. // get all system informations
  43. if (!($server=$_SERVER["SERVER_SOFTWARE"])) $server=PMBP_I_NO_RES;
  44. if (function_exists("phpversion")) {
  45.     $tmp=phpversion();
  46.     $phpvers=$tmp[0].$tmp[1].$tmp[2];
  47.     if ($phpvers>=4.3) $php=$tmp; else $php="<span class=\"red_left\">".$tmp."</span>";
  48. } else {
  49.     $php=PMBP_I_NO_RES;
  50. }
  51. if (!($memory_limit=@ini_get("memory_limit"))) $memory_limit=PMBP_I_NO_RES;
  52. if (@ini_get("safe_mode")=="1") $safe_mode=F_YES; else $safe_mode="<span class=\"red_left\">".F_NO."</span>";
  53. if (function_exists("ftp_connect")) $ftp=F_YES; else $ftp="<span class=\"red_left\">".F_NO."</span>";
  54. if (function_exists("mail")) $mail=F_YES; else $mail="<span class=\"red_left\">".F_NO."</span>";
  55. if (function_exists("gzopen")) $gzip=F_YES; else $gzip=F_NO;
  56. if (!function_exists("mysql_get_server_info")) $mysql_s=PMBP_I_NO_RES; else $mysql_s=@mysql_get_server_info();
  57. if (!function_exists("mysql_get_client_info")) $mysql_c=PMBP_I_NO_RES; else $mysql_c=@mysql_get_client_info();
  58.  
  59. // calculate size of all backups and last backup date
  60. $all_files=PMBP_get_backup_files();
  61. if (is_array($all_files)) {
  62.     $last_backup=0;
  63.     $size_sum=0;
  64.     foreach($all_files as $filename) {
  65.         $file="./".PMBP_EXPORT_DIR.$filename;
  66.         $size_sum+=PMBP_file_info("size",$file);
  67.         if (($time=PMBP_file_info("time",$file))>$last_backup) $last_backup=$time;
  68.     }
  69.     $size_sum=PMBP_size_type($size_sum);
  70.     $size=$size_sum['value']." ".$size_sum['type'];
  71.     $time=strftime($CONF['date'],$last_backup);
  72. } else {
  73.     $size="0 kb";
  74.     $time="?";
  75. }
  76. $scheduled_time=$PMBP_SYS_VAR['last_scheduled'];
  77. foreach($PMBP_SYS_VAR as $key=>$value) {
  78.     if (substr($key,0,15)=="last_scheduled_" && $value>$scheduled_time) $scheduled_time=$value;
  79. }
  80. if ($scheduled_time) $scheduled_time=strftime($CONF['date'],$scheduled_time); else $scheduled_time="-";
  81.  
  82. // print system informations
  83. echo "<br><br><div class=\"bold_left\">".PMBP_I_INFO."</div>";
  84. echo "<table>\n";
  85. echo "<th colspan=\"5\" class=\"active\">".PMBP_I_SERVER."</th>";
  86. echo "</tr><tr>\n";
  87. echo "<td class=\"list\" colspan=\"3\">".$server."</td>\n";
  88. echo "<td> </td>";
  89. echo "<td class=\"list\">".PMBP_I_TIME.": ".strftime($CONF['date'],time())."</td>\n";
  90. echo "</tr><tr>\n";
  91. echo "<th colspan=\"5\" class=\"active\">PHP</th>";
  92. echo "</tr><tr>\n";
  93. echo "<td class=\"list\">".PMBP_I_PHP_VERS.": ".$php."</td>\n";
  94. echo "<td> </td>";
  95. echo "<td class=\"list\">".PMBP_I_SAFE_MODE.": ".$safe_mode."</td>\n";
  96. echo "<td> </td>";
  97. echo "<td class=\"list\">".PMBP_I_MEM_LIMIT.": ".$memory_limit."</td>\n";
  98. echo "</tr><tr>\n";
  99. echo "<td class=\"list\">".PMBP_I_GZIP.": ".$gzip."</td>\n";
  100. echo "<td> </td>";
  101. echo "<td class=\"list\">".PMBP_I_MAIL.": ".$mail."</td>\n";
  102. echo "<td> </td>";
  103. echo "<td class=\"list\">".PMBP_I_FTP.": ".$ftp."</td>\n";
  104. echo "</tr><tr>\n";
  105. echo "<th colspan=\"5\" class=\"active\">MySQL</th>";
  106. echo "</tr><tr>\n";
  107. echo "<td class=\"list\" colspan=\"3\">".PMBP_I_SQL_SERVER.": ".$mysql_s."</td>\n";
  108. echo "<td> </td>";
  109. echo "<td class=\"list\">".PMBP_I_SQL_CLIENT.": ".$mysql_c."</td>\n";
  110. echo "</tr><tr>\n";
  111. echo "<th colspan=\"5\" class=\"active\">".F_BACKUP."</th>";
  112. echo "</tr><tr>\n";
  113. echo "<td class=\"list\">".B_SIZE_SUM.": ".$size."</td>\n";
  114. echo "<td> </td>";
  115. echo "<td class=\"list\">".B_LAST_BACKUP.": ".$time."</td>\n";
  116. echo "<td> </td>";
  117. echo "<td class=\"list\">".PMBP_I_LAST_SCHEDULED.": ".$scheduled_time."</td>\n";
  118. echo "</tr><tr>\n";
  119. echo "<th colspan=\"5\" class=\"active\">".LI_LOGIN."</th>";
  120. echo "</tr><tr>\n";
  121. echo "<td colspan=\"5\" class=\"list\">".PMBP_I_LAST_LOGIN.": ".$PMBP_SYS_VAR['last_login']."</td>\n";
  122. echo "</tr></table>";
  123.  
  124. PMBP_print_footer();
  125. ?>
  126.