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

    −156

    1. 1
    print reverse 1..10

    kubynek, 20 Августа 2010

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

    +155

    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
    <?php
    
    include "conf_db.php";
    if(!empty($_REQUEST['doreg'])){
    $error=array();
    if(!$_REQUEST['name']) $error['name']="Имя";
    if(!$_REQUEST['pass']) $error['pass']="Пароль";
    if(!$_REQUEST['pass_to']) $error['pass_to']="Снова пароль";
    if(!$_REQUEST['e_mail']) $error['e_mail']="E-mail";
    
    if(!empty($error))
     {
     foreach ($error as $value)
      {
      echo "Не заполнено поле $value<br>";
      }
     include "form.php";
     }
     
     if(empty($error))
    {
     $error_to=array();
    if(trim($_REQUEST['pass']) !== trim($_REQUEST['pass_to'])) $error_to['pass']="Пароли не совпадают!";
    
    if(empty($error_to)) 
    {
    $query="select * from users where name='".$_REQUEST['name']."'";
    $id=mysql_query($query)or die(mysql_error());
    $arr=mysql_fetch_array($id);
    if(!empty($arr)) $error_to['db']="пользователь с таким именем уже зарегистрирован!"; 
    }
    if(!empty($error_to))
     {
      foreach($error_to as $value)
      {
      echo $value;
      }
     include "form.php";
     }
    }
    if(empty ($error_to)  && empty($error))
    {
    
    //Здесь проверка прошла.
    
    }
    ?>

    Скрипт регистрации

    desty, 20 Августа 2010

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

    +173

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    function jsPlay(soundobj) {
     var thissound= eval("document."+soundobj);
     try {
     thissound.Play(); // играй!!!
     }
     catch (e) {
     thissound.DoPlay(); // играй СЦУКО!!!!!!!!!!!
     }
    }

    http://rabota2009.ucoz.ru/
    вот так надо использовать try-catch если вы не знали.

    Alfred, 20 Августа 2010

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

    +158

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    function rnd(){
    var randscript = -1;
    var num = banners.length;
    while (randscript < 0 || randscript > parseInt(num/col)-1 || isNaN(randscript)){
            randscript = parseInt(Math.random()*(num+1))
    }
    return randscript
    }

    http://earninguide.biz/top.js
    генераторы бывают случайные и псевдослучайные.
    но есть еще и псевдо_ХУ_евые!
    вот один из них...

    Alfred, 20 Августа 2010

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

    +158

    1. 1
    2. 2
    <?php 
    $delete_status = substr ($this->getAdapter()->quote( $delete_status), 1, -1);

    $delete_status - это строка... причем константа.
    в итоге, по ходу задачи это строка ничего не делает...

    nicolay-punin, 20 Августа 2010

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

    +81

    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
    public class Constants {
    
        /* ... */
    
        public static final int FOUR = 4;
        public static final int THREE = 3;
    
        public static final int INTEGER_FOUR = 4;
        public static final int INTEGER_FIVE = 5;
        public static final int INTEGER_ONE = 1;
        public static final int LENGTH_FOUR = 4;
        public static final int LENGTH_FIVE = 5;
        public static final int LENGTH_SEVEN = 7;
        public static final int LENGTH_EIGHT = 8;
        public static final int LENGTH_NINE = 9;
        public static final int LENGTH_ELEVEN = 11;
        public static final int LENGTH_TWELVE = 12;
        public static final int LENGTH_EIGHTEEN = 18;
        public static final int LENGTH_FIFTEEN = 15;
        public static final int ONE = 1;
        public static final int INTEGER_FIVE = 5;
        public static final int INTEGER_ONE = 1;
        public static final int PLUS_ONE = 1;
        public static final int INTEGER_THREE = 3;
    
        public static final Long LONG_VALUE_TEN = Long.valueOf(10);
        public static final Long LONG_VALUE_ZEARO = Long.valueOf(0);
    
        public static final BigDecimal BIGDECIMAL_ZERO = new BigDecimal(0);
        public static final BigDecimal BIGDECIMAL_ONE = new BigDecimal(1);
    
        public static final BigDecimal NEGATIVE_NUMBER_ONE = new BigDecimal(-1);
    
        public static final int COMPARE_RESULT_ZERO = 0 ;
        public static final int COMPARE_RESULT_ONE = 1 ;
        public static final int COMPARE_RESULT_NEGATIVE = -1 ;
    
        /* ... */
    
        public static final String NINE_STRING = "9";
        public static final String ONE_STRING = "9";
    
    }

    Хардкодить волшебные числа - плохой стиль. @dailywtf

    bugmenot, 20 Августа 2010

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

    +144

    1. 1
    2. 2
    // TODO: Rewiew
    // ...

    жопой чую, что ниже этих строк - пиздец

    mozg_raka, 19 Августа 2010

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

    +174

    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
    // get extension and name
            $ar = explode('.', $result['name']);
            if (count($ar) == 2)
            {
                $fName = $ar[0];
                $fExt  = $ar[1];
            }
            elseif (count($ar) < 2)
            {
                    $fName = $result['name'];
                    $fExt  = '';
            }
            else 
            {
                        $fName = $ar[0];
                        for ($i = 1; $i < count($ar); $i++)
                        {
                            $fName .= '.' . $ar[$i];
                        }
                        $fExt = $ar[count($ar) - 1];
            }

    Вот таким вот образом в проекте вычисляется расширение файла

    PS. Для тех кто в танке:
    method1(using internal function):
    $extension = pathinfo($filename, PATHINFO_EXTENSION);
    method2(coder know about 'explode' function)
    $ar = explode(".", $filename); $extension = count($ar)>1 ? end($ar) : "";
    method3(coder know about 'strchr', 'strrchr' and 'substr' functions)
    $extension = strrchr(".", $filename ) == FALSE ? "" : substr(strrchr(".", $filename));

    mykola, 19 Августа 2010

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

    +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
    string makesig(string mid, string apiid, string method, string secret, string[] param)
            {
                string[] fullparams = new string[] { "api_id=" + apiid, "method=" + method, "v=3.0", "format=JSON" };
                string methodparams = String.Join("©", param);
                string fullparams_j = String.Join("©", fullparams);
                string fpr = String.Join("©", new string[] { fullparams_j, methodparams });
                string[] fpr_s = fpr.Split(new char[] { Convert.ToChar("©") });
                Array.Sort(fpr_s);
                fpr = String.Join("", fpr_s);
                string last = String.Concat(mid, fpr, secret);
                return getMd5Hash(last);
            }

    Так люди делают подпись для запроса к API ВКонтакте

    A1mighty, 19 Августа 2010

    Комментарии (16)
  10. Java / Говнокод #4031

    +144

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    public ServiceUser setSubscription( Subscription subscription )
      {
        this.subscription = subscription;
        return this;
      }

    это такой сеттер в класе ServiceUser И зачэм он возвращает this????????

    gavrs, 19 Августа 2010

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