- 1
- 2
- 3
- 4
- 5
- 6
$comments = (isset($_POST['lici-'.$login->id.'-comments']))?"yes":"no";
if($comments === "yes")
{
$xml .= "<nocomment>1</nocomment>\r\n";
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+162.3
$comments = (isset($_POST['lici-'.$login->id.'-comments']))?"yes":"no";
if($comments === "yes")
{
$xml .= "<nocomment>1</nocomment>\r\n";
}
Код из плагина кросспостера для wordpress.
Автор, видимо, не знает про булев тип. Все бы было хорошо, если бы плагин не закрывал комментарии, когда их нужно было открывать.
+63.4
/* This construction seems to be more optimiser friendly.
(without it gcc does the isDIGIT test and the *s - '0' separately)
With it gcc on arm is managing 6 instructions (6 cycles) per digit.
In theory the optimiser could deduce how far to unroll the loop
before checking for overflow. */
if (++s < send) {
int digit = *s - '0';
if (digit >= 0 && digit <= 9) {
value = value * 10 + digit;
if (++s < send) {
digit = *s - '0';
if (digit >= 0 && digit <= 9) {
value = value * 10 + digit;
if (++s < send) {
digit = *s - '0';
if (digit >= 0 && digit <= 9) {
value = value * 10 + digit;
if (++s < send) {
digit = *s - '0';
if (digit >= 0 && digit <= 9) {
value = value * 10 + digit;
if (++s < send) {
digit = *s - '0';
if (digit >= 0 && digit <= 9) {
value = value * 10 + digit;
if (++s < send) {
digit = *s - '0';
if (digit >= 0 && digit <= 9) {
value = value * 10 + digit;
if (++s < send) {
digit = *s - '0';
if (digit >= 0 && digit <= 9) {
value = value * 10 + digit;
if (++s < send) {
digit = *s - '0';
if (digit >= 0 && digit <= 9) {
value = value * 10 + digit;
if (++s < send) {
/* Now got 9 digits, so need to check
each time for overflow. */
digit = *s - '0';
while (digit >= 0 && digit <= 9
&& (value < max_div_10
|| (value == max_div_10
&& digit <= max_mod_10))) {
value = value * 10 + digit;
if (++s < send)
digit = *s - '0';
else
break;
}
if (digit >= 0 && digit <= 9
&& (s < send)) {
/* value overflowed.
skip the remaining digits, don't
worry about setting *valuep. */
do {
s++;
} while (s < send && isDIGIT(*s));
numtype |=
IS_NUMBER_GREATER_THAN_UV_MAX;
goto skip_value;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
Проверка числа в Perl-модуле. Судя по всему стояла задача оптимизировать под что-то.
+92
{$R-}
fal:=true;
ty:= length(mas1);
while(fal=true) do
for j:=0 to kp-1 do
begin
for i:=i+k+j to length(mas2)-1 do
begin
while mas2[i+k]= ty do
begin
s:=s+c[i,j];
inc(k);
end;
end;
nl:=mas1[ty-1];
if nl=0 then
mas_Mj[ty]:=0
else
mas_Mj[ty-1][j]:=s/nl;
s:=0;
end;
+168.1
function check($pass)
{ if (strpos($pass,'0') || strpos($pass,'1')
|| strpos($pass,'2') || strpos($pass,'3')
|| strpos($pass,'4') || strpos($pass,'5')
|| strpos($pass,'6') || strpos($pass,'7')
|| strpos($pass,'8') || strpos($pass,'9'))
{
if (strpos($pass,'a') || strpos($pass,'b') || strpos($pass,'c')
|| strpos($pass,'d') || strpos($pass,'e') || strpos($pass,'f')
|| strpos($pass,'g') || strpos($pass,'h') || strpos($pass,'i')
|| strpos($pass,'j') || strpos($pass,'k') || strpos($pass,'l')
|| strpos($pass,'m') || strpos($pass,'n') || strpos($pass,'o')
|| strpos($pass,'p') || strpos($pass,'q') || strpos($pass,'r')
|| strpos($pass,'s') || strpos($pass,'t') || strpos($pass,'u')
|| strpos($pass,'v') || strpos($pass,'w') || strpos($pass,'x')
|| strpos($pass,'y') || strpos($pass,'z'))
{
if (strpos($pass,'A') || strpos($pass,'B') || strpos($pass,'C')
|| strpos($pass,'D') || strpos($pass,'E') || strpos($pass,'F')
|| strpos($pass,'G') || strpos($pass,'H') || strpos($pass,'I')
|| strpos($pass,'J') || strpos($pass,'K') || strpos($pass,'K')
|| strpos($pass,'M') || strpos($pass,'N') || strpos($pass,'O')
|| strpos($pass,'P') || strpos($pass,'Q') || strpos($pass,'R')
|| strpos($pass,'S') || strpos($pass,'T') || strpos($pass,'U')
|| strpos($pass,'V') || strpos($pass,'W') || strpos($pass,'X')
|| strpos($pass,'Y') || strpos($pass,'Z'))
{ if (ctype_lower(substr($pass,0,1)) || ctype_upper(substr($pass,0,1)) || is_numeric(substr($pass,0,1)))
{ if (ctype_lower(substr($pass,0,1)))
{ if (!ctype_lower(substr($pass,-1)))
{ return $pass; } }
if (ctype_upper(substr($pass,0,1)))
{
if (!ctype_upper(substr($pass,-1)))
{
return $pass;
}
}
if (is_numeric(substr($pass,0,1)))
{
if (!is_numeric(substr($pass,-1)))
{
return $pass;
}
} }
}
}
} }
без коментариев. (из одного вап чата)
+122.4
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<!--
POSTER PHOTO
-->
<div id="poster-photo-container">
<img src="images/photo-poster.jpg" alt="" class="poster-photo-image" />
<div id="feature-area-home">
<div id="login" class="boxed">
<h2 class="title">Аккаунт пользователя</h2>
<div class="content">
<fieldset>
<legend>Войти</legend>
<label for="inputtext1">Аккаунт :</label>
<input id="inputtext1" type="text" name="inputtext1" value="" />
<label for="inputtext2">Пароль :</label>
<input id="inputtext2" type="password" name="inputtext2" value="" />
<asp:Button ID="Button1" runat="server" Text="Войти" onclick="Button1_Click" />
<p><a href="#">Забыли пароль ?</p>
</a>
</fieldset>
</div>
</div>
</div>
</div>
<!--
CONTENT CONTAINER
-->
<div id="content-container-two-column">
<!--
CONTENT MAIN COLUMN
-->
<div id="content-main-two-column">
<h1>
<span lang="ru">Контроль измерительных приборов.</span> </h1>
<p>
Consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet
dolore magna aliquam erat volutpat.</p>
<div id="three-column-container">
<div id="three-column-side1">
<a href="Items.aspx">
<img src="images/home-photo-1.jpg" class="photo-border" alt="Enter Alt Text Here" /></a>
<h2>
<span lang="ru">Хромотографы ?</span></h2>
<p>
<span lang="ru">11111111</span></p>
<span lang="ru">
<a href="Items.aspx">Подробнее</a></span><img class="arrow" src="images/arrow.gif" alt="" /></div>
</div>
</div>
<!--
CONTENT SIDE COLUMN
-->
<div class="clear">
</div>
</div>
</asp:Content>
Найти DIV
+103
MessageBox.Show(
a.Decode(
new StringBuilder(
a.Encode(
new StringBuilder(
textBox1.Text)).ToString())).ToString());
Говнокод... ну почти говнокод. Думаю, замечание.
−106.6
# ВЫШЕ БУДЕТ МАСИВ С 1 до 7 за семь дней дабы делать выборку
for ($indx=0; $indx<7; $indx++) { ## каждый раз работаем с датой
@sql=();
my $bindings = 0;
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time+$indx*86400); # а тут надо будет написать что умножить эл. масива на чтото
$date=($year+1900).'-'.($mon<9?'0':'').($mon+1).'-'.($mday<10?'0':'').$mday;
$url2=$url.$date;
#####$url2=$url;
$cinema=&get($url2);
...
} # это скобка массива
Вот такой фрагмент парсера. Комменты читать по 3-4 раза для полного впечатления
+163.4
$file_dump->isOpened()?$file_dump->close():die ($file_dump->open());
−876
INSERT INTO `x_world` VALUES (157282,-115,204,1,206320,'Жопа Волосатая',68797,'Чере',3277,'WarSky',595);
Омг!
Код взят с http://www.google.com/codesearch/p?hl=ru#Vh-Pv7tO-E0/map.sql&q=%D0%B6%D0%BE%D0%BF%D0%B0&sa=N& cd=8&ct=rc
+155.3
$dir = $_SERVER['DOCUMENT_ROOT'].'/upload/'.$_GET['ID'].'/';
$urlz = array();
if ($dh = opendir($dir))
{
clearstatcache();
while (($file = readdir($dh)) !== false)
if (strlen($file)>3 && substr($file, -4)!='.flv')
{
$FILE_PATH = $_SERVER['DOCUMENT_ROOT'].'/upload/'.$_GET['ID'].'/'.$file;
$TIME = filemtime($FILE_PATH);
while (array_key_exists($TIME,$urlz))
$TIME++;
if (filesize($FILE_PATH)>0)
$urlz[$TIME] = $file;
}
closedir($dh);
krsort($urlz);
}
$i = 0;
foreach ($urlz as $k=>$v)
if ($i>2)
unset($urlz[$k]);
else
{
$i++;
$urlz[$k] = 'http://www.'.$_SERVER['HTTP_HOST'].'/upload/'.$_GET['ID'].'/'.$v;
}