Blob


1 ## Shortr
3 Single PHP URL Shorter
5 Database and table needed, build on MariaDB / MySQL:
7 CREATE DATABASE IF NOT EXISTS `shortr` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
8 USE `shortr`;
9 CREATE TABLE `urls` (
10 `id` varchar(255) NOT NULL,
11 `url` text DEFAULT NULL,
12 `timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
13 `ip` varchar(255) DEFAULT NULL,
14 `count` int(11) NOT NULL,
15 PRIMARY KEY (`id`)
16 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
19 Example OpenBSD httpd.conf
21 server "host.domain.tld" {
22 listen on $local_v4 port 80
23 tcp { nodelay, sack }
24 log style forwarded
25 root "/htdocs/host.domain.tld/shortr"
26 directory { index "index.php" }
27 location match "^/[%l%u%d]+$" {
28 request rewrite "/index.php?hash=%1"
29 }
30 location "/*.php*" {
31 fastcgi socket "/run/php-fpm.sock"
32 }
33 }
35 Configuration file needs to be renamed to conf.php
37 Configuration options:
39 define("HASH_LENGTH", 4);
40 define("SITE_TITLE", "NAME OF SITE");
41 define("BASE_URL", 'https://host.domain.tld/');
42 define("DB_HOST", 'localhost');
43 define("DB_USER", 'shortr');
44 define("DB_PASS", 'RandomStringOfChars');
45 define("DB_NAME", 'shortr');
46 define("DB_TABLE", 'urls');