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

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

    +158

    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
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <html xmlns="http://www.w3.org/1999/xhtml" lang="ru" xml:lang="ru"> 
    <head> 
    ...
    <?php
    if( !isset($page['header']['links']) || empty($page['header']['links']) )
    {
    ?>
    <link rel="shortcut icon" href="/sites/all/themes/deco/favicon.ico" type="image/x-icon" /> 
    <link type="text/css" rel="stylesheet" media="all" href="/modules/node/node.css?t" /> 
    <link type="text/css" rel="stylesheet" media="all" href="/modules/poll/poll.css?t" /> 
    <link type="text/css" rel="stylesheet" media="all" href="/modules/system/defaults.css?t" /> 
    <link type="text/css" rel="stylesheet" media="all" href="/modules/system/system.css?t" /> 
    <link type="text/css" rel="stylesheet" media="all" href="/modules/system/system-menus.css?t" /> 
    <link type="text/css" rel="stylesheet" media="all" href="/modules/user/user.css?t" /> 
    <link type="text/css" rel="stylesheet" media="all" href="/sites/all/modules/cck/theme/content-module.css?t" /> 
    <link type="text/css" rel="stylesheet" media="all" href="/sites/all/modules/filefield/filefield.css?t" /> 
    <link type="text/css" rel="stylesheet" media="all" href="/sites/all/modules/geshifilter/geshifilter.css?t" /> 
    <link type="text/css" rel="stylesheet" media="all" href="/sites/all/modules/quote/quote.css?t" /> 
    <link type="text/css" rel="stylesheet" media="all" href="/sites/all/modules/tagadelic/tagadelic.css?t" /> 
    <link type="text/css" rel="stylesheet" media="all" href="/sites/all/modules/vote_up_down/vote_up_down.css?t" /> 
    <link type="text/css" rel="stylesheet" media="all" href="/modules/comment/comment.css?t" /> 
    <link type="text/css" rel="stylesheet" media="all" href="/sites/all/modules/pr_cy/pr_cy.css?t" /> 
    <link type="text/css" rel="stylesheet" media="all" href="/modules/openid/openid.css?t" /> 
    <link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/deco/style.css?t" /> 
    <link type="text/css" rel="stylesheet" media="all" href="/examples/tagnetic/tags.css?t" /> 
    <link type="text/css" rel="stylesheet" media="print" href="/sites/all/themes/deco/print.css?t" /> 
    <script type="text/javascript" src="/misc/jquery.js?t"></script> 
    <script type="text/javascript" src="/misc/drupal.js?t"></script> 
    <script type="text/javascript" src="/files/languages/ru_5530db2a4478b35f94b4da1e2062c5fb.js?t"></script> 
    <script type="text/javascript" src="/sites/all/modules/vote_up_down/ajax_vote_up_down.js?t"></script> 
    <script type="text/javascript" src="/sites/all/themes/deco/jquery.tagnetic.js?t"></script> 
    <script type="text/javascript" src="/sites/all/themes/deco/jquery.tagnetic.settings.js?t"></script> 
    <script type="text/javascript" src="/modules/comment/comment.js?t"></script> 
    <script type="text/javascript" src="/misc/textarea.js?t"></script> 
    <script type="text/javascript" src="/sites/all/modules/pr_cy/pr_cy.js?t"></script> 
    <script type="text/javascript" src="/modules/openid/openid.js?t"></script>
    <?php
    }
    else
    {
    echo $page['header']['links'];
    }
    ?>

    Я, конечно, понимаю, что это необходимо, но такие хеды у меня всегда вызывают улыбку)

    greevex, 12 Сентября 2009

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

    +163.6

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    <?php
    function get_user() {
    	// функция перенесена в secure.func.php
    	$user = get_user();
    	return $user;
    }
    ?>

    Shock, 09 Сентября 2009

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

    −149

    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
    1С 8.1
    Вот как надо таблицу значений очищать..))
    
    	ТЗДанные.Очистить();
    	Пока 1 = 1 Цикл
    		Если ТЗДанные.Колонки.Количество() = 0 Тогда
    			Прервать;
    		КонецЕсли;
    		ТЗДанные.Колонки.Удалить(0);
    	КонецЦикла;
    
    И ещё бы контрольный... была бы сказка....
    ТЗДанные =  Новый ТаблицаЗначений;

    ValeraVV, 09 Сентября 2009

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

    +149.8

    1. 1
    2. 2
    3. 3
    4. 4
    //простите меня за эти строки, но просто альтернативный метод swapNode (нативный только в IE)
    //удаляет оригинальный нод и его приходится заново по id искать :(
    document.getElementById(element['drag'].id).style.border = "2px solid gray";
    document.getElementById(element['acce'].id).style.border = "2px solid gray";

    :))))
    каммент жжот

    мой старый JS-быдлокод

    danilissimus, 06 Сентября 2009

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

    +157.2

    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
    function validate($allsubmitted){
    	$massage="";
    	$passwords= $allsubmitted["pword"];
    	$firstpass= $passwords[0];
    	$secondpass= $passwords[1];
    	$username= $allsubmitted["name"];
    	if ($firstpass!= $secondpass){
    		$massage=$massage."Пароль верен<br>";
    	} else {
    		$massage=$massage."Не правильно введен пароль";
    	}
    	if (strlen($username)<5 || strlen($username)>50){
    		$massage= $massage."Ник должен быть от 5 до 50 символов";
    	}
    	if ($massage==""){
    		$massage= "clear";
    	}
    	return $massage;
    }
    validate($_POST);
    	if (validate($_POST)=="clear"){
    		echo "Спасибо за регистрацию!";
    	} else {
    		echo "У Вас возникли проблемы с регистрацией!";
    	}

    "***: Привет всем, http://www.govnokod.com/1488 подскжите что не парвильно в этом говнокоде? вбивал данные и правильные и не правильные, результат один: У Вас возникли проблемы с регистрацией!"

    мы все учились понемногу ©

    striker, 04 Сентября 2009

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

    +157.2

    1. 1
    if(preg_match("/\.[gjpi][ipnc][fgo]/i", $_SERVER['REQUEST_URI'])) exit;

    gorvic, 28 Августа 2009

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

    +8.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
    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
    // файлToolStripMenuItem
    			// 
    			this->файлToolStripMenuItem->Name = L"файлToolStripMenuItem";
    			this->файлToolStripMenuItem->Size = System::Drawing::Size(54, 22);
    			this->файлToolStripMenuItem->Text = L"Файл";
    			this->файлToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::файлToolStripMenuItem_Click);
    			// 
    			// Form1
    			// 
    			this->AutoScaleDimensions = System::Drawing::SizeF(8, 16);
    			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
    			this->ClientSize = System::Drawing::Size(292, 260);
    			this->Controls->Add(this->button1);
    			this->Controls->Add(this->menuStrip1);
    			this->MainMenuStrip = this->menuStrip1;
    			this->Name = L"Form1";
    			this->Text = L"Form1";
    			this->menuStrip1->ResumeLayout(false);
    			this->menuStrip1->PerformLayout();
    			this->ResumeLayout(false);
    			this->PerformLayout();
    
    		}
    #pragma endregion
    	private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
    			 }
    	private: System::Void меню1ToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
    			 }
    private: System::Void файлToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
    		 }
    private: System::Void выходToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
    		 }
    };

    MS VS 2005 - MS VS 2008 это спокойно компилирует, да ещё и сама код генерирует, когда на формочке рисуешь русское меню.
    Этот компилятор определённо соответсвует стандарту С++.

    Говногость, 18 Августа 2009

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

    +12.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
    15. 15
    class TIntArray
    {
    	char buf[10000];
    	int operator[](int Index);
    };
    
    ...
    
    void main()
    {
    	TIntArray a;
    	...
    	memset(&a[1],0.0f,sizeof(TIntArray));
    	...
    };

    Меня этот кот довёл до слёз...

    Говногость, 18 Августа 2009

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

    +13.1

    1. 1
    2. 2
    3. 3
    #define REGISTER_PACKET(cls, type)\
    __declspec(selectany) PacketType cls::s_type = CPacketFactory::RegisterPacket(type, cls::CreateNew); \
    __pragma(comment(linker, "/include:?s_type@##cls##@@2W4PacketType@@C"))

    Очень правильный код... Делать можно только так.

    Говногость, 18 Августа 2009

    Комментарии (11)
  11. Си / Говнокод #1596

    +136

    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
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    #include <stdio.h>
    #include <pthread.h>
    #include <unistd.h>
    #include <math.h>
    #include <stdlib.h>
    
    struct thread_arg
    {
    	int a;
    	int b;
    	int c;
    	double d;
    };
    	
    
    void *ret_x1(void *arg)
    {
    		
    	struct thread_arg targ = *(struct thread_arg *)arg;
    	double x1;
    	x1 = (-targ.b + sqrt(targ.d)) / (2*targ.a);
    
    	fprintf(stderr, "x1 = %f\n", x1);
    
    	return NULL;
    }
    
    void *ret_x2(void *arg)
    {
    	struct thread_arg targ = *(struct thread_arg*)arg;
    	double x2;
    	x2 = (-targ.b - sqrt(targ.d)) / (2*targ.a);
    
    	
    
    	fprintf(stderr, "x2 = %f\n", x2);
    	
    	return NULL;
    }
    
    int main(void)
    {
    	pthread_t thread1, thread2;
    	struct thread_arg args;
    
    	fprintf(stderr, "Enter a, b and c\n");
    	scanf("%d %d %d", &args.a, &args.b, &args.c);
    	
    	args.d = args.b*args.b - 4*args.a*args.c;
    
    	if(args.d < 0)
    	{
    		fprintf(stderr,"There is no roots\n");
    		return 0;
    	}
    	else
    	{
    		if(pthread_create(&thread1, NULL, &ret_x1, &args) != 0)
    		{
    			fprintf(stderr, "Error1\n");
    			return 1;
    		}
    		if(pthread_create(&thread2, NULL, &ret_x2, &args) != 0)
    		{
    			fprintf(stderr, "Error2\n");
    			return 1;
    		}
    		pthread_join(thread1, NULL);
    		pthread_join(thread2, NULL);
    
    	}
    	return 0;
    		
    }

    Многопоточное решение квадратного уравнения...

    zitzy, 16 Августа 2009

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