"PHP" / Говнокод #10167 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  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 nucleartux, (Updated )

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

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

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

Помни, guest, за тобой могут следить!

    А не использовать ли нам bbcode?


    8