- 1
-=== 5555 GET ===-
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+144
-=== 5555 GET ===-
+74
+162
// 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>';
}
}
+156
<?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 );
}
+153
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(){}
}
+159
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);
}
−119
foreach $line (@data) {
@alldata = 0;
unshift @alldata;
@alldata = split(/\|/, $line);
Инициализация массива.
+160
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;
}
}
+146
# 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();
}
Работа с массивами.
+146
// Borland C++ - (C) Copyright 1991, 1992 by Borland International
/* HELLO.C -- Hello, world */
#include <stdio.h>
int main()
{
printf("Hello, world\n");
return 0;
}
Копирайт, однако !