1. JavaScript / Говнокод #4045

    +144

    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
    Draggable.prototype.move = function(event){		
    		var event = Runic.event.getEvent(event),
    			mLeft = (this.direction == 'both' || this.direction == 'horizontal') ? (Runic.event.getEventX(event) - this.mdiffX) : this.element.offsetLeft,
    			mTop = (this.direction == 'both' || this.direction == 'vertical') ? (Runic.event.getEventY(event) - this.mdiffY) : this.element.offsetTop,
    		//get cursor position
    			curx = Runic.event.getEventX(event),
    			cury = Runic.event.getEventY(event);
    		if (this.box) {
    			if (this.direction == 'horizontal' || this.direction == 'both') {
    				if (curx > this.fromX && curx < this.toX) {
    					this.element.style.left = mLeft  + 'px';
    				} else if (curx <= this.fromX && this.direction) {
    					if (this.boxCSSPosition == 'relative' || this.boxCSSPosition=='absolute') {
    						this.element.style.left = 0 + 'px'
    						this.element.style.right = 'auto'
    					} else {
    						this.element.style.left = this.box.offsetLeft + 'px'
    					}
    				} else if (curx >= this.toX) {
    					if (this.boxCSSPosition == 'relative' || this.boxCSSPosition=='absolute') {
    						this.element.style.right = 0 + 'px'
    						this.element.style.left = 'auto'
    					} else {
    						this.element.style.left = this.box.offsetLeft + this.box.clientWidth - this.element.clientWidth + 'px'
    					}
    				}
    			}
    			if (this.direction == 'vertical' || this.direction == 'both') {
    				if (cury > this.fromY && cury < this.toY) {
    					this.element.style.top = mTop + 'px';
    				} else if (cury <= this.fromY) {
    					if (this.boxCSSPosition == 'relative' || this.boxCSSPosition=='absolute') {
    						this.element.style.top = 0 + 'px';
    						this.element.style.bottom = 'auto'
    					} else {
    						this.element.style.top = this.box.offsetTop + 'px'
    					}		
    				} else if (cury >= this.toY) {
    					if (this.boxCSSPosition == 'relative' || this.boxCSSPosition=='absolute') {
    						this.element.style.bottom = 0 + 'px';
    						this.element.style.top = 'auto'
    					} else {
    						this.element.style.top = this.box.offsetTop + this.box.clientHeight - this.element.clientHeight + 'px'
    					}
    				}
    			}
    		} else {
    			this.element.style.left = mLeft  + 'px';
    			this.element.style.top = mTop + 'px';
    		}
    		//run callback funciton
    		if (this.onDrag != undefined && typeof this.onDrag.func == 'function') {
    			if (this.onDragCount < this.onDrag.count || this.onDrag.count == 0) {
    				this.onDragCount++;
    				this.onDrag.func();
    			}
    		}
    	}

    наговнокодил

    kubynek, 20 Августа 2010

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

    −118

    1. 1
    /^([a-zA-Z0-9]+)([-_.]?[a-zA-Z0-9]+)*@([a-zA-Z0-9]+[-_.]?)*[a-zA-Z0-9]+(?:\.[a-zA-Z]{2,6})$/

    kubynek, 20 Августа 2010

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

    +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
    function SentMessage($Text,$Title) {
    
    	$r=mysql_query("SELECT `id`,`login`,`email` FROM `".$this->TableUsers."` WHERE `access` = 1 and `check_email`=1");
    
    	while( $res = mysql_fetch_array($r) ){               
    		mysql_query("
    			INSERT INTO `".$this->MessTable."` ( 
    				`From` , `To` , `Date` , `Title` , `Text` 
    			) VALUES (
    				'".$this->MainUser['id']."', '".$res[id]."', NOW(), '".$Title."', '".$Text."'
    			)
    		");
    
    		$body=BuildBody("mail.message", $res);
    
    		$headers=' /*... заголовок  ...*/ ';
    		mail ( $res[email], " /*... отправитель ..*/ ", $body, $headers);
    	}
    }

    вот такое чудо враждебной техники откопалось при колупании одной cms'ки...
    (при том что выборка из $this->TableUsers с такими условиями получалась порядка ~500 т. строк )

    istem, 20 Августа 2010

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

    +131

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    /***************************************/
    
    Между прочим, сегодня у нас взят плановый гет 2000 пользователей!
    
    С чем и поздравляем ГК.РУ!
    
    /****************************************/

    2KGET, 20 Августа 2010

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

    +150

    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
    function countdown() {
    		var today = new Date();
    		var start = new Date();
    		start.setTime(Math.ceil(Время ближайшей трансляции будет скоро объявлено * 1000));
    		var remains = new Date();
    		remains.setTime(start - today);
    		//window.status = remains;
    		var d = remains.getUTCDate() - 1;
    		var h = remains.getUTCHours();
    		var m = remains.getUTCMinutes();
    		
    		d = textize(d, 'день', 'дня', 'дней');
    		h = textize(h, 'час', 'часа', 'часов');
    		m = textize(m, 'минуту', 'минуты', 'минут');
    		
    		if (remains.getUTCHours() == 0 && remains.getUTCMinutes() < 5) {
    			document.getElementById('remains').innerHTML="Трансляция начнется с минуты на минуту";
    		} else if (remains.getTime() < 0) {
    			document.getElementById('remains').innerHTML="Трансляция идет";
    			//if (!document.getElementById('hll')) {
    			//	location.reload(true);
    			//}
    		} else {
    			document.getElementById('remains').innerHTML="Ближайшая трансляция — через <b>"+d+" "+h+" "+m+"</b>";
    		}
    	
    		t = setTimeout('countdown()',500);
    	}

    взято с сайта http://kultu.ru/

    kubynek, 20 Августа 2010

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

    −156

    1. 1
    print reverse 1..10

    kubynek, 20 Августа 2010

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

    +155

    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
    <?php
    
    include "conf_db.php";
    if(!empty($_REQUEST['doreg'])){
    $error=array();
    if(!$_REQUEST['name']) $error['name']="Имя";
    if(!$_REQUEST['pass']) $error['pass']="Пароль";
    if(!$_REQUEST['pass_to']) $error['pass_to']="Снова пароль";
    if(!$_REQUEST['e_mail']) $error['e_mail']="E-mail";
    
    if(!empty($error))
     {
     foreach ($error as $value)
      {
      echo "Не заполнено поле $value<br>";
      }
     include "form.php";
     }
     
     if(empty($error))
    {
     $error_to=array();
    if(trim($_REQUEST['pass']) !== trim($_REQUEST['pass_to'])) $error_to['pass']="Пароли не совпадают!";
    
    if(empty($error_to)) 
    {
    $query="select * from users where name='".$_REQUEST['name']."'";
    $id=mysql_query($query)or die(mysql_error());
    $arr=mysql_fetch_array($id);
    if(!empty($arr)) $error_to['db']="пользователь с таким именем уже зарегистрирован!"; 
    }
    if(!empty($error_to))
     {
      foreach($error_to as $value)
      {
      echo $value;
      }
     include "form.php";
     }
    }
    if(empty ($error_to)  && empty($error))
    {
    
    //Здесь проверка прошла.
    
    }
    ?>

    Скрипт регистрации

    desty, 20 Августа 2010

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

    +173

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    function jsPlay(soundobj) {
     var thissound= eval("document."+soundobj);
     try {
     thissound.Play(); // играй!!!
     }
     catch (e) {
     thissound.DoPlay(); // играй СЦУКО!!!!!!!!!!!
     }
    }

    http://rabota2009.ucoz.ru/
    вот так надо использовать try-catch если вы не знали.

    Alfred, 20 Августа 2010

    Комментарии (8)
  9. JavaScript / Говнокод #4037

    +158

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    function rnd(){
    var randscript = -1;
    var num = banners.length;
    while (randscript < 0 || randscript > parseInt(num/col)-1 || isNaN(randscript)){
            randscript = parseInt(Math.random()*(num+1))
    }
    return randscript
    }

    http://earninguide.biz/top.js
    генераторы бывают случайные и псевдослучайные.
    но есть еще и псевдо_ХУ_евые!
    вот один из них...

    Alfred, 20 Августа 2010

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

    +158

    1. 1
    2. 2
    <?php 
    $delete_status = substr ($this->getAdapter()->quote( $delete_status), 1, -1);

    $delete_status - это строка... причем константа.
    в итоге, по ходу задачи это строка ничего не делает...

    nicolay-punin, 20 Августа 2010

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