1. C# / Говнокод #4635

    +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
    public string UploadFileEx(string uploadfile, string url,string fileFormName, 
                string contenttype, NameValueCollection querystring, CookieContainer cookies
            ){
                if ((fileFormName == null) ||
                    (fileFormName.Length == 0))
                {
                    fileFormName = "file";
                }
    
                if ((contenttype == null) ||
                    (contenttype.Length == 0))
                {
                    contenttype = "application/octet-stream";
                }
    
    
                string postdata;
                postdata = "?";
                if (querystring != null)
                {
                    foreach (string key in querystring.Keys)
                    {
                        postdata += key + "=" + querystring.Get(key) + "&";
                    }
                }

    String.IsNullOrEmpty ??????
    http://code.google.com/p/habreffect-uploader/source/browse/trunk/clipboardUploader/Uploader.cs
    http://habrahabr.ru/blogs/net/108165/

    Nigma143, 15 Ноября 2010

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

    +108

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    ...
    while (true)
    {
         if(i > 5 || SourceNumber == Math.Floor(SourceNumber)) break;
         ...
         i++;
    }
    ...

    Мартин, 15 Ноября 2010

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

    +119

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    SqlCommand cmd = new SqlCommand("...");
    ...
    int SIZE = 1;
    SqlParameter[] parameters = new SqlParameter[SIZE];
    for (int i = 0; i < SIZE; i++) parameters[i] = new SqlParameter();
    
    parameters[0].ParameterName = "@param_name";
    parameters[0].Value = param_value;
    for (int i = 0; i < SIZE; i++) cmd.Parameters.Add(parameters[i]);

    А как вы задаете значения параметров у своих SQL-команд? :)

    maa-kut, 15 Ноября 2010

    Комментарии (0)
  4. Perl / Говнокод #4632

    −155

    1. 1
    $??s:;s:s;;$?::s;;=]=>%-{<-|}<&|`{;;y; -/:-@[-`{-};`-{/" -;;s;;$_;see

    Arigato, 15 Ноября 2010

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

    +151

    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
    function send_mail ($to, $thm, $html, $path) {
    	$fp = @fopen ($path, 'r');
    	if (!$fp) {
    		print "<p>File $path could not be read</p>";
    		exit();
    	}
    	$file = fread ($fp, filesize ($path));
    	fclose($fp);
    	// Generate the separate
    	$boundary = "--".md5 (uniqid(time ()));
    	$headers = "MIME-Version: 1.0\n";
    	$headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"\n";
    	$multipart = "--$boundary\n";
    	$kod = "koi8-r";	// or $kod = "windows-1251";
    	$mulripart .= "Content-Type: text/html; charset=$kod\n";
    	$multipart .= "Content-Transfer-Encoding: Quot-Printed\n\n";
    	$multipart .= "$html\n\n";
    	$message_part = "--$boundary\n";
    	$message_part .= "Content-Type: application/octet-stream\n";
    	$message_part .= "Content-Transfer-Encoding: base64\n";
    	$message_part .= "Content-Disposition: attachment; filename=\"".$path."\"\n\n";
    	$message_part .= chunk_split (base64_encode ($file));
    	$miltipart .= $message_part."--$boundary--\n";
    	if (!mail ($to, $thm, $multipart, $headers))
    		exit("<p>Error sending e-mail</p>");
    }

    Интересно, кто-нибудь будет этим Г пользоваться?!

    dwinner, 15 Ноября 2010

    Комментарии (18)
  6. SQL / Говнокод #4630

    −194

    1. 1
    SELECT *  #__zakaz_montazh  `id`='$id'

    Нужна была информация по id
    Пол часа искал в скриптах причину чего не работает...
    Заработался видимо....

    sssims, 15 Ноября 2010

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

    +133

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    int count1 = 0;
                foreach (int a in ilist)
                {
                    lister[count1] = ilist.ElementAt(count1);
                    count1++;
                }

    dot, 15 Ноября 2010

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

    +183

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    bool or(bool x1, bool x2) {
    	if (x1 || x2)
    		return true;
    	else
    		return false;
    }

    Я РЕАЛЬНО видел такой код, написанный на полном серьёзе.

    Alever, 14 Ноября 2010

    Комментарии (40)
  9. Pascal / Говнокод #4627

    +104

    1. 1
    2. 2
    if doc_lang='UA' then filename:=ExtractFileDir(Application.ExeName)+'/docs/sales_slip_MS_UA.xlt';
    if doc_lang='RU' then filename:=ExtractFileDir(Application.ExeName)+'/docs/sales_slip_MS_RU.xlt';

    Классика жанра, и так пол проги((((((

    Nikitiy_II, 14 Ноября 2010

    Комментарии (4)
  10. Куча / Говнокод #4626

    +131

    1. 1
    <i style="background-image: url(.......);"/>

    Взято с facebook.com
    Не знаю, какой глубинный смысл в выборе тега i для вставки картинки, который совершенно для этого не предназначен. Есть же div и span. Может это как-то нужно для отметания веб роботов, а может просто захотелось извратиться

    gorsash, 14 Ноября 2010

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