Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- #########
- # Script Title: CMSPwner v1.5 SQLDump module
- # Version: 1.5 Beta
- # Date: 10/08/12
- # Script Author: Xt3mP
- # Home: http://xt3mp.mx
- # For: http://r00tw0rm.com
- # Contact: xt3mp[at]null[dot]com
- # _____ _____ _____ _____
- # | | | __| _ |_ _ _ ___ ___ ___
- # | --| | | |__ | __| | | | | -_| _|
- # |_____|_|_|_|_____|__| |_____|_|_|___|_|
- #
- #########
- $server = 'localhost';
- $user = 'root';
- $pass = '';
- $db = 'wpwp';
- $pref = 'wp_';
- $dumpFile = 'dump.sql';
- $con = mysql_connect($server, $user, $pass);
- @mysql_select_db($db, $con);
- $tables = @mysql_query('SHOW TABLES');
- while($table = @mysql_fetch_object($tables))
- {
- if(substr($table->{'Tables_in_'.$db}, 0, strlen($pref)) == $pref)
- $cmsTables[] = $table->{'Tables_in_' . $db};
- }
- $dumpSQL = '--' . "\n" . '-- Generated by: CMSPwner v1.5' . "\n".'-- Author: Xt3mP' . "\n" . '-- Website: http://xt3mp.mx' . "\n" . '-- Database: ' . $db . "\n" . '-- Tables: ' . count($cmsTables) . "\n" . '-- ' . "\n\n";
- foreach($cmsTables as $table)
- {
- $tableQuery = @mysql_query('SELECT * FROM '.$table);
- $dumpSQL .= '--' . "\n" . '-- Table: ' . $table . "\n" . '--' . "\n\n";
- $dumpSQL .= 'DROP TABLE IF EXISTS `' . $table . "`;\n\n";
- $tableNumFields = @mysql_num_fields($tableQuery);
- if($tableNumFields > 0)
- {
- $tableStructure = @mysql_fetch_object(mysql_query('SHOW CREATE TABLE ' . $table));
- $dumpSQL .= $tableStructure->{'Create Table'} . ";\n\n";
- for($numField = 0; $numField < $tableNumFields; $numField++)
- {
- while($fields = @mysql_fetch_row($tableQuery))
- {
- $dumpSQL .= 'INSERT INTO ' . $table . ' VALUES (';
- for($idField = 0; $idField < $tableNumFields; $idField++)
- {
- $fieldData = addslashes($fields[$idField]);
- if(!empty($fieldData))
- $dumpSQL .= (is_numeric($fieldData)) ? $fieldData . ', ' : '"' . $fieldData . '" ,';
- else
- $dumpSQL .= '"", ';
- }
- $dumpSQL = substr($dumpSQL, 0, strlen($dumpSQL) - 2);
- $dumpSQL .= ');' . "\n";
- }
- }
- $dumpSQL .= "\n";
- }
- }
- $file = fopen($dumpFile, 'w+');
- fwrite($file, $dumpSQL);
- fclose($file);
- ?>
Add Comment
Please, Sign In to add comment