directory structure
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
DENY FROM ALL
|
||||
ALLOW FROM 127.0.0.1
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
class DB extends PDO
|
||||
{
|
||||
public function __construct($dsn, $username = null, $password = null, array $options = null)
|
||||
{
|
||||
parent::__construct($dsn, $username, $password, $options);
|
||||
}
|
||||
|
||||
static function openConnection()
|
||||
{
|
||||
$conn = null;
|
||||
try {
|
||||
$dataAccess = parse_ini_file("../configs/db.ini", true);
|
||||
|
||||
$conn = new PDO(
|
||||
"mysql:host=" . $dataAccess["ZEDAT"]["host"] .
|
||||
";dbname=" . $dataAccess["ZEDAT"]["database"] . ";charset=utf8",
|
||||
$dataAccess["ZEDAT"]["user"],
|
||||
$dataAccess["ZEDAT"]["passwd"],
|
||||
array(PDO::ATTR_PERSISTENT => false)
|
||||
);
|
||||
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$conn->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
|
||||
} catch (PDOException $exc) {
|
||||
echo $exc->getMessage();
|
||||
}
|
||||
return $conn;
|
||||
}
|
||||
|
||||
static function closeConnection(&$conn)
|
||||
{
|
||||
$conn = null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
ini_set("display_errors", 1);
|
||||
ini_set("default_charset", "utf-8");
|
||||
error_reporting(E_ALL);
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
class Headers
|
||||
{
|
||||
static function json()
|
||||
{
|
||||
header('Content-Type: text/html; charset=utf-8');
|
||||
header("Content-Type: text/json");
|
||||
}
|
||||
|
||||
static function html()
|
||||
{
|
||||
header('Content-Type: text/html; charset=utf-8');
|
||||
}
|
||||
|
||||
static function redirect(string $newUrl, bool $permanent = FALSE)
|
||||
{
|
||||
header('Location: ' . $newUrl, true, $permanent ? 301 : 302);
|
||||
|
||||
exit();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user