-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUserManager.php
More file actions
32 lines (29 loc) · 981 Bytes
/
UserManager.php
File metadata and controls
32 lines (29 loc) · 981 Bytes
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
26
27
28
29
30
31
32
<?php
require 'Mysql.php';
class UserManager extends Mysql
{
function __construct($host_name,$db_name,$user,$contraseña)
{
parent::__construct($host_name,$db_name,$user,$contraseña);
}
public function createUser($username,$password){
$this->execStatementSetter("INSERT INTO users (id,user,pass) VALUES(null,:usuario,:pass)",array(':usuario'=>$username,':pass'=>$password));
}
public function validateUser($username,$password){
$resultados = $this->execStatementGetter('SELECT * FROM users WHERE user = :usuario AND pass = :password',array(':usuario' => $username,':password' => $password),false);
if ($resultados !== false) {
return true;
}else{
return false;
}
}
public function existsUser($username){
$resultados = $this->execStatementGetter("SELECT * FROM users WHERE user = :usuario LIMIT 1",array(':usuario' => $username),false);
if($resultados != false){
return true;
}else{
return false;
}
}
}
?>