- 1
- 2
- 3
- 4
- 5
if (!isset($GLOBALS['ISC_CLASS_CART'])) {
$GLOBALS['ISC_CLASS_CART'] = GetClass('ISC_CART');
}
$GLOBALS['ISC_CLASS_CART'] = GetClass('ISC_CART');
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
Всего: 1419
+140
if (!isset($GLOBALS['ISC_CLASS_CART'])) {
$GLOBALS['ISC_CLASS_CART'] = GetClass('ISC_CART');
}
$GLOBALS['ISC_CLASS_CART'] = GetClass('ISC_CART');
Отрывок кода из Interspire Shopping Cart
Пунктуация сохранена...
+148.5
function rgb_to_htmlcolor($rgb) {
$red = $rgb['red'];
$green = $rgb['green'];
$blue = $rgb['blue'];
$red = 0x10000 * max(0,min(255,$red+0));
$green = 0x100 * max(0,min(255,$green+0));
$blue = max(0,min(255,$blue+0));
// convert the combined value to hex and zero-fill to 6 digits
return "#".str_pad(strtoupper(dechex($red + $green + $blue)),6,"0",STR_PAD_LEFT);
}
Преобразование RGB в #RRGGBB
Чувак не ведает что есть sprintf('#%02X%02X%02X')
+150
$str = file_get_contents('faileg.txt');
$reg = '|<a\shref="([^">]*)"><img\ssrc="images/go.gif.*?>Посмотреть подробно<\/a>|mxi';
preg_match_all($reg, $str, $links) or die("Фиг те!");
echo "<pre>";
print_r($links[1]);
echo "</pre>";
foreach($links[1] as $link){
$str2 = file_get_contents($link);
$reg2 = '|<h4>(.*?)<\/h4>[\s\S]*?(\d{2}:\d{2}\s\d{2}\.\d{2}\.\d{4})[\s\S]*?<div[\s\S]*?>([\s\S]*?)<table\s|mxi';
preg_match_all($reg2, $str2, $links2) or die("Фиг те ешо раз!");
$news[] = array(
$link
,$links2[1][0]
,$links2[2][0]
,strip_tags($links2[3][0], "<br><p>")
);
};
echo "<pre>";
print_r($news); //$links2[3][0]
echo "</pre>";
foreach($news as $key){
$xml_str_links.= "<NEWS>
<LINK>".iconv('Windows-1251', 'UTF-8', $key[0])."</LINK>
<NAME>".iconv('Windows-1251', 'UTF-8', $key[1])."</NAME>
<DATA>".iconv('Windows-1251', 'UTF-8', $key[2])."</DATA>
<TEXT>".iconv('Windows-1251', 'UTF-8', $key[3])."</TEXT>
</NEWS>
";
}
$xml_string = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<DOCUMENT>
$xml_str_links
</DOCUMENT>
";
$file = @fopen('news.xml', 'w') or die("Неудалось открыть файл");
fwrite($file, $xml_string);
fclose($file);
x3
+149
<?php
function tep_db_input($string, $link = 'db_link') {
global $$link;
if (function_exists('mysql_real_escape_string')) {
return mysql_real_escape_string($string, $$link);
} elseif (function_exists('mysql_escape_string')) {
return mysql_escape_string($string);
}
return addslashes($string);
}
?>
"контрольный" by OSCommerce 2.2 RC2
+147
$placeholder_id = !empty($_GET['id'])?$_GET['id']:null;
if ( !is_numeric($placeholder_id) )
{
die("ERROR-wrong access (ID)");
}
Мдя... зачем проверки если дохним...
+151
// Защита от вставки HTML-кодов
function filter($string)
{
$string=stripslashes($string);
$string=ereg_replace("<","<",$string);
$string=ereg_replace(">",">",$string);
$string=ereg_replace('\\\"',""",$string);
$string=ereg_replace("!","!",$string);
$string=ereg_replace("\r","",$string);
$string=ereg_replace("\n","<BR>",$string);
$string=ereg_replace("%","%",$string);
$string=ereg_replace("^ +","",$string);
$string=ereg_replace(" +$","",$string);
$string=ereg_replace(" +"," ",$string);
$string=ereg_replace("\|"," ",$string);
return $string;
}
Из LS Guestbook (http://linesoft.org)
−844
SELECT
'X' `TYPEOF`
,161 AS `ID`
,pa.ARTICUL
,p.PRODUCT_NAME
,p.PRODUCT_INSTRUCTION
,p.PRODUCT_WEIGHT
,p.PRODUCT_VOLUME
,p.PRODUCT_RATING
,pm.MEASURE
,b.BRAND_NAME
,cs.COLL_NAME COLLECTION
,m.MAN_NAME MANUFACTORER
,pst.QUANTITY
,p.TIMESTAMP_X AS LAST_MODIFY
,pts.PRODUCT_NOTE
,pts.PRODUCT_DESCRIPTION
,pts.PRODUCT_IMAGE
,pts.PRODUCT_GALLERY
,pts.PRODUCT_ACTIVE
,pts.PRODUCT_ACTIVE_FROM
,pts.PRODUCT_ACTIVE_TO
,pts.PRODUCT_NEW
,pts.PRODUCT_LEADER
,pts.USER_ID
,pts.SITE_ID
,'X' CATEGORIES
,'X' FEATURES
,'X' RANGE_APPLICATION
,'X' RANGE_PRESCRIPTION
,'X' PRODUCT_PRICE
,'X' PRICE_CURRENCY
,'X' PRODUCT_PRICE_GROUP
,'X' IMAGES
FROM `e_products` `p`
LEFT JOIN `e_product_to_site` `pts` ON ((`pts`.`PRODUCT_ID`=161))
LEFT JOIN `e_product_articuls` `pa` ON ((`pa`.`PRODUCT_ID`=161))
LEFT JOIN `e_product_stock` `pst` ON ((`pst`.`PRODUCT_ID`=161))
LEFT JOIN `e_product_to_brand` `ptb` ON ((`ptb`.`BRAND_ID`=161))
LEFT JOIN `e_product_to_collection` `pcl` ON ((`pcl`.`PRODUCT_ID` = 161))
LEFT JOIN `e_product_measure` `pm` ON ((`p`.`PRODUCT_MEASURE` = `pm`.`ID`))
LEFT JOIN `e_brands` `b` ON ((`ptb`.`BRAND_ID`=`b`.`ID`))
LEFT JOIN `e_manufactorers` `m` ON ((`b`.`MAN_ID`=`m`.`ID`))
LEFT JOIN `e_collections` `cs` ON ((`cs`.`ID`=`pcl`.`COLLECTION_ID`))
LEFT JOIN `e_product_prices` `pp` ON ((`pp`.`PRODUCT_ID`=`p`.`ID`))
WHERE `p`.`ID` IN (161) AND `pts`.`SITE_ID` LIKE 's0'
UNION
SELECT 'categories',`p`.`ID` AS `ID`
,'X','X','X','X','X','X','X','X','X','X','X','X'
,'X','X','X','X','X','X','X','X','X','X','X'
,`ptc`.`CATEGORY_ID`
,'X','X','X','X','X','X','X'
FROM `e_product_to_category` `ptc`
LEFT JOIN `e_products` `p` ON ((`p`.`ID`=`ptc`.`PRODUCT_ID`))
LEFT JOIN `e_product_categories` `pc` ON ((`pc`.`ID`=`ptc`.`CATEGORY_ID`))
LEFT JOIN `e_catalogs` `c` ON ((`c`.`ID`=`pc`.`CATALOG_ID`))
WHERE `ptc`.`PRODUCT_ID` IN (161)
AND `c`.`SITE_ID` LIKE 's0'
UNION
SELECT 'features',`p`.`ID` AS `ID`
,'X','X','X','X','X','X','X','X','X','X','X','X'
,'X','X','X','X','X','X','X','X','X','X','X'
,'X'
,FEATURE_ID
,'X','X','X','X','X','X'
FROM `e_product_catalog` `pc`
LEFT JOIN `e_products` `p` ON `p`.`ID`=`pc`.`PRODUCT_ID`
LEFT JOIN `e_product_to_category` `ptc` ON ((`ptc`.`PRODUCT_ID`=`pc`.`PRODUCT_ID`))
LEFT JOIN `e_catalogs` `c` ON ((`c`.`ID`=`ptc`.`CATEGORY_ID`))
WHERE `pc`.`PRODUCT_ID` IN (161) AND `c`.`SITE_ID` LIKE 's0'
UNION
SELECT 'rangeapp',`p`.`ID` AS `ID`
,'X','X','X','X','X','X','X','X','X','X','X','X'
,'X','X','X','X','X','X','X','X','X','X','X'
,'X','X'
,`RANGE_APP_ID`
,'X' ,'X','X','X','X'
FROM `e_product_range_app` `pra`
LEFT JOIN `e_products` `p` ON `p`.`ID`=`pra`.`PRODUCT_ID`
WHERE `PRODUCT_ID` IN (161)
UNION
SELECT 'rangepre',`p`.`ID` AS `ID`
,'X','X','X','X','X','X','X','X','X','X','X','X'
,'X','X','X','X','X','X','X','X','X','X','X'
,'X','X','X'
,`RANGE_PRE_ID`,'X','X','X','X'
FROM `e_product_range_pre` `prp`
LEFT JOIN `e_products` `p` ON `p`.`ID`=`prp`.`PRODUCT_ID`
WHERE `PRODUCT_ID` IN (161)
UNION
SELECT 'prices',`p`.`ID` AS `ID`
,'X','X','X','X','X','X','X','X','X','X','X','X'
+38.2
platformY = ballY
Непроходимая игра.
1 мячик. 2 Платформы слева и справа.
Это код перемещения платформы робота по y.
+97.4
int main()
{
...
return rand();
}
Иногда даже вылетают ошибки!
−85
Try
dt.Rows(n)("NAME") = "*****"
Catch ex As Exception
End Try
Try
dt.Rows(n)("NAME") = "*****"
Catch ex As Exception
End Try
Try
dt.Rows(n)("SURNAME") = "*****"
Catch ex As Exception
End Try
Try
dt.Rows(n)("PATRONYMIC_NAME") = "*****"
Catch ex As Exception
End Try
Вот он, structured exception handling во всей свой красе! :)