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

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

    +161

    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
    $tmpProduct = array(
    ...
        'FARE' => $tmpFares,
        '~FARE' => CTRSCurrency::GetStringFull($row['FARE'], $o['CURRENCY']),
        'TAX' => CTRSCurrency::GetString($row['TAX'], $o['CURRENCY']),
        '~TAX' => CTRSCurrency::GetStringFull($row['TAX'], $o['CURRENCY']),
    ...
    );
    
    ...
    	
    $tmpProduct['FARE_'] = $tmpProduct['~FARE'];
    $tmpProduct['TAX_'] = $tmpProduct['~TAX'];
    $tmpProduct['~FARE_'] = $row['FARE'];
    $tmpProduct['~TAX_'] = $row['TAX'];

    Из одного очень большего компонента...

    wwwguru, 08 Апреля 2011

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

    +161

    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
    //стандарт
    		$price_st = mysql_query("select price from db_tarif where `from` = '$start' and `to` = '$finish' and ves_ot <= '$izmer' and  ves_do>= '$izmer' and `type`='$type_st' limit 1");
    		$price_st = mysql_result($price_st, 0);
    
    		$minprice_st = mysql_query("select minprice from db_tarif where `from` = '$start' and `to` = '$finish' and ves_ot <= '$izmer' and ves_do >= '$izmer' and `type`='$type_st' limit 1");
    		$minprice_st = mysql_result($minprice_st, 0);
    		$time_st = mysql_query("select time from db_tarif where `from` = '$start' and `to` = '$finish' and ves_ot <= '$izmer' and ves_do >= '$izmer' and `type`='$type_st' limit 1");
    		$time_st = mysql_result($time_st, 0);
    
    	//экспресс
    		$price_ex = mysql_query("select price from db_tarif where `from` = '$start' and `to` = '$finish' and ves_ot <= '$izmer' and  ves_do>= '$izmer' and `type`='$type_ex' limit 1");
    		$price_ex = mysql_result($price_ex, 0);
    		$minprice_ex = mysql_query("select minprice from db_tarif where `from` = '$start' and `to` = '$finish' and ves_ot <= '$izmer' and ves_do >= '$izmer' and `type`='$type_ex' limit 1");
    		$minprice_ex = mysql_result($minprice_ex, 0);
    		$time_ex = mysql_query("select time from db_tarif where `from` = '$start' and `to` = '$finish' and ves_ot <= '$izmer' and ves_do >= '$izmer' and `type`='$type_ex' limit 1");
    		$time_ex = mysql_result($time_ex, 0);
    
    	//Ритейл
    		$price_pallet = mysql_query("select price from db_tarif where `from` = '$start' and `to` = '$finish' and ves_ot <= '$pallets' and  ves_do>= '$pallets' and `type`='$type_rit' limit 1");
    		$price_pallet = mysql_result($price_pallet, 0);
    
    		$time_pallet = mysql_query("select time from db_tarif where `from` = '$start' and `to` = '$finish' and ves_ot <= '$pallets' and ves_do >= '$pallets' and `type`='$type_rit' limit 1");
    		$time_pallet = mysql_result($time_pallet, 0);
    
    	//авиа
    		if ($start==getIdCity('Москва')){
    
    			if ($volume*167>$weight){
    				$izmer=(float)($volume*167);
    				$kol_av = $volume*167;
    			}
    			else
    			{
    				$izmer=$weight;
    				$kol_av = $weight;
    			}
    			$price_av = mysql_query("select price from db_tarif where `from` = '$start' and `to` = '$finish' and ves_ot <= '$izmer' and  ves_do>= '$izmer' and `type`='$type_av' limit 1");
    			$price_av = mysql_result($price_av, 0);
    			$minprice_av = mysql_query("select minprice from db_tarif where `from` = '$start' and `to` = '$finish' and ves_ot <= '$izmer' and ves_do >= '$izmer' and `type`='$type_av' limit 1");
    			$minprice_av = mysql_result($minprice_av, 0);
    			$time_av = mysql_query("select time from db_tarif where `from` = '$start' and `to` = '$finish' and ves_ot <= '$izmer' and ves_do >= '$izmer' and `type`='$type_av' limit 1");
    			$time_av = mysql_result($time_av, 0);
    		}
    		else{
    			$cost_av = "Тариф недоступен";
    		}

    калькулятор стоимости перевозки

    Shiz89, 08 Апреля 2011

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

    +159

    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
    public function count_relation($of_type = ""){
    			if ($this->is_login()){
    				$this->get_data($_COOKIE['login']);
    				
    				if (empty($of_type))
    					$relations = $this->sql("SELECT COUNT(id) AS count FROM users_relations WHERE user_id='".$this->id."'", 1);
    				else
    					$relations = $this->sql("SELECT COUNT(id) AS count FROM users_relations WHERE user_id='".$this->id."' WHERE type='".mysql_escape_string($of_type)."'", 1);
    					
    				return $invites->relations;
    			}
    			
    			return false;
    		}

    Не перевелись на Руси говнокодеры

    ener, 07 Апреля 2011

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

    +161

    1. 1
    2. 2
    $this->Object = Application::getObject();
    $this->OBJECT = $this->Object->object;

    А Баден-Баден где-то в Европе...

    skubent, 31 Марта 2011

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

    +159

    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
    if (is_dir($read_dir)) {
    	if ($open_dir = @opendir($read_dir)) {
    		while (false !== ($dir_temp = readdir($open_dir))){
    			if ($dir_temp != "." && $dir_temp != ".." && is_dir($read_dir.'/'.$dir_temp) && $filtre == '') {
    				if(!(file_exists("../templates/".$dir_temp."/parameter/info.php"))) {
    					echo messStop(LG_DIR.' ' . $dir_temp . ' '.LG_MOD_ERROR_IS_FILE_);
    				} else {
    					require("../templates/".$dir_temp."/parameter/info.php");
    					echo "<tr><td>";
    					if(!(file_exists("../templates/".$dir_temp."/parameter/previews.jpg"))) {
    						echo "<a href=\"?am=mod[template]&template=[edit]&name=$dir_temp\" OnMouseOver=\"Tip('<img width=&quot;175&quot; src=&quot;../images/all/no_prewies.png&quot; >')\" />$temp_name</a>";
    					} else {
    						echo "<a href=\"?am=mod[template]&template=[edit]&name=$dir_temp\" OnMouseOver=\"Tip('<img width=&quot;175&quot; src=&quot;../templates/$dir_temp/parameter/previews.jpg&quot; >')\" />$temp_name</a>";
    					}
    					echo "</td><td>$temp_version</td><td>$temp_date</td><td>$temp_autor</td></tr>";
    				}
    			} elseif ($dir_temp != "." && $dir_temp != ".." && is_dir($read_dir.'/'.$dir_temp) && $dir_temp == $filtre) {
    				if(!(file_exists("../templates/".$dir_temp."/parameter/info.php"))) {
    					echo messStop(LG_DIR.' ' . $dir_temp . ' '.LG_MOD_ERROR_IS_FILE_);
    				} else {
    					require("../templates/".$dir_temp."/parameter/info.php");
    					echo "<tr><td>";
    					if(!(file_exists("../templates/".$dir_temp."/parameter/previews.jpg"))) {
    						echo "<a href=\"?am=mod[template]&template=[edit]&name=$dir_temp\" OnMouseOver=\"Tip('<img width=&quot;175&quot; src=&quot;../images/all/no_prewies.png&quot; >')\" />$temp_name</a>";
    					} else {
    						echo "<a href=\"?am=mod[template]&template=[edit]&name=$dir_temp\" OnMouseOver=\"Tip('<img width=&quot;175&quot; src=&quot;../templates/$dir_temp/parameter/previews.jpg&quot; >')\" />$temp_name</a>";
    					}
    					echo "</td><td>$temp_version</td><td>$temp_date</td><td>$temp_autor</td></tr>";
    				}
    			} elseif(!is_dir($read_dir.'/'.$filtre) && $filtre != '' && $filtre != $dir_temp) {
    				$returnMessWarn = messSearch(LG_ERR_FILTRE_NULL);
    			}
    		}
    	closedir($open_dir);
    	}
    }

    Данный код выводит списком шаблоны от системы.... Самое страшное, когда спустя некоторое время, со свежими мозгами потребовалось усовершенствовать всё это, в итоге проблема решилась просто, всё переписатьс нуля по человечески.

    nethak, 30 Марта 2011

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

    +155

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    if($upload) { $ftpsucc=1; } else { $ftpsucc=0; } 
    // check upload status: 
    print (!$upload) ? 'Cannot upload' : 'Upload complete'; 
    print "\n"; 
    // close the FTP stream 
    ftp_close($conn_id); 
    ?>

    Из комментариев php.net. Переменная $ftpsucc далее не используется.

    Sinless, 30 Марта 2011

    Комментарии (1)
  8. Perl / Говнокод #6135

    −124

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    sub WidthOf()
    {
      my %WIDTHES =('90','195','118','165', ...  over9000   ...'43','255');
      my $TextWidth;
    
      map {$TextWidth += $WIDTHES{ord $_} || 200} split //,@_[0];
      return $TextWidth;
    }

    abadonna, 30 Марта 2011

    Комментарии (1)
  9. Ruby / Говнокод #6086

    −106

    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
    # progress bar
    
    width = 60  # width of bar
    com   = 540 # input data
    
    pr = com * 0.01
    i = 0
    j = width
    
    v = 1
    puts
    while pr <= com
    
      print "\r#{v}% [#{"|"*i}#{" "*j}]"
    
      pr += com * 0.01  
    
      i += width * 0.01
      j -= width * 0.01
    
      v += 1  
      
      sleep(0.01)
      
    end
    puts

    Консольный прогресс-бар.

    delmind, 25 Марта 2011

    Комментарии (1)
  10. JavaScript / Говнокод #6040

    +164

    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
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    if (VDIC_web_form_address.match(regWFAcustom))
    	{
    	URLDecode(VDIC_web_form_address,'YES');
    	TEMP_VDIC_web_form_address = decoded;
    	TEMP_VDIC_web_form_address = TEMP_VDIC_web_form_address.replace(regWFAcustom, '');
    	}
    else
    	{
    	web_form_vars = 
    	"&lead_id=" + document.vicidial_form.lead_id.value + 
    	"&vendor_id=" + document.vicidial_form.vendor_lead_code.value + 
    	"&list_id=" + document.vicidial_form.list_id.value + 
    	"&gmt_offset_now=" + document.vicidial_form.gmt_offset_now.value + 
    	"&phone_code=" + document.vicidial_form.phone_code.value + 
    	"&phone_number=" + document.vicidial_form.phone_number.value + 
    	"&title=" + document.vicidial_form.title.value + 
    	"&first_name=" + document.vicidial_form.first_name.value + 
    	"&middle_initial=" + document.vicidial_form.middle_initial.value + 
    	"&last_name=" + document.vicidial_form.last_name.value + 
    	"&address1=" + document.vicidial_form.address1.value + 
    	"&address2=" + document.vicidial_form.address2.value + 
    	"&address3=" + document.vicidial_form.address3.value + 
    	"&city=" + document.vicidial_form.city.value + 
    	"&state=" + document.vicidial_form.state.value + 
    	"&province=" + document.vicidial_form.province.value + 
    	"&postal_code=" + document.vicidial_form.postal_code.value + 
    	"&country_code=" + document.vicidial_form.country_code.value + 
    	"&gender=" + document.vicidial_form.gender.value + 
    	"&date_of_birth=" + document.vicidial_form.date_of_birth.value + 
    	"&alt_phone=" + document.vicidial_form.alt_phone.value + 
    	"&email=" + document.vicidial_form.email.value + 
    	"&security_phrase=" + document.vicidial_form.security_phrase.value + 
    	"&comments=" + document.vicidial_form.comments.value + 
    	"&user=" + user + 
    	"&pass=" + pass + 
    	"&campaign=" + campaign +
    	"&phone_login=" + phone_login + 
    	"&original_phone_login=" + original_phone_login +
    	"&phone_pass=" + phone_pass + 
    	"&fronter=" + fronter + 
    	"&closer=" + user + 
    	"&group=" + group + 
    	"&channel_group=" + group + 
    	"&SQLdate=" + SQLdate + 
    	"&epoch=" + UnixTime + 
    	"&uniqueid=" + document.vicidial_form.uniqueid.value + 
    	"&customer_zap_channel=" + lastcustchannel + 
    	"&customer_server_ip=" + lastcustserverip +
    	"&server_ip=" + server_ip + 
    // ...еще строчек 30...
    	"&user_custom_five=" + VU_custom_five + '' +
    	"&preset_number_a=" + CalL_XC_a_NuMber + '' +
    	"&preset_number_b=" + CalL_XC_b_NuMber + '' +
    	"&preset_number_c=" + CalL_XC_c_NuMber + '' +
    	"&preset_number_d=" + CalL_XC_d_NuMber + '' +
    	"&preset_number_e=" + CalL_XC_e_NuMber + '' +
    	"&preset_dtmf_a=" + CalL_XC_a_Dtmf + '' +
    	"&preset_dtmf_b=" + CalL_XC_b_Dtmf + '' +
    	webform_session;
    	
    	var regWFspace = new RegExp(" ","ig");
    	web_form_vars = web_form_vars.replace(regWF, '');
    	var regWF = new RegExp("\\`|\\~|\\:|\\;|\\#|\\'|\\\"|\\{|\\}|\\(|\\)|\\*|\\^|\\%|\\$|\\!|\\%|\\r|\\t|\\n","ig");
    	web_form_vars = web_form_vars.replace(regWFspace, '+');
    	web_form_vars = web_form_vars.replace(regWF, '');
    
    	var regWFAvars = new RegExp("\\?","ig");
    	if (VDIC_web_form_address.match(regWFAvars))
    		{web_form_vars = '&' + web_form_vars}
    	else
    		{web_form_vars = '?' + web_form_vars}
    
    	TEMP_VDIC_web_form_address = VDIC_web_form_address + "" + web_form_vars;
    
    	var regWFAqavars = new RegExp("\\?&","ig");
    	var regWFAaavars = new RegExp("&&","ig");
    	TEMP_VDIC_web_form_address = TEMP_VDIC_web_form_address.replace(regWFAqavars, '?');
    	TEMP_VDIC_web_form_address = TEMP_VDIC_web_form_address.replace(regWFAaavars, '&');
    	}

    7ion, 20 Марта 2011

    Комментарии (1)
  11. JavaScript / Говнокод #6037

    +161

    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
    var BrowseWidth = 0;
    	var BrowseHeight = 0;
    
    	function getInsideBrowse() 
    		{
    		var ns = navigator.appName == "Netscape";
    		if (ns) 
    			{
    			BrowseWidth = window.innerWidth;
    			BrowseHeight = window.innerHeight;
    			}
    		else 
    			{
    			BrowseWidth = document.body.clientWidth;
    			BrowseHeight = document.body.clientHeight;
    			}
    		}
    	function browser_dimensions() 
    		{
    		getInsideBrowse();
    
    		document.vicidial_form.JS_browser_width.value = BrowseWidth;
    		document.vicidial_form.JS_browser_height.value = BrowseHeight;
    		}

    7ion, 20 Марта 2011

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