f9bb164bba104e5c26d1782940848978a9e6e9cd
5 private $config_file = '/etc/dylansserver.ini';
7 protected $recaptcha_publickey;
8 protected $recaptcha_privatekey;
12 public function __construct() {
13 $config = parse_ini_file($this->config_file
, true);
14 $this->db
= new mysqli(
15 $config['database']['domain'],
16 $config['database']['user'],
17 $config['database']['password'],
18 $config['database']['database']);
19 if (mysqli_connect_errno()) {
20 echo "Problem connecting to database: ";
21 echo mysqli_connect_error();
24 $this->recaptcha_publickey
= $config['recaptcha']['publickey'];
25 $this->recaptcha_privatekey
= $config['recaptcha']['privatekey'];
26 $this->title
= $config['site']['default_title'];
27 $this->home_link
= $config['site']['home_link'];
30 public function query() {
31 $args = func_get_args();
32 $statement = $this->db
->prepare($args[0]);
33 $args = array_slice($args, 1);
34 call_user_func_array(array($statement, 'bind_param'), &$args);
35 $statement->execute();
37 $statement->store_result();
39 $data = $statement->result_metadata();
41 $fields[0] = &$statement;
42 while($field = $data->fetch_field()) {
43 $fields[] = &$row[$field->name
];
45 call_user_func_array("mysqli_stmt_bind_result", $fields);
47 while ($statement->fetch()) {
48 foreach ($row as $key=>$value) $return[$i][$key] = $value;
51 $statement->free_result();