| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 | 
							- <?php
 - require_once "utils.php";
 - require_once "misc/config.php";
 - 
 - function database_get()
 - {
 -   static $init = 0;
 -   static $database = NULL;
 -   if ($init == 0)
 -   {
 -     $init = 1;
 -     global $database_host;
 -     global $database_port;
 -     global $database_name;
 -     global $database_user;
 -     global $database_pass;
 -     try
 -     {
 -       $database = new PDO("mysql:host=$database_host;port=$database_port;".
 -                           "dbname=$database_name", $database_user,
 -                           $database_pass);
 -     }
 -     catch (Exception $e)
 -     {
 -       error(500, "Database Fail Connect");
 -     }
 -   }
 -   return $database;
 - }
 - 
 - function database_exec($query, $args)
 - {
 -   $q = database_get()->prepare($query);
 -   if (!$q->execute($args))
 -     error(500, "Database Fail Query");
 -   return $q;
 - }
 - 
 - function database_query($query)
 - {
 -   $q = database_get()->query($query);
 -   if (!$q)
 -     error(500, "Database Fail Query");
 -   return $q;
 - }
 - ?>
 
 
  |