You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
881 B
32 lines
881 B
<?php
|
|
|
|
class GatewayAdmin
|
|
{
|
|
private $con;
|
|
|
|
public function __construct($con){
|
|
$this->con = $con;
|
|
}
|
|
|
|
public function addAdmin($admin)
|
|
{
|
|
$query = "insert into admin(username,password) values (:username,:password);";
|
|
$this->con->executeQuery($query, array(':username' => array($admin->getUsername(), PDO::PARAM_STR),
|
|
':password' => array(password_hash($admin->getPassword(), PASSWORD_DEFAULT), PDO::PARAM_STR)
|
|
)
|
|
);
|
|
}
|
|
|
|
|
|
public function getCredential($login)
|
|
{
|
|
$query = "SELECT password FROM admin WHERE username = :login;";
|
|
$this->con->executeQuery($query, array(':login' => array($login, PDO::PARAM_STR)));
|
|
$results=$this->con->getResults();
|
|
return $results[0]['password'];
|
|
}
|
|
|
|
}
|
|
|
|
?>
|