Advertisement
Guest User

Untitled

a guest
Feb 24th, 2016
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.65 KB | None | 0 0
  1. <?php
  2.  
  3. $db_hostname = 'localhost';
  4. $db_database = 'social';
  5. $db_username = 'root';
  6. $db_password = '';
  7.  
  8. $connection = new mysqli($db_hostname,$db_username,$db_password, $db_database);
  9. if ($connection->connect_error)  {  echo ($connection->connect_error);}
  10.  
  11. if (isset($_POST['login']) && isset($_POST['pass'])) {
  12.     $login = get_post($connection, 'login');
  13.     $pass = get_post($connection, 'pass');
  14.     $query = "INSERT INTO logins VALUES" .
  15.         "('$login', '$pass')";
  16.     $result=$connection->query($query);
  17. }
  18.  
  19.  
  20.  
  21. function get_post($connection, $var)
  22. {
  23.     return $connection->real_escape_string($_POST[$var]);
  24. }
  25. print_r($_POST);
  26. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement