1. PHP / Говнокод #7377

    +147

    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
    if(isset($_POST['logout']))
      {
        $_POST['name']=trim($_POST['name']);
        $_POST['pass']=trim($_POST['pass']);
        if($_POST['name']!="" && $_POST['pass']!="")
           {
             $cons = "bcdfghjklmnpqrstvwxyz";
             $bons = "BCDFGHJKLMNPGRSTVWXYZ";
             $vocs = "aeiou";
             $noms = "123456789";
             for($x=0; $x < 33; $x++){
             mt_srand ((double) microtime() * 1000000);
             $con[$x] = substr($cons, mt_rand(0, strlen($cons)-1), 1);
             $bon[$x] = substr($bons, mt_rand(0, strlen($bons)-1), 1);
             $voc[$x] = substr($vocs, mt_rand(0, strlen($vocs)-1), 1);
             $nom[$x] = substr($noms, mt_rand(0, strlen($noms)-1), 1);
             }
             $makerand= $con[0] . $voc[3] . $con[1] . $nom[2] . $nom[5] .$bon[2] . $con[4];
             @chmod("../admin/conf/config.inc", 0777);
             $cont=file("../admin/conf/config.inc");
                  $f=fopen("../admin/conf/config.inc","w");
                     if (!$f) {
                           echo "Невозможно открыть файл кофигурации";
                           exit;
                     }
                  @$writefile = fwrite($f,$cont[0].$cont[1].$makerand);
                     if (!$writefile) {
                           echo "Невозможно записать файл кофигурации";
                           exit;
                     }
                  @chmod("../admin/conf/config.inc", 0604);
                  fclose($f);
             session_unset ();
             session_destroy ();
             $info="Вы вышли!";
           }
      }

    Столкнулся я с правками на неизвесный мне до этого Kandidat CMS (http://www.kan-studio.ru/).
    Кусок выбран на угад... там все феерически шедеврально.
    Качайте, читайте... помойгайте разработчикам (кошельки на оф. сайте), походу им очень надо на образование подкинуть.
    В остальном коде собачки стоят через строчку.

    PS: я сюда зарегался ради ентого поста.
    PPS: не так важно, но табуляции тоже сохранены.

    Developa, 29 Июля 2011

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

    +147

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    if (file_exists("C:\autoexec.bat"))
      mysql_query('CREATE TABLE eto_windows');
    
    ...гдето в другом файле
    if(mysql_query('DROP TABLE eto_windows')) {
      echo "это виндоус ;(";
      mysql_query('CREATE TABLE eto_windows');
    }
    ...
    
    // не забываем чистить шлак! а то будут утечки!
    mysql_query('DROP TABLE eto_windows')

    вот такие вот дела...

    qfox, 29 Июля 2011

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

    +147

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    function ismaxlength255(obj){
        if (obj.getAttribute && obj.value.length>255)
                obj.value=obj.value.substring(0,255)
    }
    
    
    
    <textarea name="comment" cols="50" rows="3" onkeypress="return ismaxlength255(this);"></textarea>

    Нашел с исходниках крупной латвийской соц.сети

    jQuery, 28 Июля 2011

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

    +147

    1. 1
    ОТЦЕНИТЕ КОД!!!!1

    odnoklassniki, 28 Июля 2011

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

    +147

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    /*
    org.springframework.aop.framework
    Class AbstractSingletonProxyFactoryBean
    
    Convenient proxy factory bean superclass for proxy factory beans that create only singletons. 
    */
    
    public abstract class AbstractSingletonProxyFactoryBean
    extends ProxyConfig
    implements FactoryBean, BeanClassLoaderAware, InitializingBean

    http://static.springsource.org/spring/docs/2.0.x/api/org/springframework/aop/framework/AbstractSingletonProxyFactoryBean.html
    Convenient proxy factory bean superclass for proxy factory beans that create only singletons. And we need to go deeper...

    zheka, 28 Июля 2011

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

    −97

    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
    if cells[x-1,y-1] == 1: pos+=1
    else:
      if cells[x-1,y-1] == -1: neg+=1
    if cells[x-1,y] == 1: pos+=1
    else:
      if cells[x-1,y] == -1: neg+=1
    if cells[x-1,y+1] == 1: pos+=1
    else:
      if cells[x-1,y+1] == -1: neg+=1
    
    if cells[x,y-1] == 1: pos+=1
    else:
      if cells[x,y-1] == -1: neg+=1
    if cells[x,y] == 1: pos+=1
    else:
      if cells[x,y] == -1: neg+=1
    if cells[x,y+1] == 1: pos+=1
    else:
      if cells[x,y+1] == -1: neg+=1
    
    if cells[x+1,y-1] == 1: pos+=1
    else:
      if cells[x+1,y-1] == -1: neg+=1
    if cells[x+1,y] == 1: pos+=1
    else:
      if cells[x+1,y] == -1: neg+=1
    if cells[x+1,y+1] == 1: pos+=1
    else:
      if cells[x+1,y+1] == -1: neg+=1

    Иначе никак =D.

    Fai, 28 Июля 2011

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

    +147

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    try {
    			final SecurityClientInternalLocal scil =
    				(SecurityClientInternalLocal) EJBLocator.getEJBLocal(
    						SecurityClientInternalLocal.class);
    			final String result = scil.getPath2ChipherTables(login);
    			return result;
    		} catch (Exception ex) {			
    			throw ex;
    		}

    Промышленная обработка исключений такая промышленная...

    roman-kashitsyn, 28 Июля 2011

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

    +147

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    // Базовые проверки на тип переменных
    if ((isset($this->params['month']) && (string)$this->params['month']!==(string)(int)$this->params['month'])
    	|| (isset($this->params['season']) && (string)$this->params['season']!==(string)(int)$this->params['season'])
    	|| (isset($this->params['year']) && (string)$this->params['year'] !== (string)(int)$this->params['year']) // проверки на вхождение в диапзон дат
    	|| (isset($this->params['year']) && !in_array($this->params['year'], $this->data['years']))
    	|| (isset($this->params['season']) && !isset($this->data['seasons'][(string)(int)$this->params['season']]))
    	|| (isset($this->params['month']) && !isset($this->data['monthes'][(string)(int)$this->params['month']])) || false
    	|| (isset($this->params['month']) && isset($this->params['season']) && !in_array((string)(int)$this->params['month'], $this->data['seasons_monthes'][(string)(int)$this->params['season']])))

    sectronov, 28 Июля 2011

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

    +147

    1. 1
    2. 2
    3. 3
    4. 4
    While ($componentPage != "ticket_edit") 
    $componentPage = "ticket_edit";
    if ($componentPage == "ticket_edit") 
    $componentPage = "ticket_edit";

    нет, я всё понимаю, но зачем такое насилие и контрольный в голову?

    alazutov, 28 Июля 2011

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

    +147

    1. 1
    2. 2
    3. 3
    4. 4
    if (!$case['item_type'])
            unset($case['item_type']);
    else
            unset($case['content_id']);

    sectronov, 28 Июля 2011

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