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

    +164

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    if($password===$_POST['password'] && $login===$_POST['login'])
    	{	
    // устанавливаем login & pass	
    	$_SESSION['login']=$_POST['login'];	
    	
    	$_SESSION['password']=$_POST['password'];
    // Перенаправляем в админ панель	
    	Header("Location: config.php");	
    	}
    else { ... }

    NemoReturns, 29 Апреля 2011

    Комментарии (72)
  2. JavaScript / Говнокод #6516

    +164

    1. 1
    <a onclick="javascript:location.href='news_id_42297.html'" href="#block03-1">

    http://www.topnews.ru/ (внизу новости с 11-й по 20-ю)
    А теперь <del>кликните колесиком</del> наведите на это безобразие курсор. Молодцы, теперь отведите.

    ReallyBugMeNot, 29 Апреля 2011

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

    +113

    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
    public bool Read_XMl_File (XDocument Xml_Document, ref game_data Game_Data) { 
                bool Is_Success=false;          /* Captures this function's result */
    
                try { 
                    this.Xml_Data = (game_data)Game_Data;
    /*              Recursively read through entire XML Document */ 
                    Xml_Document.Root.RecursivelyProcess ( 
                        Process_Child_Element,
                        Process_Parent_Element_Open,
                        Process_Parent_Element_Close);
                    Is_Success = true;
                    }
    
                catch (Exception ex) { throw ex; }
    
                Game_Data = this.Xml_Data;    /* Pass the data back to Xml_Data */
                return Is_Success;
                }
     public static void RecursivelyProcess (
                    this XElement element,
                    Action<XElement, int> childAction,
                    Action<XElement, int> parentOpenAction,
                    Action<XElement, int> parentCloseAction) {  
                if (element == null) { throw new ArgumentNullException ("element"); } 
                element.RecursivelyProcess (0, childAction, parentOpenAction, parentCloseAction);  
                }  
    
     private static void RecursivelyProcess (  
                this XElement element,  
                int depth,  
                Action<XElement, int> childAction,  
                Action<XElement, int> parentOpenAction,  
                Action<XElement, int> parentCloseAction)  { 
     
                if (element == null)  { throw new ArgumentNullException ("element"); } 
                if (!element.HasElements) {         /* Reached the deepest child */
                    if (childAction != null) { childAction (element, depth); }  
                    }  
                else  {                             /* element has children */
                    if (parentOpenAction != null)  { parentOpenAction (element, depth); }  
                    depth++;  
                   
                    foreach (XElement child in element.Elements ())  {  
                        child.RecursivelyProcess ( depth,  childAction,  parentOpenAction,  parentCloseAction );  
                        }     
                    depth--;  
                    
                    if (parentCloseAction != null)  {  parentCloseAction (element, depth);  }
                    }  
                }
            }

    Avance, 29 Апреля 2011

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

    +158

    1. 1
    if(typeof n!="number"&&(k==Number||!(n instanceof Number))||p.round(n)!=n||n==NaN||n==Infinity)return!1;

    http://www.google-analytics.com/ga.js
    Инженеры в Гугле знают толк в JavaScript'e.

    wvxvw, 29 Апреля 2011

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

    +192

    1. 1
    class AutocompleteAddressZaplatka2 extends AutocompleteAddressZaplatka

    Фундаментальные объектно-ориентированные костыли ...

    _tL, 29 Апреля 2011

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

    +164

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    $cur = date('Y-m-d',time());
    $date_arr = explode('-',$cur);
    $year =$date_arr[0];
    $month =$date_arr[1];
    $day =$date_arr[2];

    _tL, 29 Апреля 2011

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

    +166

    1. 1
    enum mysymbols={true,flase}

    С товарищем в аудитории на доске писали разные говнокоды, кто какие вспомнит. Заходит препод, оглянул взглядом доску, улыбнулся, и начал писать свою версию (см. выше), приговаривая: "Вот веселуха то начнется!" =)

    1_and_0, 29 Апреля 2011

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

    +162

    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
    function show_price_list() {
    $period_1 = $period_2 = $period_3 = $period_4 = $period_5 = $period_6 = "";
    $query = "
    		SELECT id, price, type
    		FROM price 
    		ORDER BY type, start
    	";
    $this->registry['sql']->query($query);
    if ($this->registry['sql']->getNumberRows()>0) {
    	foreach ($this->registry['sql']->getFetchObject() as $oRow) {
    		switch($oRow->type) {
    			case 0: $period_1 .= '<td><input type="text" name="period['.$oRow->id.']" value="'.$oRow->price.'"></td>';
    			break;
    			case 1: $period_2 .= '<td><input type="text" name="period['.$oRow->id.']" value="'.$oRow->price.'"></td>';
    			break;
    			case 2: $period_3 .= '<td><input type="text" name="period['.$oRow->id.']" value="'.$oRow->price.'"></td>';
    			break;
    			case 3: $period_4 .= '<td><input type="text" name="period['.$oRow->id.']" value="'.$oRow->price.'"></td>';
    			break;
    			case 4: $period_5 .= '<td><input type="text" name="period['.$oRow->id.']" value="'.$oRow->price.'"></td>';
    			break;
    			case 5: $period_6 .= '<td><input type="text" name="period['.$oRow->id.']" value="'.$oRow->price.'"></td>';
    			break;
    		}
    	}
    }
    @$this->registry['template']->set('period_1', $period_1);
    @$this->registry['template']->set('period_2', $period_2);
    @$this->registry['template']->set('period_3', $period_3);
    @$this->registry['template']->set('period_4', $period_4);
    @$this->registry['template']->set('period_5', $period_5);
    @$this->registry['template']->set('period_6', $period_6);
    
    	}

    Классика жанра

    1_and_0, 29 Апреля 2011

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

    +160

    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
    class CIBlockFindTools
    
    ...
    
    function GetSectionID($section_id, $section_code, $arFilter)
    {
    	$section_id = intval($section_id);
    	if($section_id > 0)
    	{
    		return $section_id;
    	} else if(){
                  }
                 return 0;
    ...
    }

    битрикс суров, использует свою реализацию intval(). как мы могли без этого жить?

    hunterman, 29 Апреля 2011

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

    +163

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    $lu=0;
    $ray_array = file("allray.txt");
    while (empty($rayon)) //пока район не заполнен значением
    {
    preg_match("#".trim($ray_array[$lu++])."#", $text, $rayon);
    }

    Многострочный поиск

    Uchkuma, 29 Апреля 2011

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