Ejemplo n.º 1
0
                     $restore_query = ltrim(substr($restore_query, $i + 1));
                     $sql_length = strlen($restore_query);
                     $i = strpos($restore_query, ';') - 1;
                     if (eregi('^create*', $query)) {
                         $table_name = trim(substr($query, stripos($query, 'table ') + 6));
                         $table_name = substr($table_name, 0, strpos($table_name, ' '));
                         $drop_table_names[] = $table_name;
                     }
                 }
             }
         }
         smn_db_query('drop table if exists ' . implode(', ', $drop_table_names));
         for ($i = 0, $n = sizeof($sql_array); $i < $n; $i++) {
             smn_db_query($sql_array[$i]);
         }
         smn_session_close();
         smn_db_query("delete from " . TABLE_WHOS_ONLINE);
         smn_db_query("delete from " . TABLE_SESSIONS);
         smn_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key = 'DB_LAST_RESTORE'");
         smn_db_query("insert into " . TABLE_CONFIGURATION . " values (null, 'Last Database Restore', 'DB_LAST_RESTORE', '" . $read_from . "', 'Last database restore file', '6', '0', null, now(), '', '')");
         if (isset($remove_raw) && $remove_raw == true) {
             unlink($restore_from);
         }
         $messageStack->add_session(SUCCESS_DATABASE_RESTORED, 'success');
     }
     smn_redirect(smn_href_link(FILENAME_BACKUP));
     break;
 case 'download':
     $extension = substr($_GET['file'], -3);
     if ($extension == 'zip' || $extension == '.gz' || $extension == 'sql') {
         if ($fp = fopen(DIR_FS_BACKUP . $_GET['file'], 'rb')) {
Ejemplo n.º 2
0
function smn_exit()
{
    smn_session_close();
    exit;
}