- 1
#define true false
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+139
#define true false
попробуй найди ошибку :)
+151
private function GetUnitType($unitType)
{
if($unitType)
if(!UnitType::Exist($unitType))
{
Debug::error("WebPartCommentsList:: UnitType не найден");
exit;
}
else
$this->UnitType = UnitType::GetUnitTypeId($this->UnitType);
}
проверка на существование сущности внутри класса, причём реально $unitType == $this->UnitType
писал ...
+160.5
//...
$br="
";
//...
+148.5
function rgb_to_htmlcolor($rgb) {
$red = $rgb['red'];
$green = $rgb['green'];
$blue = $rgb['blue'];
$red = 0x10000 * max(0,min(255,$red+0));
$green = 0x100 * max(0,min(255,$green+0));
$blue = max(0,min(255,$blue+0));
// convert the combined value to hex and zero-fill to 6 digits
return "#".str_pad(strtoupper(dechex($red + $green + $blue)),6,"0",STR_PAD_LEFT);
}
Преобразование RGB в #RRGGBB
Чувак не ведает что есть sprintf('#%02X%02X%02X')
+151
// Защита от вставки HTML-кодов
function filter($string)
{
$string=stripslashes($string);
$string=ereg_replace("<","<",$string);
$string=ereg_replace(">",">",$string);
$string=ereg_replace('\\\"',""",$string);
$string=ereg_replace("!","!",$string);
$string=ereg_replace("\r","",$string);
$string=ereg_replace("\n","<BR>",$string);
$string=ereg_replace("%","%",$string);
$string=ereg_replace("^ +","",$string);
$string=ereg_replace(" +$","",$string);
$string=ereg_replace(" +"," ",$string);
$string=ereg_replace("\|"," ",$string);
return $string;
}
Из LS Guestbook (http://linesoft.org)
+38.2
platformY = ballY
Непроходимая игра.
1 мячик. 2 Платформы слева и справа.
Это код перемещения платформы робота по y.
+148
# /etc/fstab: static file system information.
#
# Use 'vol_id --uuid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
# / was on /dev/sda1 during installation
UUID=12179970-74dc-4673-a865-cf8af384eb4b / ext4 relatime,errors=remount-ro 0 1
# swap was on /dev/sda6 during installation
UUID=059ff3fe-4866-4f54-b796-54d4a265f660 none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
fstab
+158.1
for( $i = 0 ; $i < strlen( $field_amount ); $i++ ) {
$letter = substr( $field_amount, $i, 1 );
if ( $letter == '0' || $letter == '1' || $letter == '2' || $letter == '3' || $letter == '4' || $letter == '5' || $letter == '6' || $letter == '7' || $letter == '8' || $letter == '9' ) {
$amount .= $letter;
}
}
$field_amount = $amount;
Разбирая сорцы биллинговой системы...
+63.9
Procedure CalcStep;
var key : char;
{Calculates the direction}
begin
if keypressed then
begin
key:=readkey;
if key in [#77,#75,#80,#72,#27] then
begin SnakeDr:=key; CalcStep; end;
end
else
case SnakeDr of
#72 : if snake[1].y=1 then snake[1].y:=23 else dec(snake[1].y);
#80 : if snake[1].y=23 then snake[1].y:=1 else inc(snake[1].y);
#75 : if snake[1].x=1 then snake[1].x:=78 else dec(snake[1].x);
#77 : if snake[1].x=78 then snake[1].x:=1 else inc(snake[1].x);
end;
end;
Нашел тут собственное творчество. Судя по всему писал в нетрезвом состоянии, ибо сейчас с трудом понимаю, зачем здесь такая рекурсия? О_о
+159.6
<?php
//////////////////////////////////////////////////////////////////////////////////////////
/////
///// ********* MINI-CHAT *********
/////
///// Made by : VANTUZ
///// E-mail : [email protected]
///// Site : http://pizdec.ru
///// WAP-Site : http://wapstop.ru
///// WAP-Site : http://visavi.net
///// WAP-Site : http://banzaj.net
///// ICQ : 36-44-66
/////
//////////////////////////////////////////////////////////////////////////////////////////////
// ВЫ НЕ ИМЕЕТЕ ПРАВО ВНОСИТ ИЗМЕНЕНИЯ В КОД СКРИПТА ДЛЯ ДАЛЬНЕЙШЕГО РАСПРОСТРАНЕНИЯ //
//////////////////////////////////////////////////////////////////////////////////////////////
Error_Reporting(E_ALL & ~E_NOTICE);
Error_Reporting (ERROR | WARNING);
function myErrorHandler ($errno, $errstr, $errfile, $errline) {}
set_error_handler("myErrorHandler");
extract($HTTP_GET_VARS);
extract($HTTP_POST_VARS);
extract($HTTP_COOKIE_VARS);
extract($HTTP_SERVER_VARS);
extract($HTTP_SESSION_VARS);
require"config.php";
//////////////////////////////////////////////////////////////////////////////////////
function avto($s) { $rand = rand(0,999); global $rew;
$s = str_replace("<title>","<meta http-equiv=\"refresh\" content=\"$rew;URL=index.php?rand=$rand\"/><title>",$s); //автообовление 60 сек
return $s; }
ob_start("avto");
require"top.php";
$rand = rand(0,999);
$lines=file("chat.dat");
$i=count($lines);
if (isset($antiflood))
{ echo "<div align=\"center\"><b><font color=\"#FF0000\">Antiflood<br/>Свои мысли нужно формулировать чётче. Не части! Отправь следующее сообщение через $floodstime секунд!</font></b><br/><br/></div>"; }
if (isset($addon))
{ echo "<div align=\"center\"><b><font color=\"#FF0000\">Сообщение успешно добавлено!</font></b><br/><br/></div>"; }
echo"<br/><a href=\"say.php\">Сказать</a> | <a href=\"index.php?rand=$rand\">Обновить</a><hr/>";
// выводим данные по возрастанию или убыванию
$a1=$i-1; $u="-1";
do {$dt=explode("|", $lines[$a1]);
$a1--;
$dt[0]=eregi_replace("((https?|ftp)://[[:alnum:]_=/-]+(\\.[[:alnum:]_=/-]+)*(/[[:alnum:]+&._=/%]*(\\?[[:alnum:]?+&_=/%]*)?)?)", "<a href='\\1' title='\\1'>\\1</a>", $dt[0]);
$dt[6]=str_replace("\r\n", "", $dt[6]);
$dt[2]=str_replace("$dt[2]", "Е-mail: $dt[2] <br/>", $dt[2]);
if(!empty($dt[1])){
echo"</div><div class=b><img src=\"edit.gif\" alt=\"\"/>
<b><a href=\"say.php?imja=$dt[1]\">$dt[1]</a></b><small> ($dt[3] $dt[4])</small></div><div>Сообщение: $dt[0]<br/>$dt[2]<font color=\"#CC00CC\">($dt[5], $dt[6])</font><br/>";} else { echo"<br/>Сообщений нет, будь первым!<br/>";}
$a11=$u; $u11=$a1;
} while($a11 < $u11);
echo"<hr/><a href=\"say.php\">Сказать</a> | <a href=\"index.php?rand=$rand\">Обновить</a> ";
echo"</div><div class=c>";
echo"<a href=\"$home\">$copy</a><br/>";
echo"</div></body></html>";
?>
Индусы атакуют 2!