View difference between Paste ID: W4LaqgcQ and Gv3wE8yV
SHOW: | | - or go back to the newest paste.
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
?>