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

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

    +167.6

    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
    <?php
    function daybefore($j){
    $day = date('d');
    $month = date('m');
    $year = date('Y');
    for ($i=0; $i<$j; $i++) { 
    if ($day==1) {
        if ($month == 1) {
            $day = 31;
            $month = 12;
            $year = $year - 1;
        } else {
            $month = $month - 1; 
            switch ($month) {
                case 01:
                    $maxdays=31;
                    break;
                case 02:
                    $a = $year / 4;
                    $b = ceil($a);
                    if ($a==$b){                
                         $maxdays=29;
                    } else {
                          $maxdays=28;
                    }
                    break;
                case 03:
                    $maxdays=31;
                    break;
                case 04:
                    $maxdays=30;
                    break;
                case 05:
                    $maxdays=31;
                    break;
                case 06:
                    $maxdays=30;
                    break;
                case 07:
                    $maxdays=31;
                    break;
                case 08:
                    $maxdays=31;
                    break;
                case 09:
                    $maxdays=30;
                    break;
                case 10:
                    $maxdays=31;
                    break;
                case 11:
                    $maxdays=30;
                    break;
                case 12:
                    $maxdays=31;
                    break;
            }
            $day = $maxdays;
            $year = $year;
        }
    } else {
        $day = $day - 1;
        $month = $month;
        $year = $year;
    }}
    return "$year-$month-$day";
    }
    echo daybefore(3);
    ?>

    Отсюда:
    http://php.net/manual/en/function.date.php

    hdkeeper, 17 Марта 2010

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

    +164.1

    1. 1
    $this->get('begin_at') > date('Y-m-32')

    Так я проверяю, что еще не начался месяц даты begin_at (в формате Y-m-d)

    HyperGeek, 11 Марта 2010

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

    +169.1

    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
    Element = function (AttributeName, AttributeValue) {
    	arr = [];
    	if (document.getElementsByTagName("*")[0] && document.getElementsByTagName("*")[0].getAttribute(AttributeName) == AttributeValue) arr.push(document.getElementsByTagName("*")[0]);
    	if (document.getElementsByTagName("*")[1] && document.getElementsByTagName("*")[1].getAttribute(AttributeName) == AttributeValue) arr.push(document.getElementsByTagName("*")[1]);
    	if (document.getElementsByTagName("*")[2] && document.getElementsByTagName("*")[2].getAttribute(AttributeName) == AttributeValue) arr.push(document.getElementsByTagName("*")[2]);
    	if (document.getElementsByTagName("*")[3] && document.getElementsByTagName("*")[3].getAttribute(AttributeName) == AttributeValue) arr.push(document.getElementsByTagName("*")[3]);
    
    ...
    
    if (document.getElementsByTagName("*")[997] && document.getElementsByTagName("*")[997].getAttribute(AttributeName) == AttributeValue) arr.push(document.getElementsByTagName("*")[997]);
    	if (document.getElementsByTagName("*")[998] && document.getElementsByTagName("*")[998].getAttribute(AttributeName) == AttributeValue) arr.push(document.getElementsByTagName("*")[998]);
    	if (document.getElementsByTagName("*")[999] && document.getElementsByTagName("*")[999].getAttribute(AttributeName) == AttributeValue) arr.push(document.getElementsByTagName("*")[999]);
    	return arr
    }

    eval, 08 Марта 2010

    Комментарии (12)
  5. Си / Говнокод #2721

    +101.8

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    inline int _txReturn1 () { return 1; }
    
    //бла-бла-бла
    while (_txReturn1 ()) 
    {
    //бла-бла-бла
    }
    
    //бла-бла-бла

    Это либка TXlib и по ней учат детей

    x0m9k, 05 Марта 2010

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

    +166.5

    1. 1
    $now=mktime(date("H"),date("i"),date("s"),date("m"),date("d"),date("Y"));

    Shiz89, 01 Марта 2010

    Комментарии (12)
  7. Куча / Говнокод #2696

    +121.6

    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
    <table width="760"  border="0" cellpadding="0" cellspacing="0">
    		<tr align="left" valign="middle" bgcolor="#FFFFFF">
              <td width="12"  valign="middle" height="33"> </td>
              <td width="336"  valign="middle">          <span class="Titletop"><a href="/members/signin.php?p=www.jci.cc/">Go to Members Site</a></span></td>
              <td width="71" align="right" valign="middle"><span class="Titletop">Language </span></td>
              <td width="87"  valign="middle"><select name="lang_id" onchange="document.mainform.subpageid.value='';document.mainform.subpageid2.value='';document.mainform.pageid.value='0';document.mainform.submit()">
                <option value="1" selected >English</option>
    
                <option value="2"  >Español</option>
                <option value="3"  >Français</option>
              <!--  <option value="4"  >Japanese</option>
                <option value="5"  >Korean</option>
                <option value="6"  >Chinese</option>
                <option value="7"  >German</option>
                <option value="8"  >Russian</option> -->
              </select></td>
              <td width="109" align="right" valign="middle">
    <input type=hidden name=domains value="jci.cc">
                   <input type=hidden name=sitesearch value="jci.cc">
    
                   <INPUT type=hidden name=cof VALUE="S:http://www.jci.cc;GL:0;AH:center;LH:116;L:http://www.jci.cc/images/header.gif;LW:760;AWFID:61c374d44065a9ab;">
    	      <span class="Titletop">Search JCI </span></td>
              <td width="109" align="right" valign="middle"><input name="q" type="text" class="srch_frm" size="15" /></td>
              <td width="36" align="left"> <a href="#" onclick="google()"><img src="/images/search.gif" width="15" height="15" border="0" align="absmiddle" onclick="google()" /></a></td>
      </tr>
          </table>

    http://www.jci.cc/

    sunswordrie, 01 Марта 2010

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

    +160.6

    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
    //-----------------------------------------------------------------------------------------------------------------------------------------------------
    <table width="200" border="0" align="center">
    <form action="authorization.php">
    	<tr>
                  <td>Логин</td>
                  <td><input type="text" name="login"></td>
                </tr>
                <tr>
                  <td>Пароль</td>
                  <td><input type="password" name="pass"></td>
                </tr>
    	<tr>
    	    <td><form action="authorization.php" method=get><input type=submit name="sub" value="Войти"></form>
    	</tr>
    </form>
    </table>
    //-----------------------------------------------------------------------------------------------------------------------------------------------------
    <?
    $login=$_REQUEST["login"];
    $pass=$_GET['pass'];
    if ($login=='' or $pass=='') 
    {
    	echo "введены не все данные";
    	echo "<html><body><a href='index.php'>Назад</a></body></html>";
    }
    $e='0';
    $sql="select pass from persons where login='$login'";
    $stmt = OCIParse($conn,$sql);
    $mess = @OCIExecute($stmt);
    if(!$mess)
    { 
    	$error = OCIError($stmt); 
    	echo "Ошибка при выборке данных
           (".$error["message"].")"; 
    } 
    while (OCIFetch($stmt))
    {
    $e=OCIResult($stmt,"PASS");
    }
    //-----------------------------------------------------------------------------------------------------------------------------------------------------
    echo '<tr><td  align=right><center><form action=admin.php method=get><input type=submit value="Администрирование системы"></form></tr>';
    //-----------------------------------------------------------------------------------------------------------------------------------------------------
    ?>

    небольшие кусочки из разных файлов одной системы.

    1_and_0, 21 Февраля 2010

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

    +160

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    var today = new Date();
    var d_names = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
    var m_names = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
    var d_postfix = new Array("never_used","st", "nd", "rd", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th", "th", "th");
    document.write(d_names[today.getDay()]+", "+m_names[today.getMonth()]+" "+today.getDate()+d_postfix[today.getDate()]+", "+today.getFullYear());

    Банально, но все равно приятно :)

    wvxvw, 21 Февраля 2010

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

    +71.6

    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
    import javax.microedition.midlet.MIDlet;
    import javax.microedition.lcdui.Display;
    
    public class BIOS extends MIDlet{
    Kernel kern;
    boolean in=false;
    public void pauseApp(){
    kern.c.println("ACPI :  Macine paused");
    }
    public void destroyApp(boolean b){
    kern.c.println("ACPI : Macine poweroffing");
    exitApp(true);
    }
    public void startApp(){
    if(!in) kern=new Kernel(this);
    else kern.c.println("ACPI : Machine resumed");
    in=true;
    }
    public void exitApp(boolean physical){
    Display.getDisplay(this).setCurrent(kern.c);
    kern.c.println("Changing runlevel to 0... [Ok]");
    kern.c.println("Sending to processes the TERM signal");
    kern.c.println("Sending to processes the KILL signal");
    kern.c.println("Stopping FS: fsdriver");
    kern.fs=null;
    kern.c.println("Sending the system clocktime...");
    try{
    Thread.currentThread().sleep(5000L);kern.c.println("Destroyed.");
    Thread.currentThread().sleep(500L);System.gc();}catch(Exception e){}
    in=false;
    if(physical) notifyDestroyed();
    }
    }

    Очередной кусок говнокода :)

    Pyth_ON, 17 Февраля 2010

    Комментарии (12)
  11. Java / Говнокод #2622

    +86.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
    ...
    String tmp = null;
    String age = null;
    ...
    tmp = hdrInfo.getAge();
    if( tmp != null )
    {
      age = tmp.substring( 0, tmp.length( ) - 1 );
      if( !age.equals( "0" ) ) {
        age = age;
      } else {
        age="";
      }
    } else {
      age="";
    }

    Индусско-выверенный код.

    Underdark, 16 Февраля 2010

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