Guest User

Untitled

a guest
Mar 21st, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. <?php include "../connect.php"; ?>
  2. <?php
  3. if(isset($_POST['submit'])) {
  4. global $username;
  5. global $password;
  6. $username = $_POST['username'];
  7. $password = $_POST['password'];
  8. if($username && $password) {
  9. connect();
  10. }
  11. }
  12. ?>
  13.  
  14.  
  15. // а вот и сама функция
  16.  
  17.  
  18. <?php include "../login.php"; ?>
  19. <?php
  20. function connect() {
  21. global $connection;
  22. $connection = mysqli_connect('localhost', 'root', 'root', 'loginapp');
  23. $query = "INSERT INTO users(username, password) ";
  24. $query .= "VALUES('$username', '$password')";
  25. $result = mysqli_query($connection, $query);
  26. }
  27. ?>
Add Comment
Please, Sign In to add comment