Advertisement
Guest User

Untitled

a guest
Dec 14th, 2017
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.39 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <title>Vinyl Records Lda.</title>
  5. </head>
  6.  
  7. <body>
  8. <h1>Admin</h1>
  9. <div class="sign">
  10.     <div class="admin">
  11.         <form method="get" action="login_admin.php">
  12.             <input type="text" name="email" placeholder="email">
  13.             <input type="text" name="password" placeholder="password">
  14.                 <button type="submit" value="submit" class="submit">Submit</button>
  15.         </form>
  16.     </div>
  17. </div>
  18.  
  19. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  20. <script src="java.js"></script>
  21. </body>
  22.  
  23. </html>
  24.  
  25. <?php
  26. $servername = "localhost";
  27. $username = "root";
  28. $password = "";
  29. $dbname = "pros_si";
  30.  
  31.  
  32. $conn = new mysqli($servername, $username, $password, $dbname);
  33.  
  34.  
  35. if(isset($_GET['email']) and isset($_GET['password'])) {
  36.     $mail = $_GET['email'];
  37.     $pass = $_GET['password'];
  38.  
  39.     $admin = "INSERT INTO users (username, email, password, client_type, client_saldo)
  40. VALUES ('null - is an admin' , '$mail' , '$pass' , '0', 'null')";
  41.  
  42.     if ($conn->query($admin) === TRUE) {
  43.         echo "New record created successfully";
  44.         header( "Location: homepage_admin.php");
  45.     } else {
  46.         echo 'Record null. Try Again';
  47.     }
  48. }
  49.  
  50. // Check connection
  51. if ($conn->connect_error) {
  52.     die("Connection failed: " . $conn->connect_error);
  53. } else {
  54.     echo "Connection successful";
  55. }
  56.  
  57. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement