- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
$i = 1;
while ($ip = mysql_fetch_array($result))
{
$ip_end = explode(".", $ip[0]);
if ($ip_end[3] != $i && $i < 245 && $i != 100)
{
$ip_pub = "{$mask}.$i";
$i = 246;
}
$i++;
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+172
$i = 1;
while ($ip = mysql_fetch_array($result))
{
$ip_end = explode(".", $ip[0]);
if ($ip_end[3] != $i && $i < 245 && $i != 100)
{
$ip_pub = "{$mask}.$i";
$i = 246;
}
$i++;
}
Буквально на неделю отлучился, а один товарищ накрапал такую конструкцию
+167
<script>T=new Array();A=new Array();C=new Array();D=new Array();D[0]='Причастие ИСПУГАННЫЙ образовано от глагола совершенного вида ИСПУГАТЬ (ЧТО СДЕЛАТЬ?), кроме этого имеет приставку ИС- , поэтому пишется с двумя буквами Н';C[0]=2;T[0]=new Array('_н','н','нн');
D[1]='Причастие ОБРАДОВАННЫЙ образовано от глагола совершенного вида ОБРАДОВАТЬ (ЧТО СДЕЛАТЬ?), кроме этого, имеет суффикс -ОВА- , поэтому пишется с двумя буквами Н';C[1]=2;T[1]=new Array('_н','н','нн');
D[2]='Причастие ОСНОВАННОЕ имеет зависимые слова НИ НА ЧЕМ, поэтому пишется с двумя буквами Н';C[2]=2;T[2]=new Array('_н','н','нн');
D[3]='Причастие НЕПРИГЛАШЕННЫЙ образовано от глагола совершенного вида ПРИГЛАСТЬ (ЧТО СДЕЛАТЬ?), поэтому пишется с двумя буквами Н';C[3]=2;T[3]=new Array('_н','н','нн');
D[4]='Слово ВЛЮБЛЕННОЙ образовано от глагола совершенного вида ВЛЮБИТЬСЯ (ЧТО СДЕЛАТЬ?), поэтому пишется с двумя буквами Н';C[4]=2;T[4]=new Array('_н','н','нн');
D[5]='Это одно из тех слов, написание которых необходимо запомнить. В нем пишется две буквы Н. ';C[5]=2;T[5]=new Array('_н','н','нн');
// Еще очень много букв и подобных строк, написанных, по-видимому, копипастом и единой строкой (разделил построчно я для удобства чтения)
D[30]='Слово РАЗГНЕВАННУЮ образовано от глагола совершенного вида РАЗГНЕВАТЬ (ЧТО СДЕЛАТЬ?), кроме этого, имеет приставку РАЗ- , поэтому пишется с двумя буквами Н';C[30]=2;T[30]=new Array('_н','н','нн');
D[31]='Слово НЕУГНЕТЕННЫЙ имеет приставку У- , поэтому пишется с двумя буквами Н.';C[31]=2;T[31]=new Array('_н','н','нн');</script>
<div id="notearea"><p align="justify">Выберите правильные варианты ответов. Для проверки выполненного задания нажмите кнопку «Проверить».</p></div><br>
<script>if (window.opera) {var d=document.createElement('div');d.innerHTML='<p class="error">К сожалению, Ваш браузер не поддерживается. Программа работает в браузерах Internet Explorer и Mozilla Firefox.</p>';document.getElementById("notearea").appendChild(d);}</script>
Государственный портал о русском языке Грамота.ру.
Интерактивный диктант.
+148
<?php
if (!$action){
echoheader('addnews', $echo['header']);
?>
<form method="post" name="addnews" action="<?=$PHP_SELF; ?>" onsubmit="return process_form(this)">
<!-- короткая -->
<fieldset id="short"><legend><?=$echo['short']; ?></legend>
<?
echo run_filters('new-advanced-options', 'short');
?>
<textarea name="short_story" tabindex="4"></textarea>
</fieldset>
<!-- кнопки -->
<fieldset id="actions"><legend><?=$echo['actions']; ?></legend>
<input type="submit" value="<?=$echo['add']; ?>" accesskey="s">
</fieldset>
<?
}
?>
<fieldset id="date"><legend><?=$echo['date']; ?></legend>
<input type="text" name="day" size="10" maxlength="2" value="<?=date('d'); ?>" title="<?=$echo['calendar']['day']; ?>" readonly>
<input type="text" name="month" size="10" maxlength="10" value="<?=date('M'); ?>" readonly>
<input type="text" name="year" maxlength="4" value="<?=date('y'); ?>" title="<?=$echo['calendar']['year']; ?>" readonly> <input type="text" name="hour" maxlength="2" value="<?=date('H', (time() + $config_date_adjust * 60)); ?>" title="<?=$echo['calendar']['hour']; ?>" readonly>:<input type="text" name="minute" maxlength="2" value="<?=date('i', (time() + $config_date_adjust * 60)); ?>" title="<?=$echo['calendar']['minute']; ?>" readonly>:<input type="text" name="second" maxlength="2" value="<?=date('s', (time() + $config_date_adjust * 60)); ?>" title="<?=$echo['calendar']['second']; ?>" readonly>
</fieldset>
</div></fieldset>
<input type="hidden" name="mod" value="addnews">
<input type="hidden" name="action" value="doaddnews">
</form>
<?
echofooter();
// ********************************************************************************
// Do add News to DB
// ********************************************************************************
if ($action == 'doaddnews'){
if (($added_time = strtotime($day.' '.$month.' '.$year.' '.$hour.':'.$minute.':'.$second)) == -1){
$added_time = (time() + $config_date_adjust * 60);
}
if (!$title){
$title = substr($short_story, 0, 10).'...';
}
$id = $sql->last_insert_id('news', '', 'id') + 1;
run_actions('new-save-entry');
$sql->insert(array(
'table' => 'news',
'values' => array(
'date' => $added_time,
'author' => $member['username'],
'title' => replace_news('add', $title),
'short' => strlen(replace_news('add', $short_story)),
'full' => strlen(replace_news('add', $full_story)),
'avatar' => $avatar,
'category' => $category,
'url' => ($url ? my_namespace($url) : my_namespace(totranslit($title))),
'hidden' => (($config_approve_news == 'yes' and $member['level'] > 2) ? true : false)
)
));
$sql->insert(array(
'table' => 'story',
'values' => array(
'post_id' => $id,
'short' => replace_news('add', $short_story),
'full' => replace_news('add', $full_story)
)
));
run_actions('new-save-entry');
+142
string a = "Hello World!";
printf("%s", a);
+73
progress = progress != null ? progress + "%" : progress;
Да, давно я не смеялся...
+111
public static byte[] Length_Hex(long _Length)
{
byte[] Buf = { (byte)(_Length >> 0), (byte)(_Length >> 8), (byte)(_Length >> 16), (byte)(_Length >> 24) };
return Buf;
}
Кривой велик
+165
// Color and text
// -- Безупречный
if (nScore >= 90)
{
var strText = "Отличный пароль! Главное не забыть его :) ";
var strColor = "#0ca908";
}
// -- Очень хороший
else if (nScore >= 80)
{
var strText = "Очень хороший";
vstrColor = "#7ff67c";
}
// -- Хороший
else if (nScore >= 70)
{
var strText = "Хороший";
var strColor = "#1740ef";
}
// -- Давольно нормальный
else if (nScore >= 60)
{
var strText = "Достаточно неплохо";
var strColor = "#5a74e3";
}
// -- Нормальный
else if (nScore >= 50)
{
var strText = "Нормально";
var strColor = "#e3cb00";
}
// -- Слабый
else if (nScore >= 25)
{
var strText = "Слабенько";
var strColor = "#e7d61a";
}
// -- Очень плохой
else
{
var strText = "Ужас. (qwerty и то лучше :) ) ";
var strColor = "#e71a1a";
}
else if (nScore >= 25)
{
var strText = "Слабенько";
var strColor = "#e7d61a"; // -- Слабенько?WTF???????
}
Взято с блога великого кодера darkoff.ru
+166
switch(count($Args)) {
case 0:
$Result = new $ClassName; break;
case 1:
$Result = new $ClassName($Args[0]); break;
case 2:
$Result = new $ClassName($Args[0], $Args[1]); break;
case 3:
$Result = new $ClassName($Args[0], $Args[1], $Args[2]); break;
case 4:
$Result = new $ClassName($Args[0], $Args[1], $Args[2], $Args[3]); break;
case 5:
$Result = new $ClassName($Args[0], $Args[1], $Args[2], $Args[3], $Args[4]); break;
case 6:
$Result = new $ClassName($Args[0], $Args[1], $Args[2], $Args[3], $Args[4], $Args[5]); break;
case 7:
$Result = new $ClassName($Args[0], $Args[1], $Args[2], $Args[3], $Args[4], $Args[5], $Args[6]); break;
case 8:
$Result = new $ClassName($Args[0], $Args[1], $Args[2], $Args[3], $Args[4], $Args[5], $Args[6], $Args[7]); break;
default:
throw new Exception();
}
Взято из форума Vanilla 2...
И еще в одном файле подобное library/core/class.dispatcher.php (со строки 267).
+139
inline Gdiplus::Color colorrefToGdiColor(COLORREF col, char alpha)
{
return (static_cast<unsigned long>(static_cast<unsigned char>((col & Gdiplus::Color::RedMask) >> Gdiplus::Color::RedShift)) << Gdiplus::Color::BlueShift) | (static_cast<unsigned long>(static_cast<unsigned char>((col & Gdiplus::Color::GreenMask) >> Gdiplus::Color::GreenShift)) << Gdiplus::Color::GreenShift) | (static_cast<unsigned long>(static_cast<unsigned char>((col & Gdiplus::Color::BlueMask) >> Gdiplus::Color::BlueShift)) << Gdiplus::Color::RedShift) | (static_cast<unsigned long>(alpha) << Gdiplus::Color::AlphaShift);
}
Тихо себя ненавижу. Слава Б-г'у это всё выкидывается.
+176
function NDS($poisk)
{
preg_match('#БЕЗ НДС#', $poisk, $matches);
if(empty($matches[0]))
{
preg_match('#без НДС#', $poisk, $matches);
if(empty($matches[0]))
{
preg_match('#НДС НЕТ#', $poisk, $matches);
if(empty($matches[0]))
{
preg_match('#НДС нет#', $poisk, $matches);
if(empty($matches[0]))
{
preg_match('#НДС не облагается#', $poisk, $matches);
if(empty($matches[0]))
{
preg_match('#НДС НЕ ОБЛАГАЕТСЯ#', $poisk, $matches);
if(empty($matches[0]))
{
preg_match('#НДС НЕ ПРЕДУСМОТРЕН#', $poisk, $matches);
if(empty($matches[0]))
{
preg_match('#Без налога (НДС)#', $poisk, $matches);
if(empty($matches[0]))
{
preg_match('#НДС: БЕЗ НАЛОГА#', $poisk, $matches);
if(empty($matches[0]))
{
preg_match('#Без НДС#', $poisk, $matches);
if(empty($matches[0]))
{
preg_match('#без налога (НДС)#', $poisk, $matches);
if(empty($matches[0]))
{}
else return true;
}
else return true;
}
else return true;
}
else return true;
}
else return true;
}
else return true;
}
else return true;
}
else return true;
}
else return true;
}
else return true;
}
else return true;
}
Обнаружено в старом проекте заказчика