1. Список говнокодов пользователя DarkThinker

    Всего: 12

  2. SQL / Говнокод #7845

    −112

    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
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    CREATE TRIGGER after_update_limit AFTER UPDATE ON limits
    FOR EACH ROW
    BEGIN
    	SET @annual_normative = NULL;
    	SET @ud_use = NULL;
    	SET @ud_disposal = NULL;
    	SET @placed_deposited = NULL;
    	SET @placed_disposal = NULL;
    	SET @custom1_disposal = NULL;
    	SET @custom1_deposited = NULL;
    	SET @custom1_use = NULL;
    	SET @custom1_neutralization = NULL;
    	SET @custom2_disposal = NULL;
    	SET @custom2_deposited = NULL;
    	SET @custom2_use = NULL;
    	SET @custom2_neutralization = NULL;
    	SET @custom3_disposal = NULL;
    	SET @custom3_deposited = NULL;
    	SET @custom3_use = NULL;
    	SET @custom3_neutralization = NULL;
    	SET @custom4_disposal = NULL;
    	SET @custom4_deposited = NULL;
    	SET @custom4_use = NULL;
    	SET @custom4_neutralization = NULL;
    	SET @custom5_disposal = NULL;
    	SET @custom5_deposited = NULL;
    	SET @custom5_use = NULL;
    	SET @custom5_neutralization = NULL;
    	SELECT
    		SUM(annual_normative), SUM(ud_use), SUM(ud_disposal), SUM(placed_deposited), SUM(placed_disposal),
    		SUM(custom1_disposal), SUM(custom1_deposited), SUM(custom1_use), SUM(custom1_neutralization),
    		SUM(custom2_disposal), SUM(custom2_deposited), SUM(custom2_use), SUM(custom2_neutralization),
    		SUM(custom3_disposal), SUM(custom3_deposited), SUM(custom3_use), SUM(custom3_neutralization),
    		SUM(custom4_disposal), SUM(custom4_deposited), SUM(custom4_use), SUM(custom4_neutralization),
    		SUM(custom5_disposal), SUM(custom5_deposited), SUM(custom5_use), SUM(custom5_neutralization)
    	INTO
    		@annual_normative, @ud_use, @ud_disposal, @placed_deposited, @placed_disposal,
    		@custom1_disposal, @custom1_deposited, @custom1_use, @custom1_neutralization,
    		@custom2_disposal, @custom2_deposited, @custom2_use, @custom2_neutralization,
    		@custom3_disposal, @custom3_deposited, @custom3_use, @custom3_neutralization,
    		@custom4_disposal, @custom4_deposited, @custom4_use, @custom4_neutralization,
    		@custom5_disposal, @custom5_deposited, @custom5_use, @custom5_neutralization
    	FROM limits
    	WHERE id_enterprise = NEW.id_enterprise;
    	UPDATE limits_total
    	SET
    		annual_normative = @annual_normative, ud_use = @ud_use, ud_disposal = @ud_disposal, placed_deposited = @placed_deposited, placed_disposal = @placed_disposal,
    		custom1_disposal = @custom1_disposal, custom1_deposited = @custom1_deposited, custom1_use = @custom1_use, custom1_neutralization = @custom1_neutralization,
    		custom2_disposal = @custom2_disposal, custom2_deposited = @custom2_deposited, custom2_use = @custom2_use, custom2_neutralization = @custom2_neutralization,
    		custom3_disposal = @custom3_disposal, custom3_deposited = @custom3_deposited, custom3_use = @custom3_use, custom3_neutralization = @custom3_neutralization,
    		custom4_disposal = @custom4_disposal, custom4_deposited = @custom4_deposited, custom4_use = @custom4_use, custom4_neutralization = @custom4_neutralization,
    		custom5_disposal = @custom5_disposal, custom5_deposited = @custom5_deposited, custom5_use = @custom5_use, custom5_neutralization = @custom5_neutralization
    	WHERE id_enterprise = NEW.id_enterprise
    	LIMIT 1;
    END;

    Сперва можно посмеяться, а затем подскажите, пжл, как тоже самое написать по человечески ???

    DarkThinker, 12 Сентября 2011

    Комментарии (11)
  3. PHP / Говнокод #7517

    +165

    1. 1
    2. 2
    foreach ($_POST as $kp => $post)
    	$_POST2[$kp] = $post;

    Это написано в самом начале того скрипта, что мне дали фиксить, в коде я встретил строчки описанные выше, а также деление на 0 и неправильно раставленные скобки в условиях с && и ||

    DarkThinker, 11 Августа 2011

    Комментарии (13)