1. Лучший говнокод

    В номинации:
    За время:
  2. Java / Говнокод #1289

    +154

    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
    /**
    	 * public static final int ARRAY 2003 public static final int BIGINT -5
    	 * public static final int BINARY -2 public static final int BIT -7 public
    	 * static final int BLOB 2004 public static final int BOOLEAN 16 public
    	 * static final int CHAR 1 public static final int CLOB 2005 public static
    	 * final int DATALINK 70 public static final int DATE 91 public static final
    	 * int DECIMAL 3 public static final int DISTINCT 2001 public static final
    	 * int DOUBLE 8 public static final int FLOAT 6 public static final int
    	 * INTEGER 4 public static final int JAVA_OBJECT 2000 public static final
    	 * int LONGVARBINARY -4 public static final int LONGVARCHAR -1 public static
    	 * final int NULL 0 public static final int NUMERIC 2 public static final
    	 * int OTHER 1111 public static final int REAL 7 public static final int REF
    	 * 2006 public static final int SMALLINT 5 public static final int STRUCT
    	 * 2002 public static final int TIME 92 public static final int TIMESTAMP 93
    	 * public static final int TINYINT -6 public static final int VARBINARY -3
    	 * public static final int VARCHAR 12
    	 */
    	public Class getColumnClass(int column) {
                ...
            }

    guest, 30 Июня 2009

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

    +150

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    private int style;
    public int Style
    {
       get
       {
          return style;
       }
       {
          Style = value;
       }
    }

    Вечный двигатель!

    guest, 30 Июня 2009

    Комментарии (1)
  4. PHP / Говнокод #1262

    +148

    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
    <?php
    
    class db {
    
    function db_conn ($host,$user,$pass,$db) {
    	if((!$this->link = @mysqli_connect($host,$user,$pass)))
    		{
    		echo "<font color=\"red\">Error:</font> connect to host: $host";
    		exit();
    		}
    	if(!mysqli_select_db($this->link,$db))
    		{
    		echo "<font color=\"red\">Error:</font> select database $db";
    		exit();
    		}
    	}
    
    function sql_query ($query) {
    	$this->link = mysqli_query($this->link, $query);
    		if (!$this->link)
    			{
    			$this->error_msg = mysqli_error ($this->link);
    			return $this->error_msg;
    			}
    	return $this->link;
    	}
    
    function sql_fetch_assoc ($query) {
    		$res=$this->sql_query($query);
    		$array = array();
    		$row = mysqli_fetch_array($res);
    			/*{
    			$array[]=$cur;
    			}*/
    		mysqli_free_result($res);
    		return $row;
    	}
    }
    
    ?>

    guest, 26 Июня 2009

    Комментарии (1)
  5. C# / Говнокод #1260

    +141

    1. 1
    2. 2
    3. 3
    4. 4
    if((5<a).toString() == "true")
    {
    ля-ля
    }

    guest, 26 Июня 2009

    Комментарии (1)
  6. PHP / Говнокод #1252

    +139.8

    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
    unction int2hex($intega){
       $Ziffer = "0123456789ABCDEF";
    return $Ziffer[($intega%256)/16].$Ziffer[$intega%16];
    }
    
    function url_encode($text){
       $text = urlencode($text);
       if(!strpos($text,"%C3"))
           for($i=129;$i<255;$i++){
               $in = "%".int2hex($i);
               $out = "%C3%".int2hex($i-64);
               $text = str_replace($in,$out,$text);
           }
    return $text;
    }
    
    function tounicode ($string){
    $unistring="";
    for($i=0;$i<strlen($string);$i++){
    	$current=$string[$i];
    	$codcurrent=ord($current);
    	if($codcurrent>255):
           		$unicurrent=utf8_encode($current);
    		$unistring=$unistring.$unicurrent;
    	elseif($codcurrent<192):
    		if($codcurrent==184):
                           $unicurrent=chr(209).chr($codcurrent-39);
                           $unistring=$unistring.$unicurrent;
    		elseif($codcurrent==168):
                           $unicurrent=chr(208).chr($codcurrent-39);
                           $unistring=$unistring.$unicurrent;
    		elseif($codcurrent==147):
    				$unicurrent=utf8_encode("\"");
                            $unistring=$unistring.$unicurrent;
    		elseif($codcurrent==148):
    				$unicurrent=utf8_encode("\"");
                            $unistring=$unistring.$unicurrent;
    		elseif($codcurrent==151):
    				$unicurrent=utf8_encode("-");
                            $unistring=$unistring.$unicurrent;
    		
    		else:
                  		$unicurrent=utf8_encode($current);
                   		$unistring=$unistring.$unicurrent;
    		endif;
    	
    	else:
    		if ($codcurrent<240):
    			$unicurrent=chr(208).chr($codcurrent-48);
    			$unistring=$unistring.$unicurrent;
    		else:
    			$unicurrent=chr(209).chr($codcurrent-112);
    			$unistring=$unistring.$unicurrent;
    		endif;
    		
    	endif;
    }
    return $unistring;
    }

    guest, 25 Июня 2009

    Комментарии (1)
  7. JavaScript / Говнокод #1244

    +150.7

    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
    function login() {
    
    
    // Optional: Show a waiting message in the layer with ID ajax_response
    
    	var img_load="<img src=images/wait.gif alt=\"error\" width=\"100\" height=\"100\" /> ";
    	document.getElementById('login_response').innerHTML = img_load;
    	// Required: verify that all fileds is not empty. Use encodeURI() to solve some issues about character encoding.
    	var email = encodeURI(document.getElementById('emailLogin').value);
    	var psw = encodeURI(document.getElementById('pswLogin').value);
    	//var rem = encodeURI(document.getElementById('chkrem').value);
    	var rem = document.getElementById('chkrem').checked;
    if(document.getElementById('chkrem').checked==true)
    	{
           rem=1;
    	}
    	else
    if(document.getElementById('chkrem').checked==false)
    	{
              rem=0;
    	}
    	else
    	{
    		rem=0;
    	}
    
    
    		// Set te random number to add to URL request
    		nocache = Math.random();
    		// Pass the login variables like URL variable
    		var act;
    
    		act='login.php?email='+email+'&psw='+psw+'&remchk='+rem+'&nocache='+nocache;
    		//alert(act);
    		http.open('get', 'login.php?email='+email+'&psw='+psw+'&remchk='+rem+'&nocache='+nocache);
    		http.onreadystatechange = loginReply;
    		http.send(null);
    }

    Взято с одного непонятно кем разработанного зарубежного сайта, который (судя по забагованности и унылости) всё никак не может добраться до релиза.

    Код интересен двумя пассажами: строки 13-25 и 33-35

    guest, 24 Июня 2009

    Комментарии (1)
  8. PHP / Говнокод #1224

    +143.5

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    if (isset($_COOKIE['wrboardname'])) {
    	$wrboardname=$_COOKIE['wrboardname'];
    }
    
    // если в куках есть wrboardname, то забиваем данные куков в переменные, иначе выводим форму для входа
    if (isset($wrboardname)) {
    	print "<td align=right style='FONT-SIZE: 11px' width=100%><a href='tools.php?event=profile&pname=$wrboardname'>Ваш Профиль</a>&nbsp;&nbsp;<a href='tools.php?event=clearcooke'>Выход [$wrboardname]</a>";
    }

    Показан прекрасный метод, как нужно юзать куки))(wr-board 1.1)

    guest, 19 Июня 2009

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

    +148

    1. 1
    2. 2
    3. 3
    IAssignment assignment = serviceCall.getAssignment();
    assignment.setAssWorkgroup(object);
    assignment.transfer();

    Кусок кода с использованием API HP ServiceDesk

    guest, 18 Июня 2009

    Комментарии (1)
  10. Си / Говнокод #1201

    +142

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    #define FNT_LARGE                    FONT_QCSANS18
    #define FNT_LARGE_BOLD               FONT_QCSANS18
    #define FNT_X_LARGE                  FONT_QCSANS18
    #define FNT_X_LARGE_BOLD             FONT_QCSANS18
    #define FNT_XX_LARGE                 FONT_QCSANS18
    #define FNT_XX_LARGE_BOLD            FONT_QCSANS18

    Нашёл у нас в проекте. Видимо, это юмор такой.

    guest, 15 Июня 2009

    Комментарии (1)
  11. Куча / Говнокод #1195

    +146

    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
    (
     define
     (
      lazy-reader
      reader
     )
     (
      lambda
      (
       port
      )
      (
       make-lazy-list1
       (
        lambda
        (
        )
        
        (
         let
         (
          (
           it
           (
            reader
            port
           )
          )
         )
         (
          if
          (
           eof-object?
           it
          )
          '
          (
          )
          it
         )
        )
       )
      )
     )
    )

    Идиотское форматирование в Scheme

    guest, 12 Июня 2009

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