commit 83ef0ea335ea65697bf2752313a89d1fe762b617 Author: Phyks Date: Sun Oct 6 14:00:00 2013 +0100 Initial commit diff --git a/index.php b/index.php new file mode 100644 index 0000000..9496260 --- /dev/null +++ b/index.php @@ -0,0 +1,63 @@ + 1 || count($_GET) < 1) +{ + if (isset($_GET['add']) && $_GET['url']) + $default_url = htmlspecialchars($_GET['url']); + else + $default_url = ""; +?> + + + + + Réduis moi! + + + + +

C'est trop long ...

+
+

+ +

+

+ +

+

+

Ajouter ce lien pour réduire les URL en un seul clic : + Réduis moi ! +

+
+ + + diff --git a/misc/bg.png b/misc/bg.png new file mode 100644 index 0000000..0eb526a Binary files /dev/null and b/misc/bg.png differ diff --git a/misc/design.css b/misc/design.css new file mode 100644 index 0000000..ed08f10 --- /dev/null +++ b/misc/design.css @@ -0,0 +1,141 @@ +/* --- STYLES DE BASE --- */ + +/* Page */ +html { + font-size: 100%; /* Évite un bug d'IE 6-7. (1) */ +} +body { + margin: 0; + padding: 1em; /* Remettre à zéro si nécessaire. */ + font-family: Arial, Helvetica, "Liberation Sans", FreeSans, sans-serif; + font-size: .8em; + line-height: 1.4; /* À adapter au design. (4) */ + color: black; + background-color: grey; + background-image: url('bg.png'); +} + +pre +{ + font-size: 10px; + font-style: normal; + line-height: 11px; + font-weight: normal; + font-family: "Courier New", Courier, mono; + text-align: left; + margin-left: 40%; +} + +/* Titres */ +h1, h2, h3, h4, h5, h6 { + margin: 1em 0 .5em 0; /* Rapproche le titre du texte.*/ + line-height: 1.2; + font-weight: bold; /* Valeur par défaut.*/ + font-style: normal; +} +h1 { + font-size: 1.75em; +} +h2 { + font-size: 1.5em; +} +h3 { + font-size: 1.25em; +} +h4 { + font-size: 1em; +} + +/* Listes */ +ul, ol { + margin: .75em 0 .75em 32px; + padding: 0; +} + +/* Paragraphes */ +p { + margin: .75em 0; /* Marges plus faibles que par défaut.*/ +} +address { + margin: .75em 0; + font-style: normal; +} + +/* Liens */ +a { + text-decoration: underline; +} +a:link { +color : #0000cd; +} +a:visited { +color : #4b0082; +} +a:hover, a:focus, a:active { +color : #dc143c; +} +a img { + border: none; +} + +/* Divers éléments de type en-ligne*/ +em { + font-style: italic; +} +strong { + font-weight: bold; +} + +/* Formulaires */ +form, fieldset { + margin: 0; + padding: 0; +} +form +{ + border: none; +} + +/* Mise en forme simple pour les tableaux */ +table { + margin: 0; + border: 1px solid gray; /* Pas de bordure = "none". */ + border-collapse: collapse; /* Valeur par défaut: "separate". */ + border-spacing: 0; + margin: auto; +} +table td, table th { + padding: 4px; /* Pas de retrait autour du texte = "0". */ + border: 1px solid #ccc; /* Pas de bordure = "none". */ + vertical-align: top; /* Valeur par défaut: "middle" */ + text-align: left; +} + +body +{ + text-align: center; +} + +label /* On affiche les labels sous forme de blocs et mise en page = formulaires alignés */ +{ + display: block; +} + +th +{ + background-color: rgba(255,10,255,0.2); +} +td +{ + background-color: rgba(255,200,255,0.1); +} +.inline +{ + display: inline; +} + +.centre +{ + text-align:center; +} + diff --git a/process.php b/process.php new file mode 100644 index 0000000..b9fdddd --- /dev/null +++ b/process.php @@ -0,0 +1,73 @@ += $_CONFIG['SAVED_URL']) + { + // Delete the first element + array_shift($data); + } + // Add that to the array + array_push($data, $that); + return $data; +} + +if(empty($_POST['url'])) +{ + header('location : message.php?m=1'); +} +else +{ + if (is_readable($_CONFIG['DATA_DIR'].$_CONFIG['ASSOC_NAME'])) + $rawData = file_get_contents($_CONFIG['DATA_DIR'].$_CONFIG['ASSOC_NAME']); + else + { + touch($_CONFIG['DATA_DIR'].$_CONFIG['ASSOC_DIR']); + $rawData = ""; + } + if (empty($rawData)) + $data = array(); + else + $data = unserialize($rawData); + } +?> + + + + + Réduit moi ! + + + + +

C'était trop long !

+$url, "short"=>$short); + // Add the association at the end of $data array + $data = add($array); + // Save it in the file + file_put_contents($_CONFIG['DATA_DIR'].$_CONFIG['ASSOC_NAME'], serialize($data)); + // Echoes the result + $new_url = $_CONFIG['BASE_URL'].'/?'.$short; +?> +

Votre raccourci :
+

Réduction de : Retour à l'acceuil."; + }?> +

+ +