Public paste
Undefined
By: Guest | Date: Apr 16 2014 05:22 | Format: None | Expires: never | Size: 695 B | Hits: 878

  1. <form method=GET action=query.php>
  2. <input type=text name=user value=testacct /><input type=text name=pass value=testacct123 />
  3. <br />
  4. <textarea rows=10 cols=50 name=query></textarea>
  5. <br />
  6. <input type=submit value=Query>
  7. </form>
  8. <?php
  9.    $user = $_GET['user'];
  10.    $pass = $_GET['pass'];
  11.    $query = $_GET['query'];
  12.  
  13.    $cmd = "mysql -u $user -h localhost --password=$pass -e \"$query\"";
  14.    print "Query: $cmd <br/>";
  15.    $a = shell_exec($cmd);
  16.    $a = "<TR><TD>" . $a;
  17.    $a = str_replace("\n", "</td></tr>\n", $a);
  18.    $a = str_replace("\t", "</td><td>";
  19.    $a = $a . "</TR></TD>";
  20.    print "<TABLE>";
  21.  
  22.    print $a;
  23.    print "</TABLE>"
  24. ?>