Last active
February 3, 2017 09:49
-
-
Save bdelespierre/5533867 to your computer and use it in GitHub Desktop.
A very simple PHP chat on 1 instruction (no loop, no closure, no control structure)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php ($_='[["accueil","messages","contact","vider"],["Menu","Votre message","d/m/Y H:i:s","message","Envoyer","Me Contacter","benjamin.delespierre@gmail.com","chat.log","Fichier supprimé","Messages"]]') &&($_GET+=['p'=>null]) &&in_array($p = $_GET['p'], (($j=json_decode($_,true))&&($s=$j[0])&&($w=$j[1])) ? $s : array()) ?($s[0]==$p &&array_shift($s) &&print('<h1>'.$w[0].'</h1><ul><li>'.implode('</li><li>',array_map('sprintf',array_fill(0, count($s), '<a href="?p=%s">%s</a>'),$s,$s))))||($r=sprintf('<a href="?p=%s">%s</a>',$s[0],$s[0])) &&(($s[1]==$p &&vprintf('<h1>%s</h1>%s<hr/>%s<hr/>'.$r,array($w[3],sprintf('<form action="?p=%s" method="post"><input name="n" placeholder="%s"><button type="submit">%s</button></form>',$p,$w[1],$w[4]),((isset($_POST['n']) &&($h = fopen($w[7],'a+')) &&fwrite($h, date($w[2]).": {$_POST['n']}\n")) ? '' : '').'<p>'. implode('</p><p>',is_file($w[7]) ? array_reverse(file($w[7])) : array()). '</p>')))||($s[2]==$p &&printf('<p><a href="mailto:%s">%s</a></p>'.$r,$w[6],$w[5]))||($s[3]==$p &&(is_file($w[7]) ?unlink($w[7]) && print("<p>{$w[8]}</p>{$r}") :print($r)))): header("Location: ?p={$s[0]}") ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment