Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.49 KB | None | 0 0
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html>
  3.     <head>
  4.         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  5.         <title>Login page</title>
  6.     </head>
  7.     <body>
  8.         <center><h3>Enter your credentials</h3></center>
  9.  
  10.         <form name="Form1" method="post" action="index.php">
  11.  
  12.         Username: <input type="text" name="username" />
  13.         Password: <input type="text" name="password" />
  14.         <br/>DB Name: <input type="text" name="dbname" />
  15.         <input type="submit" name="submit" />
  16.         </form>
  17.        
  18.         <?php
  19.             if (isset($_POST['username']) && isset($_POST['password']) && isset($_POST['dbname']))
  20.             {
  21.                 $DB_name = $_POST["dbname"];
  22.                 $DB_user = $_POST["username"];
  23.                 $DB_password = $_POST["password"];
  24.  
  25.                 mysql_connect("localhost", "root", "ONGOINGwarfare1+2+3+");
  26.                 mysql_query("CREATE DATABASE $DB_name");
  27.                 mysql_query("CREATE USER $DB_user IDENTIFIED by '$DB_password'");
  28.                 mysql_query("GRANT all privileges ON $DB_name.* to '$DB_user'@'localhost' IDENTIFIED by '$DB_password'");
  29.                
  30.                 print "$DB_name was successfully created, now you can log into your database on Hive696 using the following line: <br>
  31.                        \"mysql -u$DB_user -p$DB_password;\"";
  32.  
  33.                 include ("dashboard.php");
  34.             }
  35.         ?>
  36.     </body>
  37. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement