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

    +158

    1. 1
    За эту же цену:плохой запрос SELECT * FROM tur_stuff WHERE (razdel like '') AND (nal like 1) AND (price>0) AND (price >= *0.90) AND (price <= *1.1)

    Результат, который был пойман по ссылке
    http://www.kant.ru/show_good1.php?t=tur_stuff&id=302960&id_ razdel=159
    Хотя ссылка может в принципе работать. Радует качественная характеристика запроса ;)

    lilfox, 01 Апреля 2012

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

    +156

    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
    <?php if(isset($_GET["fullVersion"])) $_SESSION["fullVersion"]="on"; ?><?php if($_SESSION["fullVersion"]!='on' && (substr_count($_SERVER["HTTP_USER_AGENT"],'Android') || substr_count($_SERVER["HTTP_USER_AGENT"],'iPhone'))){
         header("Location: /m/redirects/?withjs");
         exit;
      }
      else if($_SESSION["fullVersion"]!='on' && substr_count($_SERVER["HTTP_USER_AGENT"],'Opera Mini')){
         header("Location: /m/redirects/?operamini");
         exit;
      }
      ?><?php if($_GET["ClockId"] && $_GET["str"] && $_GET["frompartnerka"]==1){ header("Location: http://vip-timeclub.ru/catalog/articul/?ClockId=".(int)$_GET["ClockId"]."&str=2");} ?>
    
    <?php if(function_exists('vtPrice')==false){
        function vtPrice($price=0,$sale=0,$priceGold=0){
          if($priceGold){
            $priceOld = $price;
            $price = $priceGold;
          }
          else if($sale){
            $priceOld = $price;
            $price = ceil(intval($priceOld)-((intval($priceOld)/100)*(intval($sale))));
          }
          else{
            $priceOld = 0;
          }
          return array('price'=>$price,'priceOld'=>$priceOld);
        }
      }if(function_exists('vtPriceGood')==false){
       function vtPriceGood($price){
          if(intval(substr($price,-1)) > 0 && intval(substr($price,-1)) < 5) 
                $price = intval($price) + (5-intval(substr($price,-1))); 
          else if(intval(substr($price,-1)) > 5 && intval(substr($price,-1)) <= 9) 
                $price = intval($price) + (10-intval(substr($price,-1)));
          return $price;
        }
      } ?>

    spam, club-viptime DOT RU

    111111, 01 Апреля 2012

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

    +140

    1. 1
    VK.callMethod('showPaymentBox', 1);

    Есть приложение ВКонтакте (IFRAME), на него через VK.callMethod('showPaymentBox', 1); внесён 1 голос и пользователь его видит как: http://i.imgur.com/2b57c.png, т.е его можно в любой момент снять. Но как на PHP написать полное снятие этого голоса, чтобы его уже было нереально снять? Помогите, пожалуйста :)

    substr, 30 Марта 2012

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

    +161

    1. 1
    wp_list_categories('orderby=order&hide_empty=0&title_li&echo=0&exclude=13,14,19,20,21,36,37,42,43,44,45,46,47,48,70,126,127,167,75,128,129,130,131,132,133,53,68,69,134,135,136,117,118,119,168,146,120,121,122,67,150,123,142,124,54,125,149,66,104,105,144,106,107,108,55,109,110,111,112,57,113,114,115,116,162,175,95,96,97,98,99,100,59,163,49,101,145,102,103,158,153,157,174,169,160,147,148,151,172,152,161,154,165,173,170,171,177,166,176,155,159,156,164,87,180,181,182,183,184,185,186,191,193,22,194,78,16,82,89,88,28,83,73,85,71,72,30,23,58,86,90,26,25,190,41,34,35,39,40,50,51,52,56,74,62,91,92,93,94,178,187,188,192,18,31,33,63,61,65,60,64,29,32,79,80,81');

    Как вы заебали..

    varg242, 30 Марта 2012

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

    +153

    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
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    95. 95
    require_once('adodb/adodb.inc.php');
    
    class adoDbConnector
    {
        private static $instance = null;
    	
        public static function getInstance()
        {
    	if (self::$instance == NULL)
    	{
    		self::$instance = new adoDbConnector();
    	}
    		
    	return self::$instance;
        }
    
        private function __construct() { }
    	
        public function __clone()
        {
            trigger_error('No __clone()!', E_USER_ERROR);
        }
    
        public function __wakeup()
        {
            trigger_error('No __wakeup()!', E_USER_ERROR);
    	}
    	
    	public function connect($connectionType, $connectionData)
    	{
    		switch($connectionType)
    		{
                        case 0: 
    			return self::generalConnect($connectionData);
    			break;
    			
                        case 1: 
    			return self::dsnConnect($connectionData);
    			break;
    				
                        case 2: 
    			return self::xmlConnect($connectionData);
    			break;
    				
                        default:
    			throw new Exception('Wrong type of connection!');
    		}
    	}
    	
    	private static function generalConnect($connectionData)
    	{	
    		if(is_array($connectionData))
    		{
    			$conn = &ADONewConnection($connectionData[0]); 
    				
    			$conn->PConnect($connectionData[1], $connectionData[2], 
                                    $connectionData[3], $connectionData[4]);
    				
    			return $conn;
    		}
    		else throw new Exception('Wrong type of connection data, must be an array!');
    	}
    	
    	private static function dsnConnect($connectionData)
    	{		
    		if(is_string($connectionData))
    		{
    			$conn = ADONewConnection($connectionData);
    				
    			return $conn;
    		}
    		else throw new Exception('Wrong type of connection data, must be a string!');
    	}
    	
    	private static function xmlConnect($connectionData)
    	{
    		if(is_string($connectionData) && file_exists($connectionData))
    		{
    			$xml = simplexml_load_file($connectionData);
    			
    			foreach($xml as $x)
    			{
    				$connArr[] = trim($x);
    			}
    			
    			$conn = &ADONewConnection($connArr[0]);
    			
    			$conn->PConnect($connArr[1], $connArr[2], $connArr[3], $connArr[4]);
    				
    			return $conn;
    		}
    		else throw new Exception('Wrong file name or connection type!');
    	}
    		
    }

    Archont12, 29 Марта 2012

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

    +28

    1. 1
    2. 2
    3. 3
    function _spb_similar_similar_video_html(&$item, $key) {
      $item = htmlspecialchars($item, ENT_NOQUOTES);
    }

    brainstorm, 29 Марта 2012

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

    +162

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    class Program implements ProgramProvider {
            
            public static function getInstance() {
                    return new Program();
            }
    }

    Гениальная реализация singleton!

    viktor_poltorak, 29 Марта 2012

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

    +158

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    $sCmd='$result=$this->'.$aEvent['method'].'();';
    $this->Hook_Run("action_event_".strtolower($this->sCurrentAction)."_before",array('event'=>$this->sCurrentEvent,'params'=>$this->GetParams()));
    eval($sCmd);
    $this->Hook_Run("action_event_".strtolower($this->sCurrentAction)."_after",array('event'=>$this->sCurrentEvent,'params'=>$this->GetParams()));
    return $result;

    LiveStreet CMS... nuff said...

    nkarakin, 29 Марта 2012

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

    +153

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    do
      {
       $firstDate = ConvertTimeStamp($firstDateSt, "SHORT");
       $lastDate = ConvertTimeStamp($lastDateSt, "SHORT");
       
       $arPeriod = Array(
        "TITLE" => CSchool::GetDiaryPeriod($firstDate, $lastDate),
        "HREF" => $APPLICATION->GetCurPageParam('START_WEEK='.$firstDate.'&END_WEEK='.$lastDate, array("START_WEEK", "END_WEEK"))
       );

    Битрикс...
    do без while? лаконично

    nicksevenfold, 29 Марта 2012

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

    +163

    1. 1
    2. 2
    3. 3
    //fucking designers
    	if ( $page->importantshort ) $page->short = true;
    	if ( $page->importantNOTshort ) $page->short = false;	// так то!

    bot, 29 Марта 2012

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