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

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

    +47.9

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    if (auth_exit_callback != undefined)
    {
       auth_exit_callback = undefined;
       auth_exit_callback();
    }

    Вызов колбэка и обнуление ссылки на него

    guest, 23 Декабря 2008

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

    +47.7

    1. 1
    if (is_null($title) == TRUE) $title = ' / '. $title;

    guest, 24 Декабря 2008

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

    +47

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    int sync1; sync1 = 50;
    int sync[sync1];
    for (i=0; i<50; i++) {
        sync[i] = 0;
    }

    Croessmah, 26 Марта 2015

    Комментарии (15)
  5. PHP / Говнокод #12448

    +47

    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
    function executeNewsRightRelated(sfWebRequest $request)
      {
        $siteId = $request->getParameter('site')->id;
        $tNewsList = $this->object->News;
    
        $newsList = array();
        foreach ($tNewsList as $news) {
    
          $ids = array();
          foreach ($news->Sites as $idModel) {
            $ids[] = $idModel->id;
          }
    
          if (in_array($siteId, $ids)) {
            $newsList[] = $news;
          }
        }
    
        $this->newsList = $newsList;
      }

    Skiv, 18 Января 2013

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

    +47

    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
    # GET /dialog([0-9]+)
    Public Static Function Dialog($senderId){
        $user = Session::Restore();
        IF($user){
            $users = Collection::Get('users', 'UserModel');
            $sender = $users->Find( Query::Equal('id', $senderId) );
            IF(sizeof($sender) > 0){
                $sender = $sender[0];
                $profile_view = self::Profile($sender->id);
                $mails = Collection::Get('mail', 'MailModel');
                $in = $mails->Find( Query::All( Query::Equal( 'tid', $user->id ), Query::Equal('fid', $sender->id) ) );
                $out = $mails->Find( Query::All( Query::Equal( 'fid', $user->id ), Query::Equal('tid', $sender->id) ) );
                $dialog = array();
    
                ForEach($in as $inMsg){
                    IF(!$inMsg->read)
                    {
                        $inMsg->read = 1;
                        $inMsg->save();
                    }
                }
    
                ForEach( $in as $message ){
                    IF(!isset($dialog[$message->time]))
                        $dialog[$message->time] = array();
                    $dialog[$message->time][] = array('type'=>'in', 'message'=>$message);
                }
    
                ForEach( $out as $message ){
                    IF(!isset($dialog[$message->time]))
                        $dialog[$message->time] = array();
                    $dialog[$message->time][] = array('type'=>'out', 'message'=>$message);
                }
    
                ksort($dialog);
    
                $profile_view->Set('ProfileContent', 'dialog.php')->Set('dialog', $dialog);
                return $profile_view;
            }
            throw new ForbiddenException( l('Sender is not found') );
        }
        throw new ForbiddenException( l('User is not authenticated') );
    }

    d3n4, 18 Декабря 2012

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

    +47

    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
    if($choice_product == 39.90)
            {    
              include('monthly_recurring/subscription_create.php');
            }
      if($choose_shipping == '0.00')
    
       {
    
          $choose_shipping_recur = 9.99;
    
       }
    
         
    
       if($choose_shipping == 'Canada')
    
       {
    
          $choose_shipping_recur = 0;
    
       }
    
       
    
       if($choose_shipping == '25.00')
    
       {
    
          $choose_shipping_recur = 25;
    
       }
    
       
    
       if($choose_shipping == '55.00')
    
       {
    
          $choose_shipping_recur = 55;
    
       }

    bytes, 16 Октября 2012

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

    +47

    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
    private function getLastDate($year, $month)
        {
            $next_year = $year;
            $next_month = $month + 1;
            if ($next_month == 13) {
                $next_month = 1;
                $next_year++;
            }
            $next_time = mktime(0, 0, 0, $next_month, 1, intval($next_year));
    
            $lastdate = strtotime('-1 day', $next_time);
            $last_day = date('d', $lastdate);
    
            return $last_day;
        }

    date('t', strtotime("$year-$month-01"));

    nekufa, 09 Октября 2012

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

    +47

    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
    if ($num_rows2>0) {
    	$raw2=mysql_fetch_array($sth2, MYSQL_ASSOC);
    	$desc=$raw2['desc'];
    	$sector =  "$desc";//O-o-o!
    } 
    //далее $desc нигде не используется, равно как и $raw2
    //и ещё:
    	$sid=$raw['id'];
    	$sector=$raw['sector'];
    	$selind='';
    	if ($sector==$sid) { $selind='selected'; }
    	echo "<option value='$sid' $selind >$sector</option>";
    
    //и так по всему коду
    //А ЭТО вместо темплэйта от 30 до 150 include за один раз с огрызками HTML и PHP
    <?php 
    require_once('includes/core.php');      // connection, config
    $is_index_page = true; // add this variable to check that we are on default index page (#2907)
    require_once('header.php');
    require_once('menu.php');
    include('homepage.php');
    . . .
    . . .
    require_once('footer.php');
    
    ?>

    Реальный кусок Хадж-кода. В комплекте более 3500 файлов перекрёстно инклюдящих друг друга. Действительно "Индусский код" оплачивается построчно..., дёшево, долго, сердито.

    virtual_cia, 06 Августа 2012

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

    +47

    1. 1
    $cc = str_replace('`','',str_replace("'","",str_replace('"','',strip_tags($_REQUEST['c_code']))));

    Регулярные выражения? Не, не слышал

    Tairesh, 06 Августа 2012

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

    +47

    1. 1
    mysql_query ("INSERT INTO mr_costadvtxt VALUES ('LAST_INSERT_ID(id+1)','$itemid','$kindofstr','$size', '$size_count','$pricered','$fordisc','$disc','$scheme_name','$pnum')") or die(mysql_error());

    psycho-coder, 24 Июля 2012

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