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

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

    +167

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    public function generateGUID ()
      {
          $GUID = $this->generateCharacter().$this->generateCharacter().$this->generateCharacter().$this->generateCharacter().$this->generateCharacter().$this->generateCharacter().$this->generateCharacter().$this->generateCharacter().$this->generateCharacter()."-";
          $GUID = $GUID.$this->generateCharacter().$this->generateCharacter().$this->generateCharacter().$this->generateCharacter()."-";
          $GUID = $GUID.$this->generateCharacter().$this->generateCharacter().$this->generateCharacter().$this->generateCharacter()."-";
          $GUID = $GUID.$this->generateCharacter().$this->generateCharacter().$this->generateCharacter().$this->generateCharacter()."-";
          $GUID = $GUID.$this->generateCharacter().$this->generateCharacter().$this->generateCharacter().$this->generateCharacter().$this->generateCharacter().$this->generateCharacter().$this->generateCharacter().$this->generateCharacter().$this->generateCharacter().$this->generateCharacter().$this->generateCharacter().$this->generateCharacter();
          return $GUID;
      }

    из класса для работы с paypal. (скачан с оффсайта)

    newmindcore, 16 Марта 2011

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

    +159

    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
    <?php
    session_start();
    DEFINE('trusteko', true);
    @$l=$_GET['l'];
    //echo md5('12345');
    include_once "../admin/meta.php";
    include_once ("../inc/setup.php");
    include_once ("../inc/config.php");
    $dbc=db_connect();
    if(isset($_POST['reg']))
    {
    $query="SELECT * FROM `access` WHERE login='".$_POST['login']."' LIMIT 1";
    $result = mysql_query($query,$dbc);
    $row=mysql_fetch_array($result);
        if (md5($_POST['passwd'])==$row['parol'] and $_POST['login']==$row['login'])
        {
        $_SESSION['passwd']=$_POST['passwd'];
        $_SESSION['login']=$_POST['login'];
        //////////////////
    include "menu_text.php";
    	//////////////////
    	}
            else
            {
            echo "<center><form action=\"\" method=\"post\" name=\"reg\">
    <table style=\"width:400px; height:50px;border:1px;\" align=\"center\">
    <tr><td colspan=\"2\" style=\"text-align:center\">Авторизация</td></tr>
    <tr><td>Login:</td><td><input type=\"text\" name=\"login\"></td></tr>
    <tr><td>Password:</td><td><input type=\"password\" name=\"passwd\"></td></tr>
    <tr><Td colspan=\"2\"><input type=\"submit\" name=\"reg\" value=\"Вход\"></td></tr>
    </table>
    </form></center>";
            }
    }
    if (isset($_SESSION['login']) and !isset($_POST['reg']))
    {
        $query="SELECT * FROM `access` WHERE login='".$_SESSION['login']."' LIMIT 1";
        $result = mysql_query($query,$dbc);
        $row=mysql_fetch_array($result);
        if (md5($_SESSION['passwd'])==$row['parol'] and $_SESSION['login']==$row['login'])
        {
    		
        //////////////////
    include "menu_text.php";
    	//////////////////
    	}
    }
    
    if (!isset($_SESSION['login']) and !isset($_POST['reg']))
    {
    echo "<center><form action=\"\" method=\"post\" name=\"reg\">
    <table style=\"width:400px; height:50px;border:1px;\" align=\"center\">
    <tr><td colspan=\"2\" style=\"text-align:center\">Авторизация</td></tr>
    <tr><td>Login:</td><td><input type=\"text\" name=\"login\"></td></tr>
    <tr><td>Password:</td><td><input type=\"password\" name=\"passwd\"></td></tr>
    <tr><Td colspan=\"2\"><input type=\"submit\" name=\"reg\" value=\"Вход\"></td></tr>
    </table>
    </form></center>";
    }
    ?>

    Мое, этому коду 2 года )
    Веселая система авторизации.
    Разумеется я так уже не пишу ;)

    topilnik, 12 Марта 2011

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

    +169

    1. 1
    global $_GET, $m_db;

    паццтолом

    paranoid, 11 Марта 2011

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

    +127

    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
    private String addZero(String num){
        String res = null;
      	if (num.length() == 1){
    		res = "0" + num;
    	}else{
    		res = num;
    	}
    	return res;
      }
    .........
    	String Y = request.getParameter("sdYear");
    	String M = request.getParameter("sdMonth");
    	String D = request.getParameter("sdDay");
    	String sd = null, fd = null;
    	if ((Y != null)&&(M != null)&&(D != null)&&(Y.length() > 0)&&(M.length() > 0)&&(D.length() > 0)){
    		sd = Y + addZero(M) + addZero(D);
    	} else {
    		sd = "*";
    	}
    	Y = request.getParameter("fdYear");
    	M = request.getParameter("fdMonth");
            D = request.getParameter("fdDay");
    	if ((Y != null)&&(M != null)&&(D != null)&&(Y.length() > 0)&&(M.length() > 0)&&(D.length() > 0)){
    		fd = Y + addZero(M) + addZero(D);
    	} else {
    		fd = "*";

    учитесь работать с датой

    3.14159265, 11 Марта 2011

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

    +172

    1. 1
    2. 2
    3. 3
    foreach($shop_search_arr as $k=>$v){
    	$shop_search_arr[$k] = $v;
    }

    Чтоб наверняка)

    jfhs, 10 Марта 2011

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

    +167

    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
    <?
    function displayData() { 
        global $chanTitle, $chanLink, $chanDesc, $rss, $items, $itemCount, $imgTitle, $imgLink, $imgUrl; 
        global $items, $itemCount; 
    ?>
    <?
    for($i = 0;$i < 1;$i++) { 
        
            if(@$items[$i]['link']<>''){
    ?>
            <? echo  '<h4>'.codirovkaReader(@$items[$i]['title']).'</h4>';  ?>
                    <? echo  '<h5>'.codirovkaReader(@$items[$i]['pubdate']).'</h5>';  ?>
            <? echo codirovkaReader(@$items[$i]['desc']); ?> 
               <? echo '<br><hr size="1">'; ?>
       
    <?      
    } 
    }               
    ?>
    <?
    }
    parseRSS($url); 
    ?>

    qbasic, 09 Марта 2011

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

    +146

    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
    import java.awt.*;import java.awt.event.*;import java.util.*;import javax.swing.
    *;class T extends JFrame implements Runnable{int C=10,R=20,S=R,i,j,r,l,b;int[][]
    M=new int[C][R];T(){setBounds(100,100,C*S,R*S);setDefaultCloseOperation(3);t();
    new Thread(this).start();}protected void processKeyEvent(KeyEvent e) {int v=e.
    getKeyCode();if(v==37)l=1;if(v==39)r=1;repaint();}void n(){b=0;l=0;for(i=0;i<C;i
    ++)for(j=0;j<R;j++){if (b>0)break;if(M[i][j]==9){if(i>1){M[i][j]=0;M[i-1][j]=9;}
    else b=1;}}}void o(){b=0;r=0;for(i=C-1;i>=0;i--)for(j=0;j<R;j++){if(b>0)break;if
    (M[i][j]==9){if(i<C-1){M[i][j]=0;M[i+1][j]=9;}else b=1;}}}public void paint
    (Graphics g){super.paint(g);for(i=0;i<C;i++)for(j=0;j<R;j++){int m=M[i][j];if(m
    !=0)g.drawRect(i*S,j*S,S,S);}}public static void main(String[]a){new T().
    setVisible(true);}public void run(){for(;;){try{Thread.sleep(200);}catch(
    Exception e){}if(r>0)o();if(l>0)n();b=0;for(i=C-1;i>=0;i--)for(j=R-1;j>=0;j--){
    if (b>0)break;if(M[i][j]==9)if(j<R-1){if(M[i][j+1]==0){if(!isCan()){t();b=1;
    break;}M[i][j]=0;M[i][j+1]=9;}else{t();b=1;break;}}else{t();b=1;break;}}repaint(
    );}}boolean isCan(){int j,i;for(i=0;i<C;i++)for(j=0;j<R;j++){if(j<R-1&&M[i][j]>8
    &&M[i][j+1]==1)return false;}return true;}void t(){int i,j;for(i=C-1;i>=0;i--)
    for (j=R-1;j>=0;j--)M[i][j] = M[i][j]!=0?1:0;for(j=0;j<R;j++)for(i=0;i<C;i++){}
    Random r=new Random();int s=r.nextInt(3);M[4][0]=9;switch(s){case 0:M[5][0]=9;M[
    5][1]=9;break;case 1:M[4][1]=9;M[5][0]=9;M[5][1]=9;break;case 2:M[4][1]=9;M[4][2
    ]=9;M[4][3]=9;break;}}}

    JSwing тетрис : 20 строчек

    Egor, 09 Марта 2011

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

    −182

    1. 1
    2. 2
    3. 3
    4. 4
    - application = webapp.WSGIApplication(foo)	
    + if 0==1:	
    +     application = webapp.WSGIApplication(foo)
    + application = webapp.WSGIApplication(bar)

    пакистанский юноша знает толк в комментариях.

    awsum, 09 Марта 2011

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

    +167

    1. 1
    2. 2
    3. 3
    function my_sql_query($query){
        return mysql_query($query);
    }

    warider, 09 Марта 2011

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

    −117

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    Если пФорма<>1 Тогда
    	СтрокаСФ="№";
    Иначе
    	СтрокаСФ="№";
    КонецЕсли;

    Загадочное условие в печатной форме ветеринарного свидетельства :)

    CYFiVE, 09 Марта 2011

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