Commit Diff


commit - 7c5f1fcd82cd8cca52458c6cd94141d036eb20c0
commit + ed72d8458798f34c764db60a10f9c5036ddba4bc
blob - d01bea1cd42e9bc2884fcc51b34fb95981d93826
blob + 86974558e0cb8929c12837a079f2ed7b8b404117
--- README.md
+++ README.md
@@ -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');
blob - 96087a94ed6f53c4e47237e5c979909d89f0dba6
blob + ddd9a8bac83218e4bc643ac17db449af13927b78
--- conf.php-sample
+++ conf.php-sample
@@ -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');
 >
blob - 27b137ac3ec635df0672bc29d5dd23b8679ea19a
blob + 28b83c20600c4d8238176dbd214e595587bdc81b
--- index.php
+++ index.php
@@ -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;