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.

37 lines
1.0 KiB

<?php
class GatewayAdministrator
{
private $con;
public function __construct($con)
{
$this->con = $con;
}
public function addAdministrator($Administrator)
{
$query = "insert into Administratoristrator(id,username,password) values (:id,:username,:password);";
$this->con->executeQuery(
$query,
array(
':id' => array($Administrator->getId(), PDO::PARAM_INT),
':username' => array($Administrator->getUsername(), PDO::PARAM_STR),
':password' => array(password_hash($Administrator->getPassword(), PASSWORD_DEFAULT), PDO::PARAM_STR)
)
);
}
public function getCredential($login)
{
$query = "SELECT password FROM Administrator WHERE username = :login;";
$this->con->executeQuery($query, array(':login' => array($login, PDO::PARAM_STR)));
$results = $this->con->getResults();
if ($results == NULL) {
return false;
}
return $results[0]['password'];
}
}