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

    +157

    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
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    function tedit_object() 
    {
    		if($this->authlib->logged_in()) {
    			$manager = $this->authlib->logged_manager_data();
    			
    			
    			$object_id = $this->input->post('object_id');
    			
    			$type = $this->input->post('type');
    			$doprice = $this->input->post('doprice');
    			$price = $this->input->post('price');
    			$valute = $this->input->post('valute');
    			$dop = $this->input->post('dop');
    			
    			$dozag = $this->input->post('dozag');
    			$zag = $this->input->post('zag');
    			$poslezag = $this->input->post('poslezag');
    		
    			$rajon = $this->input->post('rajon');
    			$naselenp = $this->input->post('naselenp');
    			$opisanie = $this->input->post('opisanie');
    			$coordinatesgmap = $this->input->post('coordinatesgmap');
    			$dorprice = $this->input->post('dorprice');
    			$porprice = $this->input->post('porprice');
    						
    			$domorepered = $this->input->post('domorepered');
    			$domore = $this->input->post('domore');
    			$domoreposle = $this->input->post('domoreposle');
    			$sdanpered = $this->input->post('sdanpered');
    			$sdan = $this->input->post('sdan');
    			$stars = $this->input->post('stars');
    			$kakchestvo = $this->input->post('kakchestvo');
    			$jivetpered = $this->input->post('jivetpered');
    			$jivet = $this->input->post('jivet');
    			$jivetposle = $this->input->post('jivetposle');
    			$jivetposle2 = $this->input->post('jivetposle2');
    			$rprice = $this->input->post('rprice');
    			$vip = $this->input->post('vip');
    			
    													
    			$data_to_object = array(
    					  'manager_id' => $manager['id'],
    					  
    					  'type_id' => $type,
    					  'dorprice' => $dorprice,
    					  'doprice' => $doprice,
    					  'porprice' => $porprice,
    					  'price' => $price,
    					  'valute_id' => $valute,
    					  'dop' => $dop,					  					  
    
    					  'dozag' => $dozag,
    					  'zag' => $zag,
    					  'poslezag' => $poslezag,
    
    						'domorepered' => $domorepered,
    						'domore' => $domore,
    						'domoreposle' => $domoreposle,
    						'sdanpered' => $sdanpered,
    						'sdan' => $sdan,
    						'stars' => $stars,
    						'kakchestvo' => $kakchestvo,
    						'jivetpered' => $jivetpered,
    						'jivet' => $jivet,
    						'jivetposle' => $jivetposle,
    						'jivetposle2' => $jivetposle2,
    						'rprice' => $rprice,
    						'vip' => $vip,
    						'map' => $coordinatesgmap,
    											  
    					  'naselenp' => $naselenp,
    					  'rajon' => $rajon,
    					  'desc' => $opisanie,
    					  
    					  'modified' => date('Y-m-d H:i:s')
    				);
    
    			$this->db->where('id', $object_id);
    			$this->db->update('object_only', $data_to_object);
    			///echo $object_id;
    			redirect('/edit_object/'.$object_id, 'refresh'); 
    			
    					
    		
    		} else { redirect('/authorization/', 'refresh'); }
    		
    		
    
    	
    }

    Любимый проект <3

    Uhehesh, 25 Августа 2014

    Комментарии (2)
  2. Java / Говнокод #16590

    +76

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    private Boolean active = false;
    ...
    synchronized (active) {
    ...
    }

    Чудо синхронизации. Блокируется раз и навсегда.

    borka, 25 Августа 2014

    Комментарии (16)
  3. C++ / Говнокод #16589

    +53

    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
    void _debugPrintWaveHeader(const char *path, const WAVHEADER &source_header)
    {
    	FILE *debug = fopen("path", "wt");
    	fprintf(debug, "chunkId    = %s\n", source_header.chunkId);
    	fprintf(debug, "chunkSize  = %u\n", source_header.chunkSize);
    	fprintf(debug, "format     = %s\n", source_header.format);
    	fprintf(debug, "subCh1Id   = %s\n", source_header.subchunk1Id);
    	fprintf(debug, "subCh1Size = %u\n", source_header.subchunk1Size);
    	fprintf(debug, "audioform  = %u\n", source_header.audioFormat);
    	fprintf(debug, "numChanels = %u\n", source_header.numChannels);
    	fprintf(debug, "sampleRate = %u\n", source_header.sampleRate);
    	fprintf(debug, "byteRate   = %u\n", source_header.byteRate);
    	fprintf(debug, "blockAlign = %u\n", source_header.blockAlign);
    	fprintf(debug, "bitsPerSam = %u\n", source_header.bitsPerSample);
    	fprintf(debug, "subCh2Id   = %s\n", source_header.subchunk2Id);
    	fprintf(debug, "subCh2Size = %u\n", source_header.subchunk2Size);
    	fclose(debug);
    }

    Начал разгребать один говнопроект... При отладке программа всё падает и падает, падает и не может остановится. Смотрю на код - все в норме, а потом, по прошествии нескольких часов...

    GreatMASTERcpp, 25 Августа 2014

    Комментарии (33)
  4. C++ / Говнокод #16588

    +58

    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
    if(ext == ".wav")
    		{
    			if(main_header.bitsPerSample == 8)
    			{
    				switch(main_header.bitsPerSample)
    				{
    					case 8:
    					{
    						open_mode = n8bit_mode;
    					}break;
    					case 16:
    					{
    						open_mode = n16bit_mode;
    					}break;
    					default: open_mode = nNULL;
    				}
    ....далее какото код
    }

    ...

    GreatMASTERcpp, 25 Августа 2014

    Комментарии (9)
  5. Java / Говнокод #16587

    +121

    1. 1
    2. 2
    3. 3
    long longVariable = <...>;
    ...
    double doubleVariable = new Double(longVariable).doubleValue();

    Вот так делается по ВСЕМУ проекту, когда нужно перевести long в double.

    someone, 25 Августа 2014

    Комментарии (9)
  6. C# / Говнокод #16586

    +126

    1. 1
    2. 2
    3. 3
    using питух = String;
    ...
    protected питух AccessToken { get; set; }

    В память о плавающем

    reshetochnik, 24 Августа 2014

    Комментарии (24)
  7. PHP / Говнокод #16585

    +172

    1. 1
    if ($year == '1996' && $year == '1995' && $year == '1994' && $year == '1993' && $year == '1992' && $year == '1991' && $year == '1990' && $year == '1989' && $year == '1988' && $year == '1987' && $year == '1986' && $year == '1985' && $year == '1984' && $year == '1983' && $year == '1982' && $year == '1981' && $year == '1980' && $year == '1979' && $year == '1978' && $year == '1977' && $year == '1976' && $year == '1975' && $year == '1974' && $year == '1973' && $year == '1972' && $year == '1971' && $year == '1970' && $year == '1969' && $year == '1968' && $year == '1967' && $year == '1966' && $year == '1965' && $year == '1964' && $year == '1963' && $year == '1962' && $year == '1960' && $year == '1959' && $year == '1958' && $year == '1957' && $year == '1956' && $year == '1955' && $year == '1954' && $year == '1953' && $year == '1952' && $year == '1951' && $year == '1950')

    Я просто рыдаю. Мало того, что каждый год ручками вбит, так ещё и пользак должен обязательно быть рождённым во всех этих годах))

    avtorfox, 24 Августа 2014

    Комментарии (18)
  8. C# / Говнокод #16584

    +124

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    class A
    {
    a:
    Console.WriteLine("Буква А");
    goto b;
    }
    Class B:A
    {
    b:
    Console.WriteLine("Буква Б");
    goto a;
    }

    Моему другу было нечего делать... Побробовал засорить мой комп.

    qwertyru, 23 Августа 2014

    Комментарии (133)
  9. PHP / Говнокод #16583

    +164

    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
    public function is_number($s){
      $result = true;
      for($i=0;$i<strlen($s); $i++){
       switch($s[$i]){
        case '0': break;
        case '1': break;
        case '2': break;
        case '3': break;
        case '4': break;
        case '5': break;
        case '6': break;
        case '7': break;
        case '8': break;
        case '9': break;
        default: $result = false; return;
       }
      }
      return ($result) ? $s : int($s);
     }

    whiskeysam, 23 Августа 2014

    Комментарии (14)
  10. PHP / Говнокод #16582

    +158

    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
    function in($param) {
    	global
    		$_POST,
    		$_GET;
    
    	preg_match('#([^\[]+)(.*)#',$param,$match);
    	$match[2]=str_replace('[','["',$match[2]);
    	$match[2]=str_replace(']','"]',$match[2]);
    	$param2=eval('return htmlspecialchars(strip_tags($_POST["'.$match[1].'"]'.$match[2].'));');
    	if($param2=='' && $match[2]=='') {
    		$param2=eval('return htmlspecialchars(strip_tags($_GET["'.$match[1].'"]));');
    	}
    	return $param2;
    }

    Функция для фильтрации входящих переменных.

    berejant, 23 Августа 2014

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