- 1
<p><img src="./?<?php echo name()?>=<?php echo id()?>"></p>
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+142.7
<p><img src="./?<?php echo name()?>=<?php echo id()?>"></p>
+138.5
if (($rtw['noavt']==1) OR ($rtw['noavt']==1)) {$rtw['noavt']=0;}
+142.3
$my_cgi = $_SERVER['REQUEST_METHOD'] == 'GET' ? $_GET : $_POST;
$fnumber = "";
$fname="";
$fjunction = "";
$fstreet = "";
$fintersectingstreet = "";
$flocality = "";
$fadministrative = "";
$fpostalcode = "";
$fsettlement = "";
$flatitude = 0.0;
$flongitude = 0.0;
$fcoordtype = "";
$ffreetext = "";
$fuid = "";
$fsettlement = "";
$tnumber = "";
$tname="";
$tjunction = "";
$tstreet = "";
$tintersectingstreet = "";
$tstreet = "";
$tlocality = "";
$tadministrative = "";
$tpostalcode = "";
$tsettlement = "";
$tlatitude = 0.0;
$tlongitude = 0.0;
$tcoordtype = "";
$tfreetext = "";
$tuid = "";
$method = "";
$passenger = "";
$return = "";
$trainf = "";
$traind = "";
$flocate = "";
$tlocate = "";
/*****************************************************************************
* Decode URL
****************************************************************************/
while (list($my_key, $my_value) = each($my_cgi)) {
if($my_key == "fname") {
$fname = $my_value;
} else if ($my_key == "fnumber" ) {
$fnumber = $my_value;
} else if($my_key == "fstreet") {
$fstreet = $my_value;
} else if($my_key == "fintersectingstreet") {
$fintersectingstreet = $my_value;
} else if($my_key == "flocality") {
$flocality = $my_value;
} else if($my_key == "fadministrative") {
$fadministrative = $my_value;
} else if ($my_key == "fpostalcode") {
if ($my_key["fpostalcode"] != "") {
$fpostalcode = $my_value;
}
} else if ($my_key == "fsettlement" ) {
$fsettlement = $my_value;
} else if ($my_key == "flatitude" ) {
$flatitude = $my_value;
} else if ($my_key == "flongitude" ) {
$flongitude = $my_value;
} else if ($my_key == "fcoordtype" ) {
$fcoordtype = $my_value;
} else if ($my_key == "fmatch_uid" ) {
$fuid = $my_value;
} else if ($my_key == "ffreetext" ) {
$ffreetext = $my_value;
} else if($my_key == "tname") {
$tname = $my_value;
} else if ($my_key == "tnumber" ) {
$tnumber = $my_value;
} else if($my_key == "tstreet") {
$tstreet = $my_value;
} else if($my_key == "tintersectingstreet") {
$tintersectingstreet = $my_value;
} else if($my_key == "tlocality") {
$tlocality = $my_value;
} else if($my_key == "tadministrative") {
$tadministrative = $my_value;
} else if ($my_key == "tpostalcode") {
if ($my_key["tpostalcode"] != "") {
$tpostalcode = $my_value;
}
} else if ($my_key == "tsettlement" ) {
$tsettlement = $my_value;
} else if ($my_key == "tnumber" ) {
$tnumber = $my_value;
} else if ($my_key == "tlatitude" ) {
$tlatitude = $my_value;
} else if ($my_key == "tlongitude" ) {
$tlongitude = $my_value;
} else if ($my_key == "tcoordtype" ) {
$tcoordtype = $my_value;
} else if ($my_key == "tmatch_uid" ) {
$tuid = $my_value;
+66.8
switch ($iType) {
case 0:
$iType = 0;
/* code */
break;
case 1:
$iType = 1;
/* code */
break;
}
Так как весь switch тянется на 1000 строк то приважу краткий вид.
+153
$this->template_vars['product_description'] = nl2br(str_replace('{price}', (($this->template_vars['product_old_price']) ? '<span class="old_price">$'.$this->template_vars['product_old_price'].'</span> ' : '').'$'.$this->template_vars['product_price'], $this->template_vars['product_description'])) . $fabric;
Это не столько говнокод, сколько пример непреднамеренной обфускации.
+143.3
if (PEAR::isError($iNameID)) if (PEAR::isError($iNameID))
{ {
trigger_error($iNameID->getMessage()); trigger_error($iNameID->getMessage());
} }
+141.5
/*
Паттерн для вывода данных в таблицу :)
*/
echo "<table>\n";
while ($line = mysql_fetch_row($result)) {
echo "\t<tr>\n";
do {
echo "\t\t<td>each( $val)</td>\n";
} while(end($val) != current($val));
echo "\t</tr>\n";
}
echo "</table>\n";
+132.3
if(!isset($_GET['p'])) $_GET['p'] = '';
else{
if (strrchr($_GET['p'],"/") <> "/") {
}else{ $_GET['p'] =substr($_GET['p'],0, strlen($_GET['p'])-1); }
}
+146
++$i--;
операция "передёргивания"
+61.1
function extCreateObject( $name, $p ) {
$p = array_values( $p );
switch ( count( $p ) ) {
case 0:
return new $name;
case 1:
return new $name( $p[0] );
case 2:
return new $name( $p[0], $p[1] );
case 3:
return new $name( $p[0], $p[1], $p[2] );
case 4:
return new $name( $p[0], $p[1], $p[2], $p[3] );
case 5:
return new $name( $p[0], $p[1], $p[2], $p[3], $p[4] );
case 6:
return new $name( $p[0], $p[1], $p[2], $p[3], $p[4], $p[5] );
default:
wfDebugDieBacktrace( "Too many arguments to constructor in extCreateObject" );
}
}
mediawiki.org )