Public paste
Undefined
By: Guest | Date: Apr 16 2014 04:12 | Format: None | Expires: never | Size: 532 B | Hits: 858

  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.    print "<PRE>";
  17.    print $a;
  18.    print "</PRE>"
  19. ?>