Advertisement
Guest User

Untitled

a guest
Jan 29th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.     function db_connection() {
  3.         global $db;
  4.  
  5.         if (!isset($db)) {
  6.        $db_u = 'root';
  7.    $db_p = 'lol';
  8.    $db = new pdo('mysql:host=130.211.168.124:3306;dbname=dropcloud',
  9.       $db_u,
  10.       $db_p
  11.    );
  12. }
  13.  
  14. return $db;
  15. }
  16.  
  17.    function login($u, $p) {
  18.         $db = db_connection();
  19.       $statement = $db->prepare('SELECT * from users WHERE username = :username AND password = :password');
  20.       $statement->execute(array(':username' => $u, ':password' => $p));
  21.       $row = $statement->fetch();
  22.    }
  23. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement