Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
reddit clone in one line
<?/*shell: touch s;chmod 777 s;*/$w=array('type','text','value','name','input');function c($x,$v,$s=''){return $x->createElement($v,$s);}function a($x,$v){return $x->appendChild($v);}function s($x,$v,$s=''){return $x->setAttribute($v,$s);}$g=$_GET;$p=$_POST;if($p['l']&&$p['t']){file_put_contents('s',implode('§§',array(0,time(),strip_tags($p['l']),strip_tags($p['t'])))."\n",FILE_APPEND);}$d=new DOMDocument();$h=c($d,'head');a($h,c($d,'title','r'));$m=c($d,'html');a($m,$h);$b=c($d,'body');$f=c($d,'form');s($f,'method','post');$i=c($d,$w[4]);s($i,$w[0],$w[1]);s($i,$w[3],'t');s($i,$w[2],'title');a($f,$i);$i=c($d,$w[4]);s($i,$w[0],$w[1]);s($i,$w[3],'l');s($i,$w[2],'link');a($f,$i);$i=c($d,$w[4]);s($i,$w[0],'submit');a($f,$i);a($b,$f);$z=file_get_contents('s');if($z){$u=c($d,'ul');$z=explode("\n",$z);$z=array_reverse($z,true);foreach($z as $i => $y){if(!$y){continue;}$y=explode('§§',$y);$l=c($d,'li');$a=c($d,'a','^');s($a,'href','?u='.$i);a($l,$a);a($l,$d->createTextNode(' '.$y[0].' '));$a=c($d,'a','v');s($a,'href','?d='.$i);a($l,$a);a($l,$d->createTextNode(' - '));$a=c($d,'a',$y[3]);s($a,'href',$y[2]);a($l,$a);a($l,c($d,'br'));a($l,c($d,'small','added: '.date('H:i:s d.m.Y',$y[1])));a($u,$l);if($g['u']==$i){$y[0]++;}if($g['d']==$i&&$y[0]>0){$y[0]--;}$n[$i]=implode('§§',$y)."\n";}file_put_contents('s',array_reverse($n,true),LOCK_EX);a($b,$u);}a($m,$b);a($d,$m);echo $d->saveHTML();?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment