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

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

    +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
    #include <iostream>
    
    class Schotchik { public:
    Schotchik();
    Schotchik(int znach);
    ~Schotchik(){}
    int vzyat_znachenie()const { return znachenye; }
    void vstavit_znachenie(int x) {znachenye = x; }
    operator unsigned int();
    private: int znachenye; };
    Schotchik::Schotchik(): znachenye(0) {}
    Schotchik::Schotchik(int novoe_znachenie): znachenye(novoe_znachenie) {}
    Schotchik::operator unsigned int () { return ( int (znachenye) ); }
    
    void* main() {
    Schotchik ctr(5);
    int znachenye = ctr;
    std::cout << "znachenye: " << znachenye << std::endl;
    return 5 ; }

    Govnocoder#0xFF, 12 Июля 2011

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

    +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
    if(isset($_FILES["fotagrafija"])) 
    { 
         $photo = $_FILES["fotagrafija"]["tmp_name"];
                                                 // есле нет ашИБОК!!1111111 
         if($_FILES["fotagrafija"]["error"] == 0) 
         { 
              ...
    
              if(move_uploaded_file($photo,"images/".(get_amount()+1).".jpg")==FALSE)
                   echo "fuck!";	
    		
              ...
         }
    }

    Разбирал код. Это, как ни жаль, оказалось рабочей версией.

    AlexT, 10 Июля 2011

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

    +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
    function setBlockStatus()
    {
    global $adminTpl, $core, $db;
    ..........
    }
    
    function setCommentStatus()
    {
    global $adminTpl, $core, $db;
    ..........
    }
    
    function deleteBlock()
    {
    global $adminTpl, $core, $db;
    ..........
    }

    И еще десятки других функций которые так любят глобальные переменные в Toogle CMS =)

    invision70, 05 Июля 2011

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

    +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
    $get = dbcom('SELECT * FROM downloads ORDER BY views DESC;');
    			$i = 1;
    			while($row = mysql_fetch_array($get))
    			{
    				if($i == 1)
    				{
    					$p['v'] = $row['views'];
    				}
    				if($row['reports'] != 0)
    				{
    					$t['rep']++;
    				}
    				$t['dl'] += $row['views'];
    				$i = 0;
    			}

    DDLCMS is a COMMERCIAL grade content management system for DDL site owners.
    при 400к записях в downloads немножно все в ОЗУ не помещалось.

    peinguin, 28 Июня 2011

    Комментарии (0)
  6. JavaScript / Говнокод #7049

    +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
    jQuery("select[id='select1']").change(
    			function () 
    			{
    				var city_id = jQuery(this).attr("value");
    				jQuery("select[id='select_hotel']").html('<option>Выберите категорию</option>');
    				jQuery("select[name='room']").html('<option>Выберите категорию и отель</option>');
    				
    				jQuery("select[id='select_5']").change(
    					function () 
    					{
    						....................................
    					}
    				);			
    			}
    		);

    обратите внимание на то, как селекторы объектов написаны.. автор вместо "#select1" пишет "select[id='select1']" зачем это делать непонятно.
    наговнокодено на сайте el-tour.com

    magistr_bender, 24 Июня 2011

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

    +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
    void AClass::registerApplication( int pCaller )
    {
      if ( mRegistry == NULL )
      {
        // we will be the first application in registry
        mRegistry = createRegistryElement( pCaller );
      }
      else
      {
        // there are other applications already registered
        // first create registry entry
        Application *lApplication = NULL;
        lApplication = createRegistryElement( pCaller );
    
        // put entry in front
        lApplication->mNext = mRegistry;
        mRegistry = lApplication;
      }
    }

    добавляем новый элемент в односвязный список. mRegister голова списка. кто не видит говна - идти читать матчасть.

    Dummy00001, 22 Июня 2011

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

    +159

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    protected function readConfig($configPath) {
        $ini = parse_ini_file($configPath);
        foreach ($ini as $key => $value) {
            $config[$key] = $value;
        }
        return $config;
    }

    xarper, 21 Июня 2011

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

    +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
    #include <math.h>
    #include <iostream>
    using namespace std;
    void main()
    { int month,day;
            cin>>month,day;
            int den=1;
            switch(month)
    {       case 1: cout<<"month: "<<month<<endl<<"day: "<<day+1;
    if(day==31){cout<<"month: "<<month+1<<endl<<den;}
    break;
            case 2: cout<<"month: "<<month<<endl<<"day: "<<day+1;
            if(day==28){cout<<"month: "<<month+1<<endl<<"day: "<<den;}
    break;
            case 3:cout<<"month: "<<month<<endl<<"day: "<<day+1;
                    if(day==31){cout<<"month: "<<month+1<<endl<<"day: "<<den;}
    break;
            case 4:cout<<"month: "<<month<<endl<<"day: "<<day+1;
                    if(day==30){cout<<"month: "<<month+1<<endl<<"day: "<<den;}
    break;
            case 5: cout<<"month: "<<month<<endl<<"day: "<<day+1;
                    if(day==31){cout<<"month: "<<month+1<<endl<<"day: "<<den;}
    break;
            case 6: cout<<"month: "<<month<<endl<<"day: "<<day+1;
                    if(day==30){cout<<"month: "<<month+1<<endl<<"day: "<<den;}
    break;
            case 7: cout<<"month: "<<month<<endl<<"day: "<<day+1;
                    if(day==31){cout<<"month: "<<month+1<<endl<<"day: "<<den;}
    break;
            case 8: cout<<"month: "<<month<<endl<<"day: "<<day+1;
                    if(day==31){cout<<"month: "<<month+1<<endl<<"day: "<<den;}
    break;
            case 9: cout<<"month: "<<month<<endl<<"day: "<<day+1;
                    if(day==30){cout<<"month: "<<month+1<<endl<<"day: "<<den;}
    break;
            case 10: cout<<"month: "<<month<<endl<<"day: "<<day+1;
                    if(day==31){cout<<"month: "<<month+1<<endl<<"day: "<<den;}
    break;
            case 11: cout<<"month: "<<month<<endl<<"day: "<<day+1;
                    if(day==30){cout<<"month: "<<month+1<<endl<<"day: "<<den;}
    break;
            case 12: cout<<"month: "<<month<<endl<<"day: "<<day+1;
                    if(day==31){cout<<"month: "<<month+1<<endl<<"day: "<<den;}
                    
                                    
    }       
     
    cin.get();
            cin.get();
    }

    Juris_Kabanis, 20 Июня 2011

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

    +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
    $this->addException(Mage::helper('dataflow')->__('Found %d rows.', $this->_countRows));
    $this->addException(Mage::helper('dataflow')->__('Starting %s :: %s', $adapterName, $adapterMethod));
    
    $batchModel->setParams($this->getVars())
        ->setAdapter($adapterName)
        ->save();
    
    // $adapter->$adapterMethod();
    
    return $this;
    
    $dom = new DOMDocument();
    // $dom->loadXML($this->getData());
    if (Mage::app()->getRequest()->getParam('files')) {
        $path = Mage::app()->getConfig()->getTempVarDir().'/import/';
        $file = $path.urldecode(Mage::app()->getRequest()->getParam('files'));
        if (file_exists($file)) {
            $dom->load($file);
        }
    } else {
    
        $this->validateDataString();
        $dom->loadXML($this->getData());
    }

    Magento 1.5 stable. после return'a идёт около 70 строк... Насладиться можно тут http://svn.magentocommerce.com/source/branches/1.5/app/code/core/Mage/Dataflow/Model/Convert/Parser/Xml/Excel.php

    message, 17 Июня 2011

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

    +159

    1. 1
    2. 2
    3. 3
    function doXmlEscape($val) {
      return str_replace(array('&', '<', '>', '"', "'"), array('&', '<', '>', '"', '''), $val);
    }

    http://vkontakte.ru/developers.php?o=-1&p=%D0%9F%D1%80%D0%B8%D0%BC%D0%B5%D1%80 +%D0%BE%D0%B1%D1%80%D0%B0%D0%B1%D0%BE%D1 %82%D1%87%D0%B8%D0%BA%D0%B0+%D1%83%D0%B2 %D0%B5%D0%B4%D0%BE%D0%BC%D0%BB%D0%B5%D0% BD%D0%B8%D0%B9+%D0%BD%D0%B0+%D1%8F%D0%B7 %D1%8B%D0%BA%D0%B5+PHP

    Ох и разработчики... T_T

    inf, 17 Июня 2011

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