1. Perl / Говнокод #7465

    −179

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    #count pages
    	my $counter; my $pagescount = 0; my $pagesstr;
    	for (my $i = 0; $i <= $count; $i++)
    	{
    		if ($counter == POSTS_PER_PAGE)
    		{
    		    my $a,$b; if ($pagescount == $pagenum) { $a = "["; $b = "]"; } else { $a = ""; $b = ""; }
    			$pagesstr = $pagesstr."$a<a href=\"wakaba.pl?task=mpanel&admin=$admin&page=$pagescount\">".($pagescount +1)."</a>$b" if ($pagescount == 0);
    			$pagesstr = $pagesstr.", $a<a href=\"wakaba.pl?task=mpanel&admin=$admin&page=$pagescount\">".($pagescount +1)."</a>$b" if ($pagescount != 0);
    			$pagescount++; $counter = 0;
    		} else { $counter++; }
    	}

    Вот такой веселый код пишут программисты дватиреча и на этом этот самый имиджборд и работает.

    7ion, 05 Августа 2011

    Комментарии (18)
  2. Куча / Говнокод #7464

    +128

    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
    $w=isset($_POST['w'])?(int)$_POST['w']:time();
        $p=$w-(24*3600)*7;
        $n=$w+(24*3600)*7;
    	mysql_query("set @start=date_format(date_sub(from_unixtime($w), interval weekday(from_unixtime($w)) day), '%m%d'),
    		@end=date_format(date_add(from_unixtime($w), interval 6-weekday(from_unixtime($w)) day), '%m%d')");
        
    	$ste=mysql_fetch_assoc(mysql_query('select @start as s,@end as e'));
    	 if($_SESSION['userinfo']['login']=='Stormsfb') echo "date_format(date_sub(from_unixtime($w), interval weekday(from_unixtime($w)) day), '%m%d') <br>date_format(date_add(from_unixtime($w), interval 6-weekday(from_unixtime($w)) day), '%m%d')<br>".
    							"select *,unix_timestamp(d) as u,
    							date_format(d,'%e %b') as dm,
    							date_format(d,'%m%d') as md,
    							date_format(d,'%d.%m.%y') as mdf from users where 
                        date_format(d, '%m%d') between 
                        ".($_POST['month']!='false'?
    					date('m',$w).'01 and '.date('mt',$w):
    					($ste['s']>$ste['e']?' @start and 1231
    					or date_format(d, "%m%d") between '.date('m',$n).'01 and @end ':' @start and @end '))." order by ".($_POST['month']=='false'?'weekday(d)':'date_format(d,"%m%d")');
    	$q=mysql_query("select *,unix_timestamp(d) as u,
    							date_format(d,'%e %b') as dm,
    							date_format(d,'%m%d') as md,
    							date_format(d,'%d.%m') as mdf from users where 
                        date_format(d, '%m%d') between 
                        ".($_POST['month']!='false'?
    					date('m',$w).'01 and '.date('mt',$w):
    					($ste['s']>$ste['e']?' @start and 1231
    					or date_format(d, "%m%d") between '.date('m',$n).'01 and @end ':' @start and @end '))." order by ".($_POST['month']=='false'?'md':'date_format(d,"%m%d")'),_LINK_) or die(mysql_error(_LINK_)); // || $ste['s']>$ste['e']
    					/*
    					это пиздец
    					"select *,unix_timestamp(d) as u,
    							date_format(d,'%e %b') as dm,
    							date_format(d,'%m%d') as md,
    							date_format(d,'%d.%m') as mdf from users where 
                        date_format(d, '%m%d') between 
                        ".($_POST['month']!='false'?
    					date('m',$w).'01 and '.date('mt',$w):
    					($ste['s']>$ste['e']?' @start and 1231
    					union select *,unix_timestamp(d) as u,
    							date_format(d,"%e %b") as dm,
    							date_format(d,"%m%d") as md,
    							date_format(d,"%d.%m") as mdf from users where 
                        date_format(d, "%m%d") 
    					between '.date('m',$n).'01 and @end ':' @start and @end '))." order by date_format(d, '%m%d')"
    					*/

    после нас хоть трава не расти!

    GoodTalkBot, 05 Августа 2011

    Комментарии (2)
  3. JavaScript / Говнокод #7463

    +167

    1. 1
    $('.menu-left li:last').parent().parent().attr('class', $('#menu-menu_building li:last').parent().parent().attr('class')+' last');

    К классу последнего li главного ul в выпадающем списке добавляется 'last'.

    EugeneC, 05 Августа 2011

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

    +125

    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
    for(int i = 0; i<et.Days.Count; i++)
                {
                if (et.Days[i].WorkDay.Day == colno - 1)
                    {
                    EmplTabelDays etd = et.Days[i];
    
                    switch (colno)
                        {
                        case 0:
                            break;
                        case 1:
                            break;
                        default:
                                {
                                //pinc.TypeIncome = (IncomeItem)
                                //((TreeNodeHelper)(income_grid.Rows[e.RowIndex].Cells[e.ColumnIndex]).Value).Value;
    
                                //etd.WorkStatus = (WorkStatus)((DataGridViewCell)(WorkDaysGrid.Rows[recno].Cells[colno]).Value).Value;
    
                                DataGridViewCell cell = WorkDaysGrid.Rows[recno].Cells[colno];
                                if (SpecialButton.Checked == false)
                                    {
                                    etd.TypeWorkHours = 8;
    //еще 100500 строк гавнокода...
    
                                    if (cell.Value == "8")
                                        etd.WorkStatus.Id = 1;
                                    if (cell.Value == "-")
                                        etd.WorkStatus.Id = 2;
                                    if (cell.Value == "О")
                                        etd.WorkStatus.Id = 3;
                                    if (cell.Value == "Б")
                                        etd.WorkStatus.Id = 4;
                                    if (cell.Value == "Р")
                                        etd.WorkStatus.Id = 5;
                                    if (cell.Value == "П")
                                        etd.WorkStatus.Id = 6;
                                    if (cell.Value == "А")
                                        etd.WorkStatus.Id = 7;
                                    if (cell.Value == "Г")
                                        etd.WorkStatus.Id = 8;
                                    if (cell.Value == "С")
                                        etd.WorkStatus.Id = 9;
    
                                    }

    Найдено в коде программы табель для бухгалтерии.
    Заполнение справочника с типами дней на основе ячеек грида.
    KeyboardInheritance в чистом виде.

    etcshadow, 05 Августа 2011

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

    +149

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    function returnFalse() {
    	return false;
    }
    function returnTrue() {
    	return true;
    }

    Не знаю, может было.
    Нашел в jquery http://code.jquery.com/jquery-1.6.2.js
    Может я не шарю, но зачем?

    Denya, 05 Августа 2011

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

    +165

    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
    public function checkStr($s2){
        $s1=" ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_1234567890";
    
        $result;
        $j=strlen($s2);
        for($i=0;$i<$j;$i++){
        if ((strpos($s1,$s2[$i])))
        $result.=$s2[$i];
        else return false;
        return true;
    }
    
        }

    оригинальный кодинг стайл сохранен!
    вот такое чудо я нашел в тестовом задании, которое прислал соискатель на должность пхп-программиста.
    собственно, там можно постить все тестовое задание, просто это было первым, что бросилось в глаза.

    paulkey, 05 Августа 2011

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

    +158

    1. 1
    2. 2
    3. 3
    4. 4
    function Plugin_bannerTypeHtml_vastInlineBannerTypeHtml_vastInlineHtml_Delivery_adRender(&$aBanner, $zoneId=0, $source='', $ct0='', $withText=false, $logClick=true, $logView=true, $useAlt=false, $loc, $referer)
    {
        return deliverVastAd('vastInline', $aBanner, $zoneId, $source, $ct0, $withText, $logClick, $logView, $useAlt, $loc, $referer);
    }

    Зачем использовать короткие имена ф-ций если еще не достигнут лимит интерпретатора...

    zurom, 05 Августа 2011

    Комментарии (6)
  8. JavaScript / Говнокод #7458

    +158

    1. 1
    2. 2
    3. 3
    A script on this page may be busy, or it may have stopped responding. You can stop the script now, or you can continue to see if the script will complete.
    
    Script: http://govnokod.ru/media/d10c81f141cf62e45d6f8dba139fa72d.js?files=jquery.js,govnokod.js,livecomments.js,jshighlight/highlight.pack.js&v=4:452

    Говнокод в govnokod e.

    yahoo, 05 Августа 2011

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

    +150

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    function Point(){
    	this.x = 0;
    	this.y = 0;
    	if(arguments.length==2){				//if parameters are 2 points
    		this.x = arguments[0] || 0;
    		this.y = arguments[1] || 0;
    	}else
    		if(arguments.length==1){			//if parameter is a point object
    			this.x = arguments[0].x;
    			this.y = arguments[0].y;
    		}
    };

    yahoo, 05 Августа 2011

    Комментарии (11)
  10. C# / Говнокод #7456

    +126

    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
    public bool NewOrder {
        get {
            if( !string.IsNullOrEmpty( Request.QueryString[ "NewOrder" ] ) ) {
                ViewState[ "NewOrder" ] = Request.QueryString[ "NewOrder" ] == "true" ? true : false;
            } else {
                if( ViewState[ "NewOrder" ] != null )
                    return ( bool ) ViewState[ "NewOrder" ];
                else
                    ViewState[ "NewOrder" ] = true;
                }
            return ( bool ) ViewState[ "NewOrder" ];
        }
        set { ViewState[ "NewOrder" ] = value; }
    }

    Eugene, 05 Августа 2011

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