1. PHP / Говнокод #10167

    +90

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    if(!empty($_POST))
    {
    	include("dbconnect.php");
    
    	$shown_name=$_POST['shown_name'];
    	$username=$_POST['username'];
    	$header=$_POST['header'];
    	$text=$_POST['text'];
    
    	$date_array=getdate(time());
    
    	$date=$date_array['hours'].":".$date_array['minutes'].":".$date_array['seconds']." ".$date_array['weekday']." ".$date_array['mday']." ".$date_array['month']." ".$date_array['year'];
    
    
    	$filename=$date_array['hours']."-".$date_array['minutes']."-".$date_array['seconds']."-".$date_array['mday'].$date_array['month']."-".$date_array['year']."-".$username.".php";
    
    	$path="posts/".$filename;
    
    	$addpost="INSERT INTO posts(author, header, text, date, path) VALUES ('$shown_name', '$header', '$text', '$date', '$path')";
    	$add=$db->prepare($addpost);
    	$add->execute();
    
    
    
    
    	$file=fopen($path, 'w');
    	$content="<?php \$shown_name=\"".$shown_name."\"; \$header=\"".$header."\"; \$text=\"".$text."\";  include(\"template.html\"); ?>";
    
    	$write=fwrite($file, $content);
    
    	fclose($file);
    
    
    	header('Location: index.php');
    	$db=null;
    }

    Добавление поста в блог. Радует каждая строчка.

    Запостил: nucleartux, 02 Мая 2012

    Комментарии (5) RSS

    • Самомодифицирующийся форум?
      Ответить
    • Pretty URLs. The PHP way.
      Ответить
    • Пробегал глазами, в мыслях звучало "очередная несмешная хрень про ПХП, page do..." - тут на глаза попалось $content="<?php \$shown_name=. Всё ещё в полудрёме глянул на следующую строчку - вот тут уже проснулся и, наконец, рассмеялся. :)
      Ответить

    Добавить комментарий