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

    +171.6

    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
    if ( !empty( $page ) )
    {
        if ( $page == "login" )
        {
            $spage = "Login.inc";
        }
        else if ( $page == "rules" )
        {
            $spage = "rules.inc";
        }
        else if ( $page == "help" )
        {
            $spage = "help.inc";
        }
        else if ( $page == "wm" )
        {
            $spage = "wm.inc";
        }
        else if ( $page == "game" 
        {
            $spage = "game.inc";
        }
        else if ( $page == "webmoney" )
        {
            $spage = "webmoney.inc";
        }
        else if ( $page == "egold" )
        {
            $spage = "egold.inc";
        }
        else if ( $page == "cashin" )
        {
            $spage = "cashin.inc";
        }
        else if ( $page == "ballans" )
        {
            $spage = "ballans.inc";
        }
        else if ( $page == "remind" )
        {
            $spage = "remind.inc";
        }
        else if ( $page == "contact" )
        {
            $spage = "contact.inc";
        }
        else if ( $page == "reg" )
        {
            $spage = "reg.inc";
        }

    :(((

    azzz, 25 Декабря 2009

    Комментарии (16)
  2. Си / Говнокод #2332

    +131.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
    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
    static void module3_exit(void){        
      cdev_del(mydev);            
      printk(KERN_INFO"Device"DEV_NAME"was deleted");
    };                                               
    int mydev_open(struct inode *in,struct file *filp){                                                 
      printk(KERN_INFO DEV_NAME "open");              
      struct dev_state *dev_stat;                     
      dev_stat=&STATE[MINOR(in->i_rdev)];             
      if(dev_stat->dev_open)                          
      {                                               
        printk("Kernel: device "DEV_NAME" is exist"); 
        return -EBUSY;                                
      };                                              
      dev_stat->dev_open++;                           
      dev_stat->dev_read=0;                           
      dev_stat->dev_write=0;                          
      int num= NUM(in->i_rdev);                       
      int type=TYPE(in->i_rdev);                      
      return 0;                                       
    };                                                
    
    int mydev_ioctl(struct inode *in,struct file *filp,unsigned int ioctl,unsigned long param)
    {                                                                                         
      printk(KERN_INFO DEV_NAME "ioctl");                                                     
      return 0;                                                                               
    };                                                                                        
    
    ssize_t mydev_read(struct file *filp,char *buff,ssize_t len,loff_t pos)
    {                                                                      
      printk(KERN_INFO DEV_NAME "read");                                   
      struct inode *in;                                                    
      int count=len;                                                       
      struct dev_state *devst;                                             
      printk("Kernel: try to read %d bytes \n",len);                       
      in=filp->f_dentry->d_inode;                                          
      printk("Kernel: minor number is %d",MINOR(in->i_rdev));              
      devst=&STATE[MINOR(in->i_rdev)];                                     
      while(count--)                                                       
      {                                                                    
        put_user(inb_p(PORT_START+10*MINOR(in->i_rdev)),buff);             
        buff++;                                                            
      };                                                                   
      devst->dev_read+=len;                                                
      printk(KERN_INFO"Kernel: read "DEV_NAME" %d bytes",len);             
      return len;                                                          
    };                                                                     
                                                                           
    ssize_t mydev_write(struct file *filp, const char *buff, ssize_t len,loff_t pos)
    {
      printk(KERN_INFO DEV_NAME "write");
      struct inode *in;
      int count=len;
      unsigned char byte;
      struct dev_state *devst;
      printk(KERN_INFO"Kernel: try to write %d bytes\n",len);
      in=filp->f_dentry->d_inode;
      printk(KERN_INFO"Kernel: minor number %d\n",MINOR(in->i_rdev));
      devst=&STATE[MINOR(in->i_rdev)];
      while(count--)
      {
        get_user(byte, buff);
        outb_p(byte, PORT_START+10*MINOR(in->i_rdev));
        buff++;
      };
      devst->dev_write +=len;
      printk(KERN_INFO"Kernel: "DEV_NAME " written %d bytes\n",len);
      return len;
    };

    Модуль ядра

    Alice, 25 Декабря 2009

    Комментарии (14)
  3. Си / Говнокод #2331

    +128.8

    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
    #define MAX_FILE_LENGHT PAGE_SIZE                                                
    #define TYPE(dev) ( MINOR(dev) >> 4)                                             
    #define NUM(dev)  ( MINOR(dev) & 0xf )                                           
    #define IRQ_NUM 1                                                                
    #define DEV_NAME "keyboard"                                                      
    #define MAX_DEV_COUNT 5                                                          
    #define PORT_START 0xff30                                                        
    int devno,err;
    int mj,min;   
    struct cdev *mydev;
    static char *devbuff;
    struct dev_state{               
    int dev_open;   
    ssize_t dev_read;
    ssize_t dev_write;
    };                
    int mydev_ioctl(struct inode *in,struct file *filp,unsigned int ioctl,unsigned long param);                                                                                                     
    int mydev_open(struct inode *in,struct file* filp);                                                                                                                                                                                                   
    ssize_t mydev_read(struct file *filp,char *buff,ssize_t len,loff_t pos);                                                                                                                        
    ssize_t mydev_write(struct file *filp, const char *buff, ssize_t len,loff_t pos);                                                                                                               
    loff_t mydev_llseek(struct file *filp,loff_t pos, int dist);                                                                                                                                    
    int mydev_close(struct inode *in , struct file *filp);                                                                                                                                          
    static struct dev_state STATE[MAX_DEV_COUNT+1];                                                                                                                               
    struct resource *my_res;                                                                                                                                                                        
    struct file_operations fop_s={
      .owner = THIS_MODULE,       
      .open = mydev_open,         
      .release = mydev_close,     
      .read = mydev_read,         
      .write = mydev_write,       
      .ioctl = mydev_ioctl,       
      .llseek = mydev_llseek,     
    };                            
    static int module3_init(void){                            
      mj=1;                      
      min=1;                     
      my_res->start=0xff30;      
      my_res->name="myres";      
      my_res->flags=IORESOURCE_IO | IORESOURCE_IO_FIXED;
      my_res->parent=NULL;                              
      my_res->sibling=NULL;                             
      my_res->child=NULL;                               
      struct resource *myres=request_region(200,300,"myreg");
      devbuff=(char*)vmalloc(MAX_FILE_LENGHT);               
      memset(devbuff,0x20,sizeof(devbuff));                  
      devno=MKDEV(mj,min);                                   
      mydev=cdev_alloc();                                    
      mydev->owner=THIS_MODULE;                                                              
      cdev_init(mydev,&fop_s);                               
      err=cdev_add(mydev,devno,1);                           
      if(err){                                                      
        printk(KERN_INFO"Invaid devno %d\n",devno);          
        return -EFAULT;                                      
      };                                                     
      printk(KERN_INFO"Device"DEV_NAME"was created\n");      
      return 0;                                              
    };

    Alice, 25 Декабря 2009

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

    +149.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
    myAutoComp.formatResult = function(oResultData, sQuery, sResultMatch) { 
    
          .....
          var aMarkup = ["<div class='myCustomResult'>", 
    	      "<span style='font-weight:bold'>", 
    	      sKey, 
    	      "</span>", 
    	      sKeyRemainder, 
    	      ": ", 
    	      moreData1, 
    	      ", ", 
    	      moreData2, 
    	      "</div>"]; 
                  return (aMarkup.join("")); 
    };

    Отсюда http://developer.yahoo.com/yui/examples/autocomplete/ac_basic_xhr.html

    Oleg_quadro, 25 Декабря 2009

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

    +154.8

    1. 1
    substr ("1111117495". ereg_replace ("[^0-9]", "", $user1->data["mobile_phone"]), -10) == substr ("1111117495". ereg_replace ("[^0-9]", "", $user2->data["mobile_phone"]), -10)

    Сравнение двух мобильных телефонов.

    IHateBidloKod, 24 Декабря 2009

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

    +174.4

    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
    document.body.innerHTML = document.body.innerHTML.replace("[b]", "<b>");
    document.body.innerHTML = document.body.innerHTML.replace("[/b]", "</b>");
    document.body.innerHTML = document.body.innerHTML.replace("[b]", "<b>");
    document.body.innerHTML = document.body.innerHTML.replace("[/b]", "</b>");
    document.body.innerHTML = document.body.innerHTML.replace("[b]", "<b>");
    document.body.innerHTML = document.body.innerHTML.replace("[/b]", "</b>");
    document.body.innerHTML = document.body.innerHTML.replace("[b]", "<b>");
    document.body.innerHTML = document.body.innerHTML.replace("[/b]", "</b>");
    document.body.innerHTML = document.body.innerHTML.replace("[b]", "<b>");
    document.body.innerHTML = document.body.innerHTML.replace("[/b]", "</b>");
    document.body.innerHTML = document.body.innerHTML.replace("[b]", "<b>");
    document.body.innerHTML = document.body.innerHTML.replace("[/b]", "</b>");
    document.body.innerHTML = document.body.innerHTML.replace("[b]", "<b>");
    document.body.innerHTML = document.body.innerHTML.replace("[/b]", "</b>");
    document.body.innerHTML = document.body.innerHTML.replace("[b]", "<b>");
    document.body.innerHTML = document.body.innerHTML.replace("[/b]", "</b>");
    document.body.innerHTML = document.body.innerHTML.replace("[b]", "<b>");
    document.body.innerHTML = document.body.innerHTML.replace("[/b]", "</b>");
    document.body.innerHTML = document.body.innerHTML.replace("[b]", "<b>");
    document.body.innerHTML = document.body.innerHTML.replace("[/b]", "</b>");

    bb-коды на индусском сайте

    fuckyounoob, 24 Декабря 2009

    Комментарии (16)
  7. JavaScript / Говнокод #2327

    +155.2

    1. 1
    setEvent((a,b,c){i=(a==this)?this:return document.getElementById(a);i.on+b=c}})

    fuckyounoob, 24 Декабря 2009

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

    +166.4

    1. 1
    2. 2
    3. 3
    $videoname = explode(".",$video_name);
    unset($videoname[count($videoname)-1]);
    $videoname = implode(".",$videoname);

    Вот такое вот милое отрезание расширения файла = )

    Johnny, 24 Декабря 2009

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

    +173.4

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    if ($_POST["cc"]["status"]==2 && (int)current (mysql_fetch_row (mysql_query ('SELECT COUNT(*) FROM test_vc_log LEFT JOIN test_cc ON test_cc.uid=test_vc_log.cc_id WHERE test_vc_log.event_id=2 AND test_cc.user_id='. $user->data["uid"]. ' AND test_vc_log.created>"'. date ("Y-m-d H:i:s", max (
    	strtotime (is_in (mysql_fetch_row (mysql_query ('SELECT test_vc_log.created FROM test_vc_log LEFT JOIN test_cc ON test_cc.uid=test_vc_log.cc_id WHERE test_vc_log.event_id=1 AND test_cc.user_id='. $user->data["uid"]. ' ORDER BY created DESC LIMIT 0,1')), 0)),
    	strtotime (is_in (mysql_fetch_row (mysql_query ('SELECT created FROM test_rating WHERE event_type=18 AND user_id='. $user->data["uid"]. ' ORDER BY created DESC LIMIT 0,1')), 0)),
    	strtotime ("2009-02-06")
    )). '"'))) > 2){
    
    ....
    
    }

    Я бы этого любителя писать всю программу в if-ах... Да еще и с такими запросами... Урод.

    IHateBidloKod, 24 Декабря 2009

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

    +127.8

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    public static int not(this int i)
    {
          string i2 = Convert.ToString(i, 2),
         res = "";
          foreach (char c in i2)
                res += c == '0' ? '1' : '0';
          return Convert.ToInt32(res, 2);
    }

    Дело было вечером, делать было нечего....

    psina-from-ua, 24 Декабря 2009

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