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

    +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
    <script language="php">
    $curl=curl_init("http://www.sportbox.ru");
    $proxy='us:psw@IP:port';
     
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($curl, CURLOPT_PROXY, $proxy);
     
    $content=curl_exec($curl);
     
    preg_match_all('#<h3><a href(.*)>(.*)</a></h3>#siU', $content, $titles);
    foreach ($titles[2] as $title)
    echo "<b>$title</b><br>";
     
    curl_close($content);
    </script>

    qbasic, 03 Марта 2011

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

    +163

    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
    <title>
    <?php
    $t=$_SERVER['REQUEST_URI'];
    		        switch($t)
                    {
                    case '/':   echo "Канцтовары, бумага";
                      break;
                                           case '/shopping/':   echo "Каталог товаров: канцтовары, бумага, кресла, стулья, картриджи, хозтовары, офисная мебель";
                      break;
                                           case '/collection/':   echo "Коллекция рисунков: канцтовары, бумага, кресла, стулья, картриджи, хозтовары, офисная мебель";
                      break;
    
                                           case '/shopping/?id=1':   echo "Бухгалтерские бланки и книги";
                      break;
                                           case '/collection/?id=1':   echo "Коллекция бухгалтерских бланков и книг";
                      break;
                                           case '/shopping/?id=9':   echo "Каталог канцелярских товаров";
                      break;
            default: echo " Канцтовары, бумага, кресла и стулья, картриджи";
    
    }
    
    
    ?></title>

    Правлю самописку 0_о
    Формирование тайтла :)

    tranquillity, 03 Марта 2011

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

    +162

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    function SearchBuildRoute( &$query )
    {
    	$segments = array();
    
    	if (isset($query['view'])) {
    		unset($query['view']);
    	}
    	return $segments;
    }

    Joomla 1.5.22 кастомазил поиск наткнулся.

    kr0k, 03 Марта 2011

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

    +163

    1. 1
    2. 2
    3. 3
    4. 4
    $str="'".trim(iconv("cp866","UTF-8",$row['P_NOMER']))."','".trim(iconv("cp866","UTF-8",$row['P_DATA']))."','".trim(iconv("cp866","UTF-8",$row['V_NOMER']))."','".trim(iconv("cp866","UTF-8",$row['V_DATA']))."','".trim(iconv("cp866","UTF-8",$row['PL_NOMER']))."','".trim(iconv("cp866","UTF-8",$row['PL_DATA']))."',".$row['PL_SUMMA'].",'".trim(iconv("cp866","UTF-8",$row['SODER']))."','".trim(iconv("cp866","UTF-8",$row['NA_SOGL']))."','".trim(iconv("cp866","UTF-8",$row['N_RAY']))."','".trim(iconv("cp866","UTF-8",$row['KOD_PRED']))."','".trim(iconv("cp866","UTF-8",$row['NAME_1']))."','".trim(iconv("cp866","UTF-8",$row['TIP_TY']))."','".trim(iconv("cp866","UTF-8",$row['KOD_TY']))."','".trim(iconv("cp866","UTF-8",$row['REG_PRIM']))."',".$row['P_NAG_1'].",'".trim(iconv("cp866","UTF-8",$row['DATA_REG']))."','".trim(iconv("cp866","UTF-8",$row['NOMER_REG']))."','".trim(iconv("cp866","UTF-8",$row['NOMER_TY']))."','".trim(iconv("cp866","UTF-8",$row['GOD_TY']))."',".$row['G_M'].",'".trim(iconv("cp866","UTF-8",$row['INN']))."',".$row['KOD_SPRIP1'].",".$row['KOD_SPRIP2'].",".$row['KOD_SPRIP3'].",'".trim(iconv("cp866","UTF-8",$row['PL_NOMER2']))."','".trim(iconv("cp866","UTF-8",$row['PL_DATA2']))."',".$row['PL_SUMMA2'].",'".trim(iconv("cp866","UTF-8",$row['PL_NOMER3']))."','".trim(iconv("cp866","UTF-8",$row['PL_DATA3']))."',".$row['PL_SUMMA3'].",'".trim(iconv("cp866","UTF-8",$row['USER_PF']))."','".trim(iconv("cp866","UTF-8",$row['N_TIP']))."','".trim(iconv("cp866","UTF-8",$row['N_USEL']))."','".trim(iconv("cp866","UTF-8",$row['EDIN_TY']))."','".trim(iconv("cp866","UTF-8",$row['IST_EL']))."','".trim(iconv("cp866","UTF-8",$row['NAME_2']))."',"; 
    ...
    ...
    $sql="INSERT INTO table (p_nomer,p_data,v_nomer,v_data,pl_nomer,pl_data,pl_summa,soder,na_sogl,n_ray,kod_pred,name_1,tip_ty,kod_ty,reg_prim,p_nag_1,data_reg,nomer_reg,nomer_ty,god_ty,g_m,inn,kod_sprip1,kod_sprip2,kod_sprip3,pl_nomer2,pl_data2,pl_summa2,pl_nomer3,pl_data3,pl_summa3,user_pf,n_tip,n_usel,edin_ty,ist_el,name_2,) VALUES ('".trim(iconv("cp866","UTF-8",$row['P_NOMER']))."','".trim(iconv("cp866","UTF-8",$row['P_DATA']))."','".trim(iconv("cp866","UTF-8",$row['V_NOMER']))."','".trim(iconv("cp866","UTF-8",$row['V_DATA']))."','".trim(iconv("cp866","UTF-8",$row['PL_NOMER']))."','".trim(iconv("cp866","UTF-8",$row['PL_DATA']))."',".$row['PL_SUMMA'].",'".trim(iconv("cp866","UTF-8",$row['SODER']))."','".trim(iconv("cp866","UTF-8",$row['NA_SOGL']))."','".trim(iconv("cp866","UTF-8",$row['N_RAY']))."','".trim(iconv("cp866","UTF-8",$row['KOD_PRED']))."','".trim(iconv("cp866","UTF-8",$row['NAME_1']))."','".trim(iconv("cp866","UTF-8",$row['TIP_TY']))."','".trim(iconv("cp866","UTF-8",$row['KOD_TY']))."','".trim(iconv("cp866","UTF-8",$row['REG_PRIM']))."',".$row['P_NAG_1'].",'".trim(iconv("cp866","UTF-8",$row['DATA_REG']))."','".trim(iconv("cp866","UTF-8",$row['NOMER_REG']))."','".trim(iconv("cp866","UTF-8",$row['NOMER_TY']))."','".trim(iconv("cp866","UTF-8",$row['GOD_TY']))."',".$row['G_M'].",'".trim(iconv("cp866","UTF-8",$row['INN']))."',".$row['KOD_SPRIP1'].",".$row['KOD_SPRIP2'].",".$row['KOD_SPRIP3'].",'".trim(iconv("cp866","UTF-8",$row['PL_NOMER2']))."','".trim(iconv("cp866","UTF-8",$row['PL_DATA2']))."',".$row['PL_SUMMA2'].",'".trim(iconv("cp866","UTF-8",$row['PL_NOMER3']))."','".trim(iconv("cp866","UTF-8",$row['PL_DATA3']))."',".$row['PL_SUMMA3'].",'".trim(iconv("cp866","UTF-8",$row['USER_PF']))."','".trim(iconv("cp866","UTF-8",$row['N_TIP']))."','".trim(iconv("cp866","UTF-8",$row['N_USEL']))."','".trim(iconv("cp866","UTF-8",$row['EDIN_TY']))."','".trim(iconv("cp866","UTF-8",$row['IST_EL']))."','".trim(iconv("cp866","UTF-8",$row['NAME_2']))."',)"; //запрос

    это часть кода для импорта данных из dbf

    crs, 03 Марта 2011

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

    +158

    1. 1
    2. 2
    3. 3
    function sqlemptydate($test) {
      return (!$test || ($test == '0000-00-00') || ($test == '0000-00-00 00:00:00'));
    }

    ilyamx, 03 Марта 2011

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

    +160

    1. 1
    $VAR['server'] = trim(str_replace("www.","",strtolower($_SERVER['SERVER_NAME'])));

    Угадайте что этот код должен делать, и что он делает на самом деле. Да, это ужас. Это один из многих ужасов, доставшихся мне от предыдущего программиста. До этого самым большим был explode имени файла через точку и подставление второго элемента как расширение.

    BiSe_Trojanov, 02 Марта 2011

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

    +163

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    if ($type=='input') $params['class'] = 'styleInput';
    if ($type=='password') $params['class'] = 'stylePassword';
    if ($type=='checkbox') $params['class'] = 'styleCheckBox';
    if ($type=='select') $params['class'] = 'styleSelect';
    if ($type=='multipleSelect') $params['class'] = 'styleMultipleSelect';
    if ($type=='textarea') $params['class'] = 'styleTextarea';
    if ($type=='groupSelect') $params['class'] = 'styleGroupSelect';

    Конкатенация - враг! Учитесь трудолюбию!

    ifeya, 02 Марта 2011

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

    +169

    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
    <?php
    	exit
    	(
    		empty($_POST['key']) ||
    		empty($_POST['time']) ||
    		empty($_POST['email']) ||
    		(int)$_POST['time'] != $_POST['time'] ||
    		strlen((int)$_POST['time']) != strlen($_POST['time']) ||
    		!preg_match('/^[^@]+@[a-zA-Z0-9._-]+\.[a-zA-Z]+$/', $_POST['email']) ||
    		($_SERVER['REQUEST_TIME'] - $_POST['time']) > 60 * 60 ||
    		md5(str_rot13(md5($_POST['time']))) != $_POST['key']
    		?'-':'+'
    	);
    ?>

    Вот Ajax ответ

    wyand, 02 Марта 2011

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

    +166

    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
    $url=$_SERVER['REQUEST_URI'];
    $url9=substr($url,0,9);
    $url8=substr($url,0,8);
    $url14=substr($url,0,14);
    $url10=substr($url,0,10);
    $url5=substr($url,0,5);
    if ($url9=='/calendar') {
    printf('<!-- (C)2000-2010 Gemius SA - gemiusAudience / sitecom / Calendar -->
    <script type="text/javascript">
    <!--//--><![CDATA[//><!--
    var pp_gemius_identifier = new String(\'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\');
    //--><!]]>
    </script>
    <script type="text/javascript" src=" http://site.com/gemius/xgemius.js"></script>');
    }elseif ($url8=='/content'){
    printf('<!-- (C)2000-2010 Gemius SA - gemiusAudience / sitecom / Content -->
    <script type="text/javascript">
    <!--//--><![CDATA[//><!--
    var pp_gemius_identifier = new String(\'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\');
    //--><!]]>
    </script>
    <script type="text/javascript" src=" http://site.com/gemius/xgemius.js"></script>');
    }
    elseif ($url14=='/forum_arch'){
    printf('<!-- (C)2000-2010 Gemius SA - gemiusAudience / sitecom / Forum archiv -->
    <script type="text/javascript">
    <!--//--><![CDATA[//><!--
    var pp_gemius_identifier = new String(\'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\');
    //--><!]]>
    </script>
    <script type="text/javascript" src=" http://site.com/gemius/xgemius.js"></script>');
    }
    elseif ($url10=='/forum/'){
    printf('<!-- (C)2000-2010 Gemius SA - gemiusAudience / sitecom / Forum pages -->
    <script type="text/javascript">
    <!--//--><![CDATA[//><!--
    var pp_gemius_identifier = new String(\'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\');
    //--><!]]>
    </script>
    <script type="text/javascript" src=" http://site.com/gemius/xgemius.js"></script>');
    }
    elseif ($url5=='/news'){
    printf('<!-- (C)2000-2010 Gemius SA - gemiusAudience / sitecom / News -->
    <script type="text/javascript">
    <!--//--><![CDATA[//><!--
    var pp_gemius_identifier = new String(\'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\');
    //--><!]]>
    </script>
    <script type="text/javascript" src=" http://site.com/gemius/xgemius.js"></script>');
    }
    else {
    printf('<!-- (C)2000-2010 Gemius SA - gemiusAudience / sitecom / Glavnaja stranitsa sajta -->
    <script type="text/javascript">
    <!--//--><![CDATA[//><!--
    var pp_gemius_identifier = new String(\'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\');
    //--><!]]>
    </script>
    <script type="text/javascript" src=" http://site.com/gemius/xgemius.js"></script>');
    }

    Вместо xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxx в коде оригинальные id счетчиков. Это всё чудо лежит в базе и выполняется через eval()

    nergalic, 01 Марта 2011

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

    +159

    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
    function _getConditionWithCategoryConj( $condition, $categoryID ) //fetch products from current category
    {
      $category_condition = "";
      $q = db_query("select productID from ".
                CATEGORIY_PRODUCT_TABLE." where categoryID=".(int)$categoryID);
      $icounter = 0;
      while( $product = db_fetch_row( $q ) )
      {
        if ( $icounter == 0 )
          $category_condition .= " productID IN ('";
        if ( $icounter > 0 )
          $category_condition .= ", ";
        $category_condition .= (int)$product[0];
        $icounter++;
      }
      if ( $icounter>0 ) {
        $category_condition .= "')";
      }

    shopcms.
    нет слов больше.

    zealotous, 01 Марта 2011

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