- 1
"".equalsIgnoreCase(propertiesFile) != true
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+92
"".equalsIgnoreCase(propertiesFile) != true
индусское достояние
+120
if(isset($_POST['myinfo'])){
if(trim($_POST['email'])=="" && !mysql_num_rows(mysql_query("SELECT * FROM `users` WHERE `userid`='".$_SESSION['userid']."' AND `vkid`!='';"))){
$aSuccess=false;
$aErrorType="eEMail";
$aErrorMsg="Введите адрес электронной почты.";
} elseif(strlen(trim($_POST['email']))>"128" && !mysql_num_rows(mysql_query("SELECT * FROM `users` WHERE `userid`='".$_SESSION['userid']."' AND `vkid`!='';"))){
$aSuccess=false;
$aErrorType="eEMail";
$aErrorMsg="Слишком длинный адрес электронной почты.";
} elseif(!preg_match("/^([-a-zA-Z0-9._]+@[-a-zA-Z0-9.]+(\.[-a-zA-Z0-9]+)+)*$/", trim($_POST['email'])) && !mysql_num_rows(mysql_query("SELECT * FROM `users` WHERE `userid`='".$_SESSION['userid']."' AND `vkid`!='';"))){
$aSuccess=false;
$aErrorType="eEMail";
$aErrorMsg="Некорректный адрес электронной почты.";
} elseif(mysql_num_rows(mysql_query("SELECT `email` FROM `users` WHERE `email` = '".htmlspecialchars(trim(strtolower($_POST['email'])))."' AND `userid`!='".$_SESSION['userid']."' LIMIT 1"))>0 && !mysql_num_rows(mysql_query("SELECT * FROM `users` WHERE `userid`='".$_SESSION['userid']."' AND `vkid`!='';"))){
$aSuccess=false;
$aErrorType="eEMail";
$aErrorMsg="Пользователь с таким адресом электронной почты уже зарегистрирован.";
} elseif(strlen(trim($_POST['about']))>"12000"){
$aSuccess=false;
$aErrorType="eAbout";
$aErrorMsg="Вы предоставили слишком много информации о себе.";
} else {
if(!mysql_num_rows(mysql_query("SELECT * FROM `users` WHERE `userid`='".$_SESSION['userid']."' AND `vkid`!='';"))){
$mail="`email`='".htmlspecialchars(trim(strtolower($_POST['email'])))."', ";
} else {
$mail="";
}
mysql_query("UPDATE users SET ".$mail."`about`='".mysql_real_escape_string(trim($_POST['about']))."' WHERE userid='".$_SESSION['userid']."';");
$aSuccess=true;
header("Location: editme.php?msg=SUCCESSFULLY_UPDATED");
exit();
}
}
Код, используемый в моём самописном движке для изменения пользователем своего профиля на сайте.
+122
<?php
$pictures =new Array(4);
pictures[0]="1.jpg";
pictures[1]="2.png";
pictures[2]="3.jpg";
pictures[3]="4.jpg";
global $i=0;
function Next(){
if($i==3)
$i=0;
else
$i++;
document.getElementById('pic').setAttribute("src", picture[i]);
}
function Prev(){
if($i==0)
$i=3;
else
$i--;
document.getElementById('pic').setAttribute("src", picture[i]);
}
?>
Отличный салат.
+129
function assemble(var w:word;s:string):boolean;
.....
else if length(cmd)=3 then
begin
{ТРЕХБУКВЕННЫЕ КОМАНДЫ}
case cmd[1] of
'a':case cmd[2] of
'c':if cmd[3]='i' then
begin
code:=$ce;
typ:=7;
end;
'd':case cmd[3] of
'd':begin
code:=$80;
typ:=4;
end;
'c':begin
code:=$88;
typ:=4;
end;
'i':begin
code:=$c6;
typ:=7;
end;
end;
..... еще 500 подобных строк ....
end;
Прочитал http://govnokod.ru/10002 и вспомнил, как когда-то писал асм\дизасм\эмуль для 8080 на паскале.
+91
#include <amxmodx>
new g_MsgSync
new g_MsgSync2
new isConnected[33 char]
public plugin_init()
{
register_plugin("Damager", "1.0", "Prayer")
register_event("Damage", "EVENT_Damage", "b", "2!0", "3=0", "4!0")
g_MsgSync = CreateHudSyncObj()
g_MsgSync2 = CreateHudSyncObj()
}
public client_putinserver(id)
{
isConnected{id} = true
}
public client_disconnect(id)
{
isConnected{id} = false
}
public EVENT_Damage(id)
{
if(isConnected{id})
{
static damage, pid
damage = read_data(2)
set_hudmessage(255, 0, 0, 0.45, 0.50, 2, 0.1, 4.0, 0.1, 0.1, -1)
ShowSyncHudMsg(id, g_MsgSync2, "%d", damage)
pid = get_user_attacker(id)
if((pid > 0) && (pid < 33) && isConnected{pid})
{
set_hudmessage(0, 100, 200, -1.0, 0.55, 2, 0.1, 4.0, 0.02, 0.02, -1)
ShowSyncHudMsg(pid, g_MsgSync, "%d", damage)
}
}
}
Это павн переработанный вельвом. Кто писал плагины для CS тот поймёт всю соль.
+138
//
switch (cwin->cpref->shuffle) {
case TRUE:
last = g_list_last(cwin->cstate->rand_track_refs);
if ((!cwin->cstate->curr_rand_ref) || (last && (cwin->cstate->curr_rand_ref == last->data))){
path = get_next_unplayed_random_track(cwin);
if (!path)
rand_unplayed = TRUE;
}
else path = get_next_random_ref_track(cwin);
break;
case FALSE:
path = get_next_sequential_track(cwin);
if (!path) seq_last = TRUE;
break;
default:
break;
}
буль...
+105
public static bool IpCheck(String ip)
{
String [] octs = ip.Split(new char[] { '.' });
try
{
for (int n = 0; n < 4; n++)
{
byte b = Convert.ToByte(octs[n]);
}
return true;
}
catch (Exception)
{
return false;
}
}
Индуский валидатор IP - адреса
+128
Unsigned long int getset (void)
{unsigned long int a; int k; h=0;
While (‘<не конец файла>==<читать число в k>’);
{switch k
{case 1: h = h/0x 0001; break;
case 2: h = h/0x 0002; break;
case 3: h = h/0x 4; break;
case 4: h = h/0x 8; break;
case 5: h = h/0x 10; break;
case 6: h = h/0x 20; break;
case 7: h = h/0x 40; break;
case 8: h = h/0x 80; break;
…
case 30: h = h/0x 2000 0000; break;
case 31: h = h/0x 4000 0000; (- 1 на 31 месте) break;
case 32: h = h/0x 8000 0000; (- 1 на 32 месте) break;
}
}
return (h)
}
Мне кажется или весь смысл сводиться к h = h/2^(k-1)
+100
procedure interpretation;
var
s,f:string;
i,m,v:integer;
begin
s:=#0;
for I:=0 to form9.Memo2.Lines.Count-1 do begin
s:=form9.Memo2.Lines.Strings[i];//ïðîñìîòð ñòðîê èäåò
//ñâåðõó âíèç
if s='hex' then hex;
if s='acsii' then acsii;
if (s[1]='a') and (s[2]='d') and (s[3]='d') then begin
form9.Edit6.Text:=s[5];
form9.Edit5.Text:=s[7];
peredsim;
end;
if (s[1]='s') and (s[2]='a') and (s[3]='m') then begin
form9.Edit2.Text:=s[5];
form9.Edit4.Text:=s[7];
samsimbyl;
end;
if (s[1]='d') and (s[2]='e') and (s[3]='l') then begin
form9.Edit3.Text:=s[5];
for v:=1 to length(s) do
deletesimbyl;
end;
if (s[1]='d') and (s[2]='e') and (s[3]='l') and (s[4]='s') then begin
form9.Edit3.Text:=s[6];
dels;
end;
if (s[1]='i') and (s[2]='n') and (s[3]='f') then begin
form9.Memo1.Text:=s[5]+form9.Memo1.Text;
end;
if (s[1]='f') and (s[2]='n') and (s[3]='i') then begin
form9.Memo1.Text:=form9.Memo1.Text+s[5];
end;
if (s[1]='p') and (s[2]='h') and (s[3]='e') then RapsrRedel;
if (s[1]='n') and (s[2]='a') and (s[3]='b') then PerstNO;
if (s[1]='a') and (s[2]='t') and (s[3]='s') then acsiitosim;
if (s[1]='h') and (s[2]='t') and (s[3]='s') then hextosim;
if (s[1]='h') and (s[2]='t') and (s[3]='a') then hextoacsii;
if (s[1]='a') and (s[2]='t') and (s[3]='h') then acsiitohex;
end;
end;
Нужно было быстро накодить интерпретатор, которым никто пользоваться не будет, кроме собственно автора программы, для создания простеньких скриптов (сами понимаете семантический анализатор писать, в данном случае не улыбалось). Потому получился такой МегОАдЪовый говнокод!
+159
function line( x0, y0, x, y, elmId ) {
var sx = x-x0, sy = y-y0, dir = (sx>sy), adir = (Math.abs(sx)>Math.abs(sy));
if ( (x0>x&&y0<=y&&adir)||(x0<=x&&y0>y&&!adir)||(x0>x&&y0>y) ) return line(x, y, x0, y0, elmId); // black magic!
var d1 = dir? x0:y0, d2 = dir? y0:x0, b1 = dir? sx:sy, b2 = dir? sy:sx, k = b2/b1;
for( var i=0; i<=b1;i++ ){
if ( dir ) plot( d1, Math.floor(d2), elmId );
else plot( Math.floor(d2), d1, elmId );
d1++;d2+=k;
}
return true;
}
/* ... */
function plot(x, y, elmId) {
var div = document.createElement('div');
div.className = 'dot' + (!!elmId? ' dot-'+elmId:'' ) ;
div.style.left = x + 'px';
div.style.top = y + 'px';
document.getElementsByTagName('BODY')[0].appendChild(div);
}
Опачки...