Add time-out to password resets; prevent repeated mails #50

Open
Aaron wants to merge 7 commits from password-reset into master
Showing only changes of commit 978d6461c5 - Show all commits

View File

@ -59,6 +59,14 @@ class Database
return mysqli_fetch_assoc($resource);
}
/**
* Fetches a row from a given recordset, encapsulating into an object.
*/
public function fetch_object($resource, $class)
{
return mysqli_fetch_object($resource, $class);
}
/**
* Fetches a row from a given recordset, using numeric keys.
*/
@ -341,6 +349,41 @@ class Database
return $db_string;
}
/**
* Executes a query, returning an object of the row it returns.
*/
public function queryObject($class, $db_string, $db_values = [])
{
$res = $this->query($db_string, $db_values);
if (!$res || $this->num_rows($res) == 0)
return null;
$object = $this->fetch_object($res, $class);
$this->free_result($res);
return $object;
}
/**
* Executes a query, returning an array of objects of all the rows returns.
*/
public function queryObjects($class, $db_string, $db_values = [])
{
$res = $this->query($db_string, $db_values);
if (!$res || $this->num_rows($res) == 0)
return [];
$rows = [];
while ($object = $this->fetch_object($res, $class))
$rows[] = $object;
$this->free_result($res);
return $rows;
}
/**
* Executes a query, returning an array of all the rows it returns.
*/