Wayc0de

SQL Dumper

Mar 19th, 2012
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.31 KB | None | 0 0
  1. <!---S4l1ty SQL DUMPER---->
  2. <head>
  3. <title>SQL DUMPER</title>
  4. <link rel="shortcut icon" href="http://i1230.photobucket.com/albums/ee494/rival123/emote/evilgrin.gif" />  
  5. <style type="text/css">
  6. body {background:#EDF0EE; color:#00FF33;}
  7. #dumper { margin:auto; width:302px; height:auto; border:solid 1px;}
  8. #column {border:solid 1px #00FF00; width:auto; height:auto; float:left; margin:0px 20px 0px 5px; padding:5px 20px 10px 10px; background-color:#000000;}
  9. #column a:link {text-decoration:none; color:#00FF33;}
  10. #column a:hover {text-decoration:underline; color:#00FFFF; background-color:#663399}
  11. #column a:visited {text-decoration:blink; color:#FF0000;}
  12. #column td:hover {background-color:#663399; border:solid 1px #00FF00;}
  13. #column h3 {font-family:Georgia, "Times New Roman", Times, serif;font-size:16px; color:#66FFFF;}
  14.  
  15. #table { border:solid 1px #00FF00;width:auto; height:auto; float:left; margin:0px 20px 0px 20px; padding:5px 20px 10px 10px; background-color:#000000;}
  16. #table a:link {text-decoration:none; color:#00FF33;}
  17. #table a:hover {text-decoration:underline; color:#00FFFF; background-color:#663399}
  18. #table a:visited {text-decoration:blink; color:#FF0000;}
  19. #table h3 {font-family:Georgia, "Times New Roman", Times, serif;font-size:18px; color:#66FFFF;}
  20. #table td:hover {background-color:#663399; border:solid 1px #00FF00;}
  21.  
  22. </style>
  23. </head>
  24.  
  25. <body>
  26. <?
  27. $dbhost = $_REQUEST['dbhost'];
  28. $user   = $_REQUEST['user'];
  29. $pass   = $_REQUEST['pass'];
  30. $dbname = $_REQUEST['dbname'];
  31. $table = "customers";
  32.  
  33. if(empty($dbhost))
  34. {print "<div id=dumper><form id=DBLOGIN name=DBLOGIN method=post action=>
  35.  <table width=302 border=0>
  36.    <tr>
  37.      <td width=97>Server</td>
  38.      <td width=189><label>
  39.        <input name=dbhost type=text id=dbhost />
  40.      </label></td>
  41.    </tr>
  42.    <tr>
  43.      <td>Username</td>
  44.      <td><label>
  45.        <input name=user type=text id=user />
  46.      </label></td>
  47.    </tr>
  48.    <tr>
  49.      <td>Password</td>
  50.      <td><label>
  51.        <input name=pass type=text id=pass />
  52.      </label></td>
  53.    </tr>
  54.    <tr>
  55.      <td>Database</td>
  56.      <td><label>
  57.        <input name=dbname type=text id=dbname />
  58.      </label></td>
  59.    </tr>
  60.    <tr>
  61.      <td colspan=2 align=right valign=middle><label>
  62.        <input type=submit name=Submit value=Connect />
  63.      </label></td>
  64.    </tr>
  65.  </table>
  66. </form></div>";
  67. }else{
  68. echo "
  69. <table width=100% border=0 align=center>
  70.  <tr>
  71.    <td width=14% align=left valign=top>";
  72.    
  73. if (!@mysql_connect($dbhost,$user,$pass))
  74. { echo "Could not connect to mysql";}
  75.  
  76. if (!@mysql_select_db($dbname))
  77. { echo "No database selected"; }
  78. echo "<div id=table><center><h3>MYSQL Table List</h3></center><table border=0>";
  79.  
  80. $listtbl = mysql_list_tables($dbname);
  81. $num_rows = mysql_num_rows($listtbl);
  82. for ($i = 0; $i < $num_rows; $i++) {
  83. $tablelist = mysql_tablename($listtbl, $i);
  84. echo "<tr><td><small><a href=?s4l1ty=GetAllFrom&dbhost=$dbhost&dbname=$dbname&user=$user&pass=$pass&table=$tablelist>$tablelist</a></small></td></tr>";
  85.     }
  86. echo "</table></div>";
  87.  
  88. echo "</td>";
  89.     echo "<td width=86% align=left valign=top><table width=100% border=0>
  90.      <tr>
  91.        <td width=100% height=485 align=left valign=top><label><small>";
  92.             $usedb = mysql_connect($dbhost,$user,$pass);
  93.             $table = $_REQUEST['table'];
  94.             echo "<div id=column><h3>Column of $table</h3><table border=0 width=100%>";
  95.            
  96.            
  97.  
  98.             $fields = mysql_list_fields($dbname,$table,$usedb);
  99.             $columns = mysql_num_fields($fields);
  100.            
  101.             for ($i = 0; $i < $columns; $i++) {
  102.             $colum = mysql_field_name($fields, $i);
  103.            
  104.             echo "<tr><td><small><a href=?s4l1ty=GetAllFrom&dbhost=$dbhost&dbname=$dbname&user=$user&pass=$pass&table=$table&column=$colum>$colum</a></small></td></tr>";
  105.             }
  106.             echo "      </table></div>
  107.          </small>
  108.            <textarea name=textarea2 cols=40 rows=20>";
  109. $column = $_REQUEST['column']; 
  110. if (empty($column)) {echo "choose 1 column to see data";} else {   
  111. $data = mysql_query("SELECT * FROM $table");
  112. while ( $mask = mysql_fetch_array($data)){
  113. echo "$mask[$column]\n";}
  114. }
  115.            
  116.             echo "</textarea>
  117.          </label></td>
  118.        </tr>
  119.    </table></td>
  120.  </tr>
  121. </table>
  122. ";
  123. }
  124. ?>
  125. </body>
  126. </html>
  127. <!---End S4l1ty SQL DUMPER---->
Add Comment
Please, Sign In to add comment