move some stuff out of the config, DEFINE debug

This commit is contained in:
mischa 2022-08-24 13:13:17 +00:00
parent 7c5f1fcd82
commit ed72d84587
3 changed files with 13 additions and 18 deletions

View File

@ -36,6 +36,7 @@ Configuration file needs to be renamed to conf.php
Configuration options:
define("HASH_LENGTH", 4);
define("SITE_TITLE", "NAME OF SITE");
define("BASE_URL", 'https://host.domain.tld/');
define("DB_HOST", 'localhost');

View File

@ -1,9 +1,5 @@
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
define("HASH_LENGTH", 4);
define("SITE_TITLE", "jn.gs");
define("BASE_URL", 'http://jn.gs/');
define("DB_HOST", 'localhost');
@ -11,16 +7,5 @@ define("DB_USER", 'shortr');
define("DB_PASS", 'RandomStringOfChars');
define("DB_NAME", 'shortr');
define("DB_TABLE", 'urls');
/*
CREATE DATABASE IF NOT EXISTS `shortr` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `shortr`;
CREATE TABLE `urls` (
`id` varchar(255) NOT NULL,
`url` text DEFAULT NULL,
`timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
`ip` varchar(255) DEFAULT NULL,
`count` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
*/
define("DEBUG", 'false');
>

View File

@ -3,13 +3,22 @@ require_once './conf.php';
define("SHORTER_NAME", "shortr");
define("SHORTER_VERSION", "v0.1");
define("HASH_LENGTH", 8);
define("CHARSET", "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
$url = "";
$link = "";
$callback = "NO";
if (DEBUG == 'true') {
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
} else {
ini_set('display_errors', 0);
ini_set('display_startup_errors', 0);
}
function db_connect() {
$dbh = new PDO('mysql:host='. DB_HOST . ';dbname='. DB_NAME , DB_USER, DB_PASS);
return $dbh;