SHARE
TWEET

Untitled

a guest Oct 23rd, 2017 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. error_reporting(E_ERROR);
  3. echo "\n\r\n\r" . 'PHPortal - The simple MYSQL client shell' . "\n\r\n\r";
  4. echo "Enter Database Host: ";
  5. $dbhost = trim(fgets(STDIN));
  6. echo "Enter Database Username: ";
  7. $dbUser = trim(fgets(STDIN));
  8. echo "Enter Database Password: ";
  9. $dbPass = trim(fgets(STDIN));
  10. echo "Enter Database Port: ";
  11. $dbPort = trim(fgets(STDIN));
  12.  
  13. if ($dbPass == "")
  14. {
  15. echo "Without db pass? Omg, please setup a password for your db.";
  16. }
  17.  
  18. if (strlen($dbPass) < 5)
  19.     {
  20.     echo "Um, please use a strong password.";
  21.     echo "Enter Database Password: ";
  22.     $dbPass = trim(fgets(STDIN));
  23.     echo "\n";
  24.     }
  25.  
  26. echo "Enter the Database Name: ";
  27. $dbName = trim(fgets(STDIN));
  28. echo "\n";
  29. $con = mysqli_connect($dbhost, $dbUser, $dbPass, $dbName, $dbPort) or die(" What are you doing? ");
  30.  
  31. if (mysqli_connect_errno())
  32.     {
  33.     echo "Oops! We couldn't connect to the database..\n";
  34.     die();
  35.     }
  36.   else
  37.     {
  38.     echo " Execute a MYSQL query: ";
  39.     $conz = trim(fgets(STDIN));
  40.     mysqli_query($con, "$conz");
  41.     mysqli_select_db($con, "$dbName");
  42.     $result = mysqli_query($con, "$conz");
  43.     if ($result != FALSE) echo " query was executed successfully\n ";
  44.     if ($result != TRUE) echo " query failed!\n ";
  45.     while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) print_r($row);
  46.     mysqli_free_result($result);
  47.     }
  48. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top