-
Куча / Говнокод #5555
+74
Комментарии (36) -
PHP / Говнокод #5554
+162
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
// Admin login if(isset($_POST['login_submit'])) { // Sleep TEMPLATE_CMS_LOGIN_SLEEP seconds for blocking Brute Force Attacks sleep(TEMPLATE_CMS_LOGIN_SLEEP); $user_xml_db = getXMLdb('../data/system/users.xml'); $user = selectXMLRecord($user_xml_db, "/root/user[login='".post('login')."']"); if($user !== null) { if($user->login == post('login')) { if(trim($user->password) == encryptPassword(trim(post('password')))) { if($user->role == 'admin') { $_SESSION['admin'] = true; $_SESSION['user_id'] = (int)$user['id']; $_SESSION['user_login'] = (string)$user->login; } } else { $login_error = 'Wrong <b>login</b> or <b>password</b>'; } } } else { $login_error = 'Wrong <b>login</b> or <b>password</b>'; } }Комментарии (0) -
PHP / Говнокод #5553
+156
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
<?php function mb_fgets( &$file, $buf_size=1024 ){ $buf = fgets( $file, $buf_size ); //Прочитали до конца файла - обрабатывать нечего if( fEoF($file) ) return $buf; $byte = ord(substr( $buf, -1, 1 )); if( $byte<=0x7F ) return $buf; $count=1; while( $byte & 0xC0 != 0xC0 ){ $count++; $byte = ord(substr( $buf, -$count, 1 )); } $mask = 0x40; $bits_count = 2; while( $byte & $mask ){ $mask = $mask >> 1; $bits_count++; } return $buf . fgets( $file, $bits_count-$count ); }Комментарии (0) -
PHP / Говнокод #5552
+153
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
abstract class Cover_Abstract_Simple implements Cover_Interface { protected $data = array(); public function __get($key) { return isset($this->data[$key]) ? $this->data[$key] : null; } public function __set($key, $value) { $this->data[$key] = $value; } public function __isset($key) { return isset($this->data[$key]); } public function __unset($key) { unset($this->data[$key]); } public function getData() { return $this->data; } public function setData($data) { foreach ($data as $key => $value) { $this->$key = $value; } } public function clear() { $this->data = array(); } public function __toString(){} }Комментарии (7) -
JavaScript / Говнокод #5551
+159
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
function start(x, y, w, h) { document.getElementById('al').style.left=x; document.getElementById('al').style.top=y-Math.round(h/2); document.getElementById('al').style.width=w; document.getElementById('al').style.height=h; h=Math.round((w+160)*h/w); n=gdw()/100*75; if (w<n) setTimeout('start('+(x-80)+', '+y+', '+(w+160)+', '+h+')',1); }Комментарии (2) -
Perl / Говнокод #5550
−119
- 1
- 2
- 3
- 4
foreach $line (@data) { @alldata = 0; unshift @alldata; @alldata = split(/\|/, $line);Инициализация массива.
Комментарии (11) -
JavaScript / Говнокод #5549
+160
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
p0=0; p1=0; inn=0; out=0; nx=0;ny=0;wh=0;wy=0; function rand(min, max) { return Math.random() * (max - min) + min; } function in_fld() { rere(); } function rere() { var ctx = document.getElementById('field').getContext('2d'); var fimg = new Image(); fimg.onload = function(){ ctx.drawImage(fimg,0,0); ctx.stroke(); } fimg.src = 'images/field.png'; var bimg = new Image(); bimg.onload = function(){ ctx.drawImage(bimg,ps,n_y(),g_h()/2,g_h()); ctx.stroke(); } bimg.src = 'images/b_b.png'; ps+=30; if (ps>=gmx()) { l+=1; if (l>3) l=1; ps=n_x(); if (l==3) { shoots = Array(0,0,0,0,0,0,0,0,0,0); used=Array(0,0,0,0,0); sht((lap-1)%2,0); shooting(0,0); document.getElementById('field').addEventListener('mousemove', field_mm, false); document.getElementById('field').addEventListener('mousedown', field_md, false); stop=-1; } } if (stop==1) setTimeout('rere()',40); } function n_x() { switch (l) { case 1: return 15; break; case 2: return 15; break; case 3: return 200; } } function n_y() { switch (l) { case 1: return 350; break; case 2: return 490; break; case 3: return 590; } }Комментарии (4) -
Си / Говнокод #5548
+146
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
# include <stdio.h> # include <math.h> # include <conio.h> main() { int i,n; float y[12],a[12],b[12],c[12],d[12],e[12]; clrscr(); for (i=1;i<13;i++) { printf ("y[%d]= ",i); scanf ("%f",&y[i]); } //========================================// a[1]=y[2]-y[1];a[2]=y[3]-y[2];a[3]=y[4]-y[3];a[4]=y[5]-y[4]; a[6]=y[7]-y[6];a[7]=y[8]-y[7];a[8]=y[9]-y[8];a[9]=y[10]-y[9]; a[10]=y[11]-y[10];a[11]=y[12]-y[11];a[12]=0; b[1]=a[2]-a[1];b[2]=a[3]-a[2];b[3]=a[4]-a[3];b[4]=a[5]-a[4]; b[6]=a[7]-a[6];b[7]=a[8]-a[7];b[8]=a[9]-a[8];b[9]=a[10]-a[9]; b[10]=a[11]-a[10];b[11]=0;b[12]=0; c[1]=b[2]-b[1];c[2]=b[3]-b[2];c[3]=b[4]-b[3];c[4]=b[5]-b[4]; c[6]=b[7]-b[6];c[7]=b[8]-b[7];c[8]=b[9]-b[8];c[9]=b[10]-b[9]; c[10]=0;c[11]=0;c[12]=0; d[1]=c[2]-c[1];d[2]=c[3]-c[1];d[3]=c[4]-c[3];d[4]=c[5]-c[4]; d[6]=c[7]-c[6];d[7]=c[8]-c[7];d[8]=c[9]-c[8];d[9]=0;d[10]=0;d[11]=0;d[12]=0; e[1]=d[2]-d[1];e[2]=d[3]-d[2];e[3]=d[4]-d[3];e[4]=d[5]-d[4]; e[6]=d[7]-d[6];e[7]=d[8]-d[7];e[8]=0;e[9]=0;e[10]=0;e[11]=0;e[12]=0; printf ("Y\t\tY\t\tY2\t\tY3\t\tY4\n%f\t%f\t%f\t%f\t%f\n%f\t%f\t%f\t%f\t%f\n%f\t%f\t%f\t%f\t%f\n%f\t%f\t%f\t%f\t%f\n%f\t%f\t%f\t%f\t%f\n%f\t%f\t%f\t%f\t%f\n%f\t%f\t%f\t%f\t%f\n%f\t%f\t%f\t%f\t%f\n%f\t%f\t%f\t%f\t%f\n%f\t%f\t%f\t%f\t%f\n%f\t%f\t%f\t%f\t%f\n%f\t%f\t%f\t%f\t%f\n",y[1],a[1],b[1],c[1],d[1],y[2],a[2],b[2],c[2],d[2],y[3],a[3],b[3],c[3],d[3],y[4],a[4],b[4],c[4],d[4],y[5],a[5],b[5],c[5],d[5],y[6],a[6],b[6],c[6],d[6],y[7],a[7],b[7],c[7],d[7],y[8],a[8],b[8],c[8],d[8],y[9],a[9],b[9],c[9],d[9],y[10],a[10],b[10],c[10],d[10],y[11],a[11],b[11],c[11],d[11],y[12],a[12],b[12],c[12],d[12]); getche(); }Работа с массивами.
Комментарии (18) -
Си / Говнокод #5547
+146
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
// Borland C++ - (C) Copyright 1991, 1992 by Borland International /* HELLO.C -- Hello, world */ #include <stdio.h> int main() { printf("Hello, world\n"); return 0; }Копирайт, однако !
Комментарии (8) -
C++ / Говнокод #5546
+178
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
struct rt_asserter_t { string func_; rt_asserter_t( string func ): func_(func){}; void operator = (bool condition) { if( condition == true ) { ;;; } else if (condition == false) { throw new rt_assert_ex(func_); } else { throw new unknown_ex(func_); } } };реальный крупный коммерческий проект.
Какой-то тайный замысел в этой магии.Комментарии (32)
Follow us!