Commit Briefs

ae60eff141 mischa

fix formatting (main)


d2d3c30b4a mischa

remove not needed functions


04d41647bc mischa

0.4


d1f0b54ff5 mischa

Exception handling for INSERT


73c1957129 mischa

README added PRIMARY KEY


a7e8264c49 mischa

v0.3



0466bd0720 mischa

release 0.2



7c5f1fcd82 mischa

durp... COUNT(*)


Branches

Tags

This repository contains no tags

Tree

.gitignorecommits | blame
README.mdcommits | blame
conf.php-samplecommits | blame
index.phpcommits | blame

README.md

## Shortr

Single PHP URL Shorter

Database and table needed, build on MariaDB / MySQL:

	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,
	  PRIMARY KEY (`id`)
	) ENGINE=InnoDB DEFAULT CHARSET=latin1;


Example OpenBSD httpd.conf

	server "host.domain.tld" {
		listen on $local_v4 port 80
		tcp { nodelay, sack }
		log style forwarded
		root "/htdocs/host.domain.tld/shortr"
		directory { index "index.php" }
		location match "^/[%l%u%d]+$" {
			request rewrite "/index.php?hash=%1"
		}
		location "/*.php*" {
			fastcgi socket "/run/php-fpm.sock"
		}
	}

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');
	define("DB_USER", 'shortr');
	define("DB_PASS", 'RandomStringOfChars');
	define("DB_NAME", 'shortr');
	define("DB_TABLE", 'urls');