summaryrefslogtreecommitdiff
path: root/includes/libs/libmysql.php
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2013-03-17 14:48:15 +0100
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2013-03-17 14:48:15 +0100
commita89c396c01398878f69e4c4a191a8b32ac080646 (patch)
treeea069caec9805ef62dd760da5d2adc2d826d3714 /includes/libs/libmysql.php
parent750f24561a9b23c0072b35f31cec3bc2519675b8 (diff)
downloadwebsite-a89c396c01398878f69e4c4a191a8b32ac080646.tar.gz
website-a89c396c01398878f69e4c4a191a8b32ac080646.tar.bz2
website-a89c396c01398878f69e4c4a191a8b32ac080646.tar.xz
website-a89c396c01398878f69e4c4a191a8b32ac080646.zip
Initial jekyll-powered website for github pages
* Removed Registration form and related files (reCAPTCHA / SQL stuff) * Removed including news (needs an alternative solution)
Diffstat (limited to 'includes/libs/libmysql.php')
-rw-r--r--includes/libs/libmysql.php89
1 files changed, 0 insertions, 89 deletions
diff --git a/includes/libs/libmysql.php b/includes/libs/libmysql.php
deleted file mode 100644
index 5a3a06c..0000000
--- a/includes/libs/libmysql.php
+++ /dev/null
@@ -1,89 +0,0 @@
-<?php
-
-require_once "includes/conf/mysql.conf.php";
-
-class Database
-{
- // implement singleton pattern
- static private $instance = null;
-
- private $conn;
-
- static public function getInstance()
- {
- if (null === self::$instance)
- {
- self::$instance = new self;
- }
- return self::$instance;
- }
-
- // ctor
- private function __construct()
- {
- global $conf;
- $this->conn = mysql_connect( $conf['mysql_hostname'],
- $conf['mysql_username'],
- $conf['mysql_password'] )
- or die ("Connection to database failed!" . mysql_error());
-
- mysql_select_db( $conf['mysql_database'], $this->conn )
- or die ("Selection of database failed! " . mysql_error());
- }
-
- private function checkConnect()
- {
- if (!isset($this->conn))
- {
- die("Not connected to database");
- }
- }
-
- // returns the value in the first row and column
- public function getValue( $sql )
- {
- $this->checkConnect();
-
- $res = mysql_query( $sql, $this->conn );
- if (!$res)
- {
- die('Error while calling database: ' . mysql_error());
- }
- $vals = mysql_fetch_row( $res );
- mysql_free_result( $res );
- return $vals[0];
- }
-
- // executes some sql and returns affected rows
- public function exec( $sql )
- {
- $this->checkConnect();
-
- $res = mysql_query( $sql, $this->conn );
- if (!$res)
- {
- die('Error while calling database: ' . mysql_error());
- }
- $numrows = mysql_affected_rows( $this->conn );
- return $numrows;
- }
-
- public function escape( $string )
- {
- $this->checkConnect();
-
- return mysql_real_escape_string( $string, $this->conn );
- }
-
- public function disconnect()
- {
- if ( mysql_ping( $this->conn ) )
- {
- mysql_close( $this->conn );
- }
- }
-
-}
-
-
-?> \ No newline at end of file