aboutsummaryrefslogtreecommitdiff
blob: f0340e3b21ee9788d7892bcd40087dc28c980dd1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
   class MyDB extends SQLite3 {
      function __construct() {
         $this->open('users.db');
      }
   }

   if(isset($_POST['email'], $_POST['pass']))
   {
	$email = $_POST['email'];
	$pass = $_POST['pass'];

	$db = new MyDB();

	$sql = $db->prepare('SELECT * FROM Users WHERE email=:email AND password=:pass');
	$sql->bindValue(':email', $email, SQLITE3_TEXT);
	$sql->bindValue(':pass', $pass, SQLITE3_TEXT);

	$ret = $sql->execute();
	while($row = $ret->fetchArray(SQLITE3_ASSOC)) {
		echo 'Logged in as '.$row['email'].'<br>';
	}
	$db->close();
   }
?>