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

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

    +120

    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
    // Check if You need Administrator-level access to create a folder
    try
      mkdir(SDirectory + '\~TEST');
    except
      on E: exception do
      begin
        if E.message = 'File access denied' then
        begin
          MessageBox(self.Handle,
            'You need Administrator-level access to create this folder', '', MB_ICONERROR);
          exit;
        end;
      end;
    end;
    RmDir(SDirectory + '\~TEST');

    Мартышки плакали, кололись, но продолжали ронять UAC себе на лапки.

    bugmenot, 03 Августа 2011

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

    +168

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    $type = '';
    if ($info[5]=='') $type.='0'; else $type.='1';
    if ($info[6]=='') $type.='0'; else $type.='1';
    if ($info[7]=='') $type.='0'; else $type.='1';
    if ($type=='000') $type = '100';

    Честно говоря я смотрел и пытался понять чего же человек этим добиться хотел... Это полный п%здец.

    invision70, 31 Июля 2011

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

    +147

    1. 1
    2. 2
    3. 3
    4. 4
    if($response == false)
     	$response = true;
    else 
            $response = false;

    вот такая говно-конструкция изменяющая false на true и наоборот

    kellydpx, 29 Июля 2011

    Комментарии (3)
  5. bash / Говнокод #7385

    −116

    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
    #!/bin/sh
    #
    # $1 is the mail account
    
    [ -n "$1" ] && {
    	
    	MAIL_PATH="/Mail/$1/mbox"
    	OUTPUT_MAIL_PATH="/mnt/flash/save/email/inbox/"
    	mkdir -p $OUTPUT_MAIL_PATH	
    	mv /var/spool/mail/root/* $MAIL_PATH
    
    	for j in `find $MAIL_PATH -name "msg.*"`
    	do
    	  MAIL_NAME=`basename $j`.eml
    	  NEW_MAIL="$OUTPUT_MAIL_PATH/$MAIL_NAME"
    	  mkdir -p "$OUTPUT_MAIL_PATH"
    	  
    	  [ ! -f "$NEW_MAIL" ] && {
    		  grep "^From:" $j | head -n 1 > $NEW_MAIL
    		  if grep "^Cc:" $j ; then
    		  	grep "^Cc:" $j | head -n 1 >> $NEW_MAIL
    		  fi
    		  grep "^To:" $j | head -n 1 >> $NEW_MAIL
    		  grep "^Subject:" $j | head -n 1 >> $NEW_MAIL
    		  grep "^Date:" $j | head -n 1 >> $NEW_MAIL
    		
    			if grep "^Content-Type: text/plain;" $j ; then
    				
    				LINE_NUM=`grep -n "^Content-Type: text/plain;" $j | cut -d: -f1`
    				
    				if grep "^Content-Type: text/plain;" $j | grep "charset=" ; then
    					TYPE=`grep  "Content-Type: text/plain;" $j | cut -d";" -f1`
    					echo "$TYPE" >> $NEW_MAIL
    					CHAR="charset="`grep  "Content-Type: text/plain;" $j | cut -d= -f2`
    					echo "$CHAR" >> $NEW_MAIL
    				else
    					grep "^Content-Type: text/plain;" $j >> $NEW_MAIL
    					x=$(($LINE_NUM+1))
    					sed -n "$x"p $j >> $NEW_MAIL
    				fi
    		
    				
    				x=$(($LINE_NUM-1))
    				BOUNDARY=`sed -n "$x"p $j`
    				
    				for i in `sed "/$BOUNDARY/s/.*/ffffuuuucccckkkk/" $j | grep -n "ffffuuuucccckkkk" | cut -d: -f1`
    				do
    					if [ "$i" -gt "$LINE_NUM" ] ; then
    						i=$(($i-1))
    						y=$(($LINE_NUM+3))
    						echo "Mail content start:" >> $NEW_MAIL
    						sed -n "$y,$i"p $j >> $NEW_MAIL			
    						break
    					fi
    				done
    				
    				if ! grep "Mail content start:" $NEW_MAIL ; then
    					echo "Mail content start:" >> $NEW_MAIL
    					y=$(($LINE_NUM+3))
    					x=`grep -c "^" $j`
    					sed -n "$y,$x"p $j >> $NEW_MAIL
    				fi
    				
    			else
    				echo "Fuck....."	
    			fi
    		}
    	done
    }

    /bin/mail.sh из прошивки букридера GreenBook

    wat3rs, 29 Июля 2011

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

    +147

    1. 1
    2. 2
    3. 3
    4. 4
    While ($componentPage != "ticket_edit") 
    $componentPage = "ticket_edit";
    if ($componentPage == "ticket_edit") 
    $componentPage = "ticket_edit";

    нет, я всё понимаю, но зачем такое насилие и контрольный в голову?

    alazutov, 28 Июля 2011

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

    +162

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    $d_data = $engine->storageHandler->LoadData('TMSDiscipline',$tournament['discipline_id']);
    $d_name = $d_data['name'];
    $cs = 0;
    if ($d_name[0] == 'C' && $d_name[1] == 'S'){
    	$cs = 1;
    }

    Определяем дисциплину матча.

    inf, 20 Июля 2011

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

    +160

    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
    class Loging
    {	
    	function referer()
    	{
    		global $_SERVER, $cms_site, $Filtr;
       		if (isset($_SERVER['HTTP_REFERER']))
       		{
          			if ($_SERVER['HTTP_REFERER']!="")
          			{
             			$return = $Filtr->clear($_SERVER['HTTP_REFERER']);
             			if (
                				(strstr($_SERVER['HTTP_REFERER'],"action"))
                				or
                				(strstr($_SERVER['HTTP_REFERER'],"pm"))
                				or
                				(strstr($_SERVER['HTTP_REFERER'],"getfile"))
                				or
                				(strstr($_SERVER['HTTP_REFERER'],"editprofile"))
                				or
                				(strstr($_SERVER['HTTP_REFERER'],"restore"))
                				or
                				(strstr($_SERVER['HTTP_REFERER'],"registration"))
             			)
             			$return = $cms_site;
          			}
          			else
             			$return = $cms_site;
       		}
       		else
          			$return = $cms_site;
       		return $return;
    	}
    }
    
    $Loging = new Loging;

    И таких классов не понятных тьма, его инициализируют, и всё просто забывают...

    nethak, 19 Июля 2011

    Комментарии (3)
  9. Python / Говнокод #7281

    −91

    1. 1
    2. 2
    3. 3
    def _format_price(price):
        price = '%.3f' % (float(price)/1000) if price > 999 else '%d' % price
        return price.replace('.', ' ')

    Suor, 19 Июля 2011

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

    +149

    1. 1
    return str_replace("\t", '', str_replace("\n", '', str_replace('"', '\"', get_partial($partial, $data))));

    Это вместо простого
    return str_replace(array("\n","\t"), '', get_partial($partial, $data));

    programmer, 18 Июля 2011

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

    +160

    1. 1
    "trim(.$resultm[1].)"

    substr, 09 Июля 2011

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