- 1
- 2
- 3
- 4
while (1<2) {
document.body.innerHTML = document.body.innerHTML.replace('[offtop]', '<font color=red>')
document.body.innerHTML = document.body.innerHTML.replace('[/offtop]', '</font>')
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+162.7
while (1<2) {
document.body.innerHTML = document.body.innerHTML.replace('[offtop]', '<font color=red>')
document.body.innerHTML = document.body.innerHTML.replace('[/offtop]', '</font>')
}
bb-коды на индусском сайте, ver. 2
+148.7
public function executeLogin(sfWebRequest $request)
{
if ($request->isMethod('post'))
{
if (SessionPeer::auth($request->getPostParameter('email'), $request->getPostParameter('password')))
{
return $this->redirect($this->getRequest()->getUri());
}
$this->getUser()->setFlash('error.login', true);
return;
}
}
Полезно иногда открывать недавно написанное и так бегло просматривать на предмет нелепостей. В данном случае улыбнул последний return;
+175.2
$arr = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
$result = $mysql->query("SELECT `upload` FROM `images` WHERE `upload` > '".(time()-60*60*24)."' AND `deleted` = '0' ORDER BY `upload` ASC");
while($row = mysql_fetch_array($result))
{
switch($row['upload'])
{
case (($row['upload'] > (time()-60*60*24)) && ((time()-60*60*23) > $row['upload'])):
$arr['23']++;
break;
case (($row['upload'] > (time()-60*60*23)) && ((time()-60*60*22) > $row['upload'])):
$arr['22']++;
break;
case (($row['upload'] > (time()-60*60*22)) && ((time()-60*60*21) > $row['upload'])):
$arr['21']++;
break;
case (($row['upload'] > (time()-60*60*21)) && ((time()-60*60*20) > $row['upload'])):
$arr['20']++;
break;
case (($row['upload'] > (time()-60*60*20)) && ((time()-60*60*19) > $row['upload'])):
$arr['19']++;
break;
case (($row['upload'] > (time()-60*60*19)) && ((time()-60*60*18) > $row['upload'])):
$arr['18']++;
break;
case (($row['upload'] > (time()-60*60*18)) && ((time()-60*60*17) > $row['upload'])):
$arr['17']++;
break;
case (($row['upload'] > (time()-60*60*17)) && ((time()-60*60*16) > $row['upload'])):
$arr['16']++;
break;
case (($row['upload'] > (time()-60*60*16)) && ((time()-60*60*15) > $row['upload'])):
$arr['15']++;
break;
case (($row['upload'] > (time()-60*60*15)) && ((time()-60*60*14) > $row['upload'])):
$arr['14']++;
break;
case (($row['upload'] > (time()-60*60*14)) && ((time()-60*60*13) > $row['upload'])):
$arr['13']++;
break;
case (($row['upload'] > (time()-60*60*13)) && ((time()-60*60*12) > $row['upload'])):
$arr['12']++;
break;
case (($row['upload'] > (time()-60*60*12)) && ((time()-60*60*11) > $row['upload'])):
$arr['11']++;
break;
case (($row['upload'] > (time()-60*60*11)) && ((time()-60*60*10) > $row['upload'])):
$arr['10']++;
break;
case (($row['upload'] > (time()-60*60*10)) && ((time()-60*60*9) > $row['upload'])):
$arr['9']++;
break;
case (($row['upload'] > (time()-60*60*9)) && ((time()-60*60*8) > $row['upload'])):
$arr['8']++;
break;
case (($row['upload'] > (time()-60*60*8)) && ((time()-60*60*7) > $row['upload'])):
$arr['7']++;
break;
case (($row['upload'] > (time()-60*60*7)) && ((time()-60*60*6) > $row['upload'])):
$arr['6']++;
break;
case (($row['upload'] > (time()-60*60*6)) && ((time()-60*60*5) > $row['upload'])):
$arr['5']++;
break;
case (($row['upload'] > (time()-60*60*5)) && ((time()-60*60*4) > $row['upload'])):
$arr['4']++;
break;
case (($row['upload'] > (time()-60*60*4)) && ((time()-60*60*3) > $row['upload'])):
$arr['3']++;
break;
case (($row['upload'] > (time()-60*60*3)) && ((time()-60*60*2) > $row['upload'])):
$arr['2']++;
break;
case (($row['upload'] > (time()-60*60*2)) && ((time()-60*60*1) > $row['upload'])):
$arr['1']++;
break;
case ($row['upload'] > (time()-60*60*1)):
$arr['0']++;
break;
}
}
график :)
+149.8
<? error_reporting(E_ALL);
session_start();
if (isset($_SESSION['user_id']))
{}else{ die('Доступ закрыт, даём ссылку на авторизацию. — <a href="index.php">Авторизоваться</a>');}
include("../blocks/bd.php");
$result = mysql_query ("SELECT title, meta_d, meta_k, text FROM settings WHERE page='index'",$db);
if(!$result)
{
echo "<p>запрос на выборку из базы данных не проконал. наябедняйче одминчегу, ога. <br><strong>кот ошипки:</strong></p>";
exit(mysql_error());
}
if(mysql_num_rows($result)>0)
{
$myrow = mysql_fetch_array($result);
}
else
{
echo "<p>инфа по запросу не может быть извлечена, в таблице нет записей наверное.</p>";
exit();
}
//cfg
$maxmsg="600"; // Максимальное кол-во символов в сообщении
$back="<center>Вернитесь <a href='javascript:history.back(1)'><B>назад</B></a>"; // Удобная строка
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<META CONTENT="5" HTTP-EQUIV="refresh">
<title><? echo $myrow["title"]; ?></title>
<link href="../style.css" rel="stylesheet" type="text/css" />
<meta name="description" content="<? echo $myrow["meta_d"]; ?>" />
<meta name="keywords" content="<? echo $myrow["meta_k"]; ?>" />
</head>
<body>
<?
$t= $_SESSION['user_id'];
$a=1;
$queryz = "UPDATE
`users`
SET
`online`='{$a}'
WHERE
id='$t'";
$sql = mysql_query($queryz) or die(mysql_error());
$querye = mysql_query ("SELECT * FROM `users` WHERE `id`=$t LIMIT 1");
$sqlz = mysql_fetch_assoc($querye);
//echo "oline = "; echo $sqlz["online"];
?>
<table width="690" border="1" align="center" bgcolor="#FFFFFF" class="main_border">
<tr>
<td valign="top">
<a href="../index.php"><img src="../img/header.jpg" width="690" height="100%" border=0/></a> </td>
</tr>
<tr><td align="left">
<table border=2><tr><td>
<table width="514" height="500" border=1>
<tr>
<td>
<? if (isset($_GET['sob_id'])) {$to=$_GET['sob_id'];
$queryto = mysql_query
("SELECT * FROM `users` WHERE `id` = $to");
$sqlto = mysql_fetch_assoc($queryto);
echo "чат с <b>",$sqlto["user_name"],"</b>"; echo "  id: ",$sqlto["id"];}
else {$to=2; echo "to: ",$to;} ?>
</td>
</tr>
<tr>
<td><? $me=$sqlz["user_name"]." => ";
if (!empty($_POST['message']) || isset($_POST['message']) != "") {
$message=$me.$_POST['message'];
$h=fopen("history/$t-$to.txt","a+");
fwrite($h,"\r\n".$message."\n");
fclose($h);
$h=fopen("history/$t-$to.txt","a+");
$a = filesize("history/$t-$to.txt"); $n =15; $b = $n * 30;
fseek($h,$a-$b);
while (!feof ($h)) {
$content = fgets($h);
echo $content,"<br>";
}
unset ($_POST['message']);
fclose($h);} ?> </td>
</tr>
<tr>
<td valign="bottom" height="100%"><form action="chatmy.php" method = "post">
<textarea wrap="on" id="message" name="message" cols="60" rows="5"></textarea>
<input type="hidden" name="to" value="<?php echo $to; ?>" />
<input name="submit" type="submit" value="send" />
</form></td>
</tr>
<tr>
<td>e</td>
+166.3
<img src="./img/pts/main.gif">
<!--<? if ($id=="main" or $id=="" or $id=="archmain")
print "<img src=\"./img/pts/main.gif\">";
if ($id=="ecotur" or $id=="archecotur")
print "<img src=\"./img/pts/main_ekotur.gif\">";
if ($id=="koni" or $id=="archkoni")
print "<img src=\"./img/pts/main_koni.gif\">";
if ($id=="piknik" or $id=="archpiknik")
print "<img src=\"./img/pts/main_piknik.gif\">";
if ($id=="eco" or $id=="archeco")
print "<img src=\"./img/pts/main_eco.gif\">";
if ($id=="maps")
print "<img src=\"./img/pts/main_maps.gif\">";
if ($id=="info" or $id=="archinfo")
print "<img src=\"./img/pts/main_info.gif\">";
if ($id=="sitemap")
print "<img src=\"./img/pts/main_sitemap.gif\">";
if ($id=="contacts")
print "<img src=\"./img/pts/main_kord.gif\">";
if ($id=="ny")
print "<img src=\"./img/pts/main_ny.gif\">";
if ($id=="mas")
print "<img src=\"./img/pts/main_mas.gif\">";
?> -->
</td>
</tr>
<tr>
<td bgcolor="#e0ead3" background="./img/pts/left_main.gif" width="11" style="background-image: url(./img/pts/left_main.gif)"></td>
<td width="650" bgcolor="#e0ead3"><?
if ($id=="main" or $id=="")
include("global.php");
if ($id=="order")
include("order.php");
if ($id=="action")
include("action.php");
if ($id=="search")
{include("search/search.php");}
if ($id=="about" & $cat=="")
include("about.php");
if ($id=="archmain")
include("archnews.php");
if ($id=="contacts")
include("contacts.php");
if ($id=="about" & $cat=="ecoproj")
include("about/ecoproj.php");
if ($id=="about" & $cat=="anim")
include("about/anim.php");
if ($id=="about" & $cat=="prof")
include("about/prof.php");
if ($id=="about" & $cat=="press")
include("about/press.php");
if ($id=="rest" & $cat=="")
include("rest.php");
if ($id=="rest" & $cat=="child")
include("rest/child.php");
if ($id=="rest" & $cat=="child_eco")
include("rest/child_eco.php");
if ($id=="rest" & $cat=="child_edu")
include("rest/child_edu.php");
if ($id=="rest" & $cat=="child_gam")
include("rest/child_gam.php");
if ($id=="rest" & $cat=="child_his")
include("rest/child_his.php");
if ($id=="rest" & $cat=="child_sez")
include("rest/child_sez.php");
if ($id=="rest" & $cat=="child_zoo")
include("rest/child_zoo.php");
if ($id=="rest" & $cat=="child_str")
include("rest/child_str.php");
if ($id=="rest" & $cat=="child_dop")
include("rest/child_dop.php");
if ($id=="rest" & $cat=="fam")
include("rest/fam.php");
if ($id=="rest" & $cat=="adult")
include("rest/adult.php");
if ($id=="rest" & $cat=="eco")
include("rest/eco.php");
if ($id=="club" & $cat=="")
include("club.php");
if ($id=="club" & $cat=="cafe")
include("club/cafe.php");
if ($id=="club" & $cat=="piknik")
include("club/piknik.php");
if ($id=="club" & $cat=="gost")
include("club/gost.php");
if ($id=="koni" & $cat=="")
include("koni.php");
if ($id=="koni" & $cat=="uslugi")
include("koni/study.php");
if ($id=="koni" & $cat=="walk")
include("koni/walk.php");
if ($id=="koni" & $cat=="dom")
include("koni/dom.php");
if ($id=="koni" & $cat=="poni")
include("koni/poni.php");
if ($id=="koni" & $cat=="sell")
include("koni/sell.php");
if ($id=="koni" & $cat=="ippoter")
include("koni/ippoter.php");
Попросили заменить кое что на сайте, начал смотреть исходный код. Умилил ^_^
+78.6
if(data==null)
throw new ServerException("L0050",data.number);
Видимо невнимательность автора
+149.8
return urlencode(urlencode($text));
xxx: cлушай, отправляю урл-кодированное, на телефон приходит перекодированное в KOI-8
yyy: zzz: нужно отправляемое всё закодировать сверху снова urlencode($text)
xxx: жеесть, 2 раза :-D, получилось!
−859.4
SET @DD = DATEPART(dd, GETDATE())
SET @MM = DATEPART(mm, GETDATE())
SET @YYYY = DATEPART(yyyy, GETDATE())
IF LEN(@DD) = '1'
BEGIN
SET @DD = '0' + @DD
END
IF LEN(@MM) = '1'
BEGIN
SET @MM = '0' + @MM
END
SET @DT_D = @DD + '.' + @MM + '.' + @YYYY
Изврат по превращению текущей даты в нужный формат в MSSQL
+65.5
private static String getUTF8String(byte[] b, int off, int len) {
// First, count the number of characters in the sequence
int count = 0;
int max = off + len;
int i = off;
while (i < max) {
int c = b[i++] & 0xff;
switch (c >> 4) {
case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
// 0xxxxxxx
count++;
break;
case 12: case 13:
// 110xxxxx 10xxxxxx
if ((int)(b[i++] & 0xc0) != 0x80) {
throw new IllegalArgumentException();
}
count++;
break;
case 14:
// 1110xxxx 10xxxxxx 10xxxxxx
if (((int)(b[i++] & 0xc0) != 0x80) ||
((int)(b[i++] & 0xc0) != 0x80)) {
throw new IllegalArgumentException();
}
count++;
break;
default:
// 10xxxxxx, 1111xxxx
throw new IllegalArgumentException();
}
}
if (i != max) {
throw new IllegalArgumentException();
....
В либе работы с зипом
+101.6
procedure GaussMas ( n:integer;a: Matr;var rezult:V10);
var
s,s1:extended;
m,i,j,k,km,jm:integer;
z,d: array [0..10] of Extended ;
label m2;
begin
//..............................
for i := 1 to n do
begin
for j := 1 to n do
if (a[i][j]>0.9) then
begin
rezult[j]:=a[i][m];
goto m2;
end;
m2: continue;
end;
end;
Процедура расчета матрицы по методу Гаусса.
Форматирование сохранено как есть.