- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
public const char ExpMonthSeparator = ':';
protected void BindPager()
{
var colon = string.Format("{0}", ExpMonthSeparator);
/* And some lines for refactor */
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+150
public const char ExpMonthSeparator = ':';
protected void BindPager()
{
var colon = string.Format("{0}", ExpMonthSeparator);
/* And some lines for refactor */
}
Фикся очередную багу наткнулся на такую прелесть
+147.8
$insideitem = ""; $list_id = ""; $title = ""; $price = 0; $price_amazon = 0;
$price_low = 0; $asin = ""; $type = ""; $status = ""; $qty = 0;
$isbn = ""; $asins = ""; $spage = 0; $list_id = ""; $exchange_id = ""; $title = ""; $price = 0;
$price_list = 0; $price_amazon = 0; $price_used = 0; $price_collect = 0; $price_low = 0;
$a_asin = ""; $image_url_s = ""; $image_url_l = ""; $type = ""; $status = "";
$qty = 0; $sellers_cnt = 0; $publisher = ""; $release_date = "";
в цикле вот такой кусок кода..
+162.3
<head><title>Статистика ретрекеров сети nextOne</title></head>
<meta http-equiv="refresh" content="5;URL=index.php">
<?php
require_once("config.php");
error_reporting(∼E_ALL);
//Торрент трекер on\off
//Сервер 1
function check_server1($serverip1, $port1)
{
if($fp1=fsockopen($serverip1, $port1, $ERROR_NO, $ERROR_STR,(float)2))
{
return true;
fclose($fp1);
} else {
return false;
}
}
//Сервер 2
function check_server2($serverip2, $port2)
{
if($fp2=fsockopen($serverip2, $port2, $ERROR_NO, $ERROR_STR,(float)2))
{
return true;
fclose($fp2);
} else {
return false;
}
}
//Сервер 3
function check_server3($serverip3, $port3)
{
if($fp3=fsockopen($serverip3, $port3, $ERROR_NO, $ERROR_STR,(float)2))
{
return true;
fclose($fp3);
} else {
return false;
}
}
//Сервер 4
function check_server4($serverip4, $port4)
{
if($fp4=fsockopen($serverip4, $port4, $ERROR_NO, $ERROR_STR,(float)2))
{
return true;
fclose($fp4);
} else {
return false;
}
}
if(check_server1($serverip1, $port1)===true)
{
echo "<table border=0><tr><td>",$serverip1,":",$port1,"</td>","<td><b><font color=#2E8B57>online</font></b><br></td></tr>";
} else {
echo "<table border=0><tr><td>",$serverip1,":",$port1,"</td>","<td><b><font color=red>offline</font></b><br></td></tr>";
}
if(check_server2($serverip2, $port2)===true)
{
echo "<tr><td>",$severip2,":",$port2,"</td><td>","<b><font color=#2E8B57>online</font></b><br></td></tr>";
} else {
echo "<tr><td>",$serverip2,":",$port2,"</td><td>","<b><font color=red>offline</font></b><br></td></tr>";
}
if(check_server3($serverip3, $port3)===true)
{
echo "<tr><td>",$serverip3,":",$port3,"</td><td>","<b><font color=#2E8B57>online</font></b><br></td></tr>";
} else {
echo "<tr><td>",$serverip3,":",$port3,"</td><td>","<b><font color=red>offline</font></b><br></td></tr>";
}
if(check_server4($serverip4, $port4)===true)
{
echo "<tr><td>",$serverip4,":",$port4,"</td><td>","<b><font color=#2E8B57>online</font></b></td></tr></table>";
} else {
echo "<tr><td>",$serverip4,":",$port4,"</td><td>","<b><font color=red>offline</font></b><br></td></tr></table>>";
}a
?>
Цитата: "Я просо незнаю о работе с операторами array, а известный мне define тут не подходит "
−305.1
my ($_bonus1_l, $_bonus1_y, $_bonus2_l, $_bonus2_y) = ($l1*10 > rand(100) ? 1 : 0, $y1*10 > rand(100) ? 1 : 0, $l2*10 > rand(100) ? 1 : 0, $y2*10 > rand(100) ? 1 : 0);
($_bonus1_l, $_bonus2_l) = (0, 0) if $_bonus1_l == 1 and $_bonus2_l == 1;
($_bonus1_y, $_bonus2_y) = (0, 0) if $_bonus1_y == 1 and $_bonus2_y == 1;
if($turn > 12){
my ($_a1_def, $_b1_def, $_c1_def) = mass($pl1_mov, $User1, "def");
my ($_a1_att, $_b1_att, $_c1_att) = mass($pl1_att, $User1, "att");
my ($_a2_def, $_b2_def, $_c2_def) = mass($pl2_mov, $User2, "def");
my ($_a2_att, $_b2_att, $_c2_att) = mass($pl2_att, $User2, "att");
$N1 += $_a1_att if $_a2_def < 1000000;
$N1 += $_b1_att if $_b2_def < 1000000;
$N1 += $_c1_att if $_c2_def < 1000000;
$N2 += $_a2_att if $_a1_def < 1000000;
$N2 += $_b2_att if $_b1_def < 1000000;
$N2 += $_c2_att if $_c1_def < 1000000;
if($_bonus1_l){
my $l = int(rand(3));
## сБНПНР
if($l == 0){
my $r = 0;
($_a2_att, $r) = (0, 1) if $_a2_att > 0 and $_a1_def < 1000000;
($_b2_att, $r) = (0, 1) if $_b2_att > 0 and $_a1_def < 1000000 and $r == 0;
($_c2_att, $r) = (0, 1) if $_c2_att > 0 and $_a1_def < 1000000 and $r == 0;
$U1 = $r;
} elsif($l == 1){
my $r = 0;
($_a1_att, $r, $K2) = (int($_a1_att * 1.5), 1, int($_a1_att/2)) if $_a1_att > 0 and $_a2_def < 1000000;
($_b1_att, $r, $K2) = (int($_b1_att * 1.5), 1, int($_b1_att/2)) if $_b1_att > 0 and $_b2_def < 1000000 and $r == 0;
($_c1_att, $r, $K2) = (int($_c1_att * 1.5), 1, int($_c1_att/2)) if $_c1_att > 0 and $_c2_def < 1000000 and $r == 0;
} elsif($l == 2){
my ($r, $ov, $v) = (0, 0, int(rand(3)));
($_a1_att, $r, $ov) = (0, 1, (int($_a2_att/2))) if $_a2_att > 0 and $_a1_def > 1000000;
($_b1_att, $r, $ov) = (0, 1, (int($_b2_att/2))) if $_b2_att > 0 and $_b1_def > 1000000 and $r == 0;
($_c1_att, $r, $ov) = (0, 1, (int($_c2_att/2))) if $_c2_att > 0 and $_c1_def > 1000000 and $r == 0;
$_a1_att += $ov if $v == 0;
$_b1_att += $ov if $v == 1;
$_c1_att += $ov if $v == 2;
$O1 = $ov;
}
}
if($_bonus2_l){
my $l = int(rand(100));
if($l == 0){
my $r = 0;
($_a1_att, $r) = (0, 1) if $_a1_att > 0 and $_a2_def < 1000000;
($_b1_att, $r) = (0, 1) if $_b1_att > 0 and $_a2_def < 1000000 and $r == 0;
($_c1_att, $r) = (0, 1) if $_c1_att > 0 and $_a2_def < 1000000 and $r == 0;
$U2 = $r;
} elsif($l == 1){
my $r = 0;
($_a2_att, $r, $K1) = (int($_a2_att * 1.5), 1, int($_a2_att/2)) if $_a2_att > 0 and $_a1_def < 1000000;
($_b2_att, $r, $K1) = (int($_b2_att * 1.5), 1, int($_b2_att/2)) if $_b2_att > 0 and $_b1_def < 1000000 and $r == 0;
($_c2_att, $r, $K1) = (int($_c2_att * 1.5), 1, int($_c2_att/2)) if $_c2_att > 0 and $_c1_def < 1000000 and $r == 0;
} elsif($l == 2){
my ($r, $ov, $v) = (0, 0, int(rand(3)));
($_a2_att, $r, $ov) = (0, 1, (int($_a1_att/2))) if $_a1_att > 0 and $_a2_def > 1000000;
($_b2_att, $r, $ov) = (0, 1, (int($_b1_att/2))) if $_b1_att > 0 and $_b2_def > 1000000 and $r == 0;
($_c2_att, $r, $ov) = (0, 1, (int($_c1_att/2))) if $_c1_att > 0 and $_c2_def > 1000000 and $r == 0;
$_a2_att += $ov if $v == 0;
$_b2_att += $ov if $v == 1;
$_c2_att += $ov if $v == 2;
$O2 = $ov;
}
}
if($_bonus1_y){
my $l = int(rand(2));
if($l == 0){
my ($r, $rik, $V1) = (0, 0, int(rand(3)) + 1);
($r, $rik) = (1, (int($_a1_att/2))) if $_a1_att > 0 and $_a2_def < 1000000 and $V1 == 1;
($r, $rik) = (1, (int($_b1_att/2))) if $_b1_att > 0 and $_b2_def < 1000000 and $r == 0 and $V1 == 2;
($r, $rik) = (1, (int($_c1_att/2))) if $_c1_att > 0 and $_c2_def < 1000000 and $r == 0 and $V1 == 3;
$R2 = $rik;
$db->query("UPDATE duel set pl1_rik = CONCAT(pl1_rik, $V1) where sid = \"$dsid\"") if $R2 > 0;
} elsif($l == 1){
my $r = 0;
($_a2_def, $r) = ($_a2_def - 1000000, 1) if $_a1_att > 0 and $_a2_def > 1000000;
($_b2_def, $r) = ($_b2_def - 1000000, 2) if $_b1_att > 0 and $_b2_def > 1000000 and $r == 0;
($_c2_def, $r) = ($_c2_def - 1000000, 3) if $_c1_att > 0 and $_c2_def > 1000000 and $r == 0;
$T2 = $r;
}
}
if($_bonus2_y){
my $l = int(rand(2));
if($l == 0){
my ($r, $rik, $V2) = (0, 0, int(rand(3)) + 1);
($r, $rik) = (1, (int($_a2_att/2))) if $_a2_att > 0 and $_a1_def < 1000000 and $V2 == 1;
($r, $rik) = (1, (int($_b2_att/2))) if $_b2_att > 0 and $_b1_def < 1000000 and $r == 0 and $V2 == 2;
($r, $rik) = (1, (int($_c2_att/2))) if $_c2_att > 0 and $_c1_def < 1000000 and $r == 0 and $V2 == 3;
#$_a2_att += $rik if $V2 == 1;
#$_b2_att += $rik if $V2 == 2;
#$_c2_att += $rik if $V2 == 3;
$R1 = $rik;
$db->query("UPDATE duel set pl2_rik = CONCAT(pl2_rik, $V2) where sid = \"$dsid\"") if $R1 > 0;
} elsif($l == 1){
my $r = 0;
($_a1_def, $r) = ($_a1_def - 1000000, 1) if $_a2_att > 0 and $_a1_def > 1000000;
($_b1_def, $r) = ($_b1_def - 1000000, 2) if $_b2_att > 0 and $_b1_def > 1000000 and $r == 0;
Из браузерной игрушки на mod_perl/mysql. Код наглядно демонстрирует, что говнокод зависит не от языка, а от программиста.
−307.7
sub get_ppl{
my $self = shift;
my ($U, $print_done, $team) = @_;
return "<ppl team_id='$team' battle_stats='$U->{_CHAR}->{win},$U->{_CHAR}->{loose},$U->{_CHAR}->{nobody}' medals='".$U->get_medal_string_for_user($U)."' $clan team_id='0' av_id='$U->{_CHAR}->{av_id}' fn='$U->{_CHAR}->{avatara}' u='$U->{_CHAR}->{u}' hp_u='$U->{_CHAR}->{hp_u}' stat0_u='$U->{_CHAR}->{stat0_u}' stat0='$U->{_CHAR}->{f}' stat1='$U->{_CHAR}->{m}' stat2='$U->{_CHAR}->{y}' stat3='$U->{_CHAR}->{l}' hpmax='$U->{_CHAR}->{maxhp}' hp='$U->{_CHAR}->{hp}' aname='$U->{_USER_NAME}' lvl='$U->{_CHAR}->{lvl}' cname='$U->{_CHAR}->{name}' id='$U->{_ID}' carma='$U->{_CHAR}->{carma}' sex='$U->{_CHAR}->{sex}' slot0='$Item[0]' slot8='$Item[8]' slot7='$Item[7]' slot6='$Item[6]' slot1='$Item[1]' weight='$U->{_CHAR}->{weight}' slot5='$Item[5]' slot4='$Item[4]' slot3='$Item[3]' slot2='$Item[2]' city_id='$U->{_CHAR}->{city_id}'/>" if !$print_done;
return "<ppl done='true' battle_stats='$U->{_CHAR}->{win},$U->{_CHAR}->{loose},$U->{_CHAR}->{nobody}' medals='".$U->get_medal_string_for_user($U)."' $clan team_id='0' av_id='$U->{_CHAR}->{av_id}' fn='$U->{_CHAR}->{avatara}' u='$U->{_CHAR}->{u}' hp_u='$U->{_CHAR}->{hp_u}' stat0_u='$U->{_CHAR}->{stat0_u}' stat0='$U->{_CHAR}->{f}' stat1='$U->{_CHAR}->{m}' stat2='$U->{_CHAR}->{y}' stat3='$U->{_CHAR}->{l}' hpmax='$U->{_CHAR}->{maxhp}' hp='$U->{_CHAR}->{hp}' aname='$U->{_USER_NAME}' lvl='$U->{_CHAR}->{lvl}' cname='$U->{_CHAR}->{name}' id='$U->{_ID}' carma='$U->{_CHAR}->{carma}' sex='$U->{_CHAR}->{sex}' slot0='$Item[0]' slot8='$Item[8]' slot7='$Item[7]' slot6='$Item[6]' slot1='$Item[1]' weight='$U->{_CHAR}->{weight}' slot5='$Item[5]' slot4='$Item[4]' slot3='$Item[3]' slot2='$Item[2]' city_id='$U->{_CHAR}->{city_id}'/>" if $print_done;
}
Забавная проверка
+135.5
class PliggMailer{
var $subject = '';
var $body = '';
var $from = '';
var $to = '';
function PliggMailer($subj = '', $body = '', $from = '', $to = '', $cc = '', $bcc = ''){
if($subj != ''){$this->subject = $subj;}
if($body != ''){$this->body = $body;}
if($from != ''){$this->from = $from;}
if(!is_array($to)){$to[] = $to;}
if(count($to) == 0){$this->to = $to;}
if(!is_array($to)){$to[] = $to;}
if(count($to) == 0){$this->to = $to;}
if(!is_array($to)){$to[] = $to;}
if(count($to) == 0){$this->to = $to;}
}
Блоговый движок pligg жжот.
+130
if(included.equals(INCLUDED_ALL) || fieldNames.indexOf(field.getName()) != -1) {
if ((field.getDocumentMapping() != null && field.getDocumentMapping().trim().length() > 0)
|| (isCase.booleanValue()
&& ((field.getWorkflowMapping() != null && field.getWorkflowMapping().trim().length() > 0)
|| (field.getContentMapping() != null && field.getContentMapping().trim().length() > 0))
) {
// тут еще насрано
}}
) {
классический унылый говнокод, весь проект в таком стиле..
+164.9
if (USE_MAIN) {
$templ = 'main';
....
} elseif (!USE_MAIN) {
$used = USE_MAIN ? 1 : 0;
$templ = 'default';
....
}
......
if ( !$used ) $templ = 'default';
Вычищая один проект помимо всего прочего встретил такое чудо
+148.3
// Prevent any possible XSS attacks via $_GET.
foreach ($_GET as $check_url) {
if (!is_array($check_url)) {
$check_url = str_replace("\"", "", $check_url);
if ((eregi("<[^>]*script*\"?[^>]*>", $check_url)) || (eregi("<[^>]*object*\"?[^>]*>", $check_url)) ||
(eregi("<[^>]*iframe*\"?[^>]*>", $check_url)) || (eregi("<[^>]*applet*\"?[^>]*>", $check_url)) ||
(eregi("<[^>]*meta*\"?[^>]*>", $check_url)) || (eregi("<[^>]*style*\"?[^>]*>", $check_url)) ||
(eregi("<[^>]*form*\"?[^>]*>", $check_url)) || (eregi("\([^>]*\"?[^)]*\)", $check_url)) ||
(eregi("\"", $check_url))) {
die ();
}
}
}
PHP-Fusion Content Management System (C)
// напалмом по воробьям...
+148
[root@v6704 ~]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
[root@v6704 ~]# cd /var/www/vhosts/i-tech.me/subdomains/store/httpdocs/
[root@v6704 httpdocs]# ls
access dblist i2 installer license.txt settings.xml showmucontent.php update.xml
ajaxhandler.php domxml-php4-to-php5.php includes install.js login setupguide.htm sitemap.php www.tar.gz
backup dumper.php index.php install.log published shop system
data help install.css kernel readme.txt showdblist.php temp
[root@v6704 httpdocs]# rm -Rf *.*
[root@v6704 httpdocs]# ls
access backup data dblist help i2 includes installer kernel login published shop system temp
[root@v6704 httpdocs]# rm -Rf *
[root@v6704 httpdocs]# ls
[root@v6704 httpdocs]#
[root@v6704 ~]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
[root@v6704 ~]# cd /var/www/vhosts/i-tech.me/subdomains/store/httpdocs/