- 1
if(!$_POST && !isset($_POST['gender'])) ...
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
Этот поиск практически ничего не может найти! Но вы всё-таки попытайтесь, вдруг повезет.
Найдено: 210
+153.9
if(!$_POST && !isset($_POST['gender'])) ...
В одном проекте социальной сети, доставшемся от поляков, которым тот достался от индусов
+118.6
boolean b;
// ....
switch (b)
{
case true: // ....
case false: // .....
default: // (!) тут был код, и он отличался от предыдущих двух пунктов!
}
автор кода - какой-то индус. это не копипаст, но смысл передан верно
+144.5
while (true.ToString().Length < 5)
{
}
индусы рулят!!!
+143
Индус находится вне границ массива
Начитался про индусов, и вот результат. Тепреь правильно эскепшн читать не могу.
+147
<?php
$str = "";
exec('whoami', $str);
print_r($str);
?>
Ставили одному индусу кастом билды тикет и црм систем. Собрали пакетики, отдали. Индус пожаловался на предмет "ничего не работает". Смотрю на его вмварю - сервер явный даун. Спрашиваю под каким юзером стартует апач. Чувак открывает консоль, создает файл '/var/www/htdocs/test.php' и пишет этот шедевр
+158.9
if ($category) {$zapros="where category='$category'"; $f[1]=1;}
if ($group) {
//тут $row получает этот индус...
if ($f[1]==1) {$zapros.=" and idu='$row[0]'";}
else {$zapros="where idu='$row[0]'";}
$f[2]=1;
}
if ($type) {
if (($f[1]==1)||($f[2]==1)) {$zapros.=" and type='$type'";}
else {$zapros="where type='$type'";}
$f[3]=1;
}
if ($format) {
if (($f[1]==1)||($f[2]==1)||($f[3]==1)) {$zapros.=" and format='$format'";}
else {$zapros="where format='$format'";}
$f[4]=1;
}
if ($curlang) {
if (($f[1]==1)||($f[2]==1)||($f[3]==1)||($f[4]==1)) {$zapros.=" and (lang='$curlang' or lang='all')";}
else {$zapros="where (lang='$curlang' or lang='all')";}
$f[5]=1;
}
Охеренный способ составления запроса
+108.6
void init()
{
int i;
for(i=0;i<4;i++)
ALG_RxConst[i] = -1;
for(i=0;i<4;i++)
ALG_TxConst[i] = -1;
for(i=0;i<4;i++)
ALG_EqInfo[i][0] = 0;
for(i=0;i<4;i++)
ALG_EqInfo[i][1] = -1;
for(i=0;i<4;i++)
ALG_EqInfo[i][2] = -1;
}
Индусу очень-очень нравится for ;)
−14
uint i;
…
if (i.ToString().Length == 1)
{
...
}
Не сразу можно понять, что в этом коде просто-напросто выполняется проверка i < 10. Алгоритм достаточно прост: выполняется преобразование i в строку, после чего вычисляется ее длина. Если число больше 9, то его десятичная запись содержит больше одного символа. Отрицательные числа переменная типа uint содержать не может. Проверку проходят лишь числа от 0 до 9.
Алгоритм ресурсоемок, неочевиден и не поддается сопровождению даже теоретически.
взято с lurkmore.ru, там вообще много про "индусский код"
+33.6
<?
function ShowImage($strImage, $iMaxW=0, $iMaxH=0, $sParams=null, $strImageUrl="", $bPopup=false, $sPopupTitle=false, $iSizeWHTTP=0, $iSizeHHTTP=0)
{
global $DOCUMENT_ROOT, $DB;
if(!($arImgParams = CFile::_GetImgParams($strImage, $iSizeWHTTP, $iSizeHHTTP)))
return "";
if($sParams === null || $sParams === false)
$sParams = ' border="0" ';
$iMaxW = intval($iMaxW);
$iMaxH = intval($iMaxH);
$strImage = htmlspecialchars($arImgParams["SRC"]);
$intWidth = $arImgParams["WIDTH"];
$intHeight = $arImgParams["HEIGHT"];
$strAlt = $arImgParams["ALT"];
if($sPopupTitle===false)
$sPopupTitle=GetMessage("FILE_ENLARGE");
$file_type = GetFileType($strImage);
switch($file_type):
case "FLASH":
$iWidth = $intWidth;
$iHeight = $intHeight;
if($iMaxW>0 && $iMaxH>0 && ($intWidth > $iMaxW || $intHeight > $iMaxH))
{
$coeff = ($intWidth/$iMaxW > $intHeight/$iMaxH? $intWidth/$iMaxW : $intHeight/$iMaxH);
$iWidth = intval(roundEx($intHeight/$coeff));
$iHeight = intval(roundEx($intWidth/$coeff));
}
$strReturn = '
<object
classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
id="banner"
WIDTH="'.$iWidth.'"
HEIGHT="'.$iHeight.'"
ALIGN="">
<PARAM NAME="movie" VALUE="'.$strImage.'" />
<PARAM NAME="quality" VALUE="high" />
<PARAM NAME="bgcolor" VALUE="#FFFFFF" />
<embed
src="'.$strImage.'"
quality="high"
bgcolor="#FFFFFF"
WIDTH="'.$iWidth.'"
HEIGHT="'.$iHeight.'"
NAME="banner"
ALIGN=""
TYPE="application/x-shockwave-flash"
PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">
</embed>
</object>
';
return $bPopup? $strReturn : print_url($strImageUrl, $strReturn);
default:
$strReturn = "<img src=\"".$strImage."\" ".$sParams." width=\"".$intWidth."\" height=\"".$intHeight."\" alt=\"".htmlspecialchars($strAlt)."\" />";
if($iMaxW > 0 && $iMaxH > 0) //need to check scale, maybe show actual size in the popup window
{
//check for max dimensions exceeding
if($intWidth > $iMaxW || $intHeight > $iMaxH)
{
$coeff = ($intWidth/$iMaxW > $intHeight/$iMaxH? $intWidth/$iMaxW : $intHeight/$iMaxH);
$strReturn = "<img src=\"".$strImage."\" ".$sParams." width=\"".intval(roundEx($intWidth/$coeff))."\" height=\"".intval(roundEx($intHeight/$coeff))."\" alt=\"".htmlspecialchars($strAlt)."\" />";
if($bPopup) //show in JS window
{
if(strlen($strImageUrl)>0)
{
$strReturn =
'<a href="'.$strImageUrl.'" title="'.$sPopupTitle.'" target="_blank">'.
'<img src="'.$strImage.'" '.$sParams.' width="'.intval(roundEx($intWidth/$coeff)).'" height="'.intval(roundEx($intHeight/$coeff)).' alt="'.htmlspecialchars($sPopupTitle).'" />'.
'</a>';
}
else
{
CFile::OutputJSImgShw();
$strReturn =
"<a title=\"".$sPopupTitle."\" onClick=\"ImgShw('".AddSlashes($strImage)."','".$intWidth."','".$intHeight."', '".AddSlashes(htmlspecialcharsex(htmlspecialcharsex($strAlt)))."'); return false;\" href=\"".$strImage."\" target=\"_blank\">".
"<img src=\"".$strImage."\" ".$sParams." width=\"".intval(roundEx($intWidth/$coeff))."\" height=\"".intval(roundEx($intHeight/$coeff))."\" /></a>";
}
}
}
}
return $bPopup? $strReturn : print_url($strImageUrl, $strReturn);
endswitch;
return $bPopup? $strReturn : print_url($strImageUrl, $strReturn);
}
?>
Уникальный фрагмент кода из CMS Bitrix 7.x.
Судя по всему его писал индус который не проверял его работы.
Некотором будет непонятен тонкий юмор автора этого кода, но когда пытаешься решить с его помощью конкретную задачу становится совсем не смешно а наоборот обидно, за себя и толпы тысяч людей полагающих что Bitrix решение всех его проблем логика работы в котором напрочь отсутствует так же как и здравый смысл.
Сделаю небольшой намёк. Весь фокус во взаимной зависимости параметров
$iMaxW=0, $iMaxH=0, $strImageUrl="", $bPopup=false
+23.7
function _validateDelete($d) {
$valid = true;
if (!$d["product_id"]) {
$this->setError(dgettext("Core", "Product not selected."));
return false;
}
if (!$d["product_id"]) {
$this->setError(dgettext("Core", "Please select a record to delete."));
$valid = false;
}
return $valid;
}
Индусокод классический