1. Список говнокодов пользователя Rubaka

    Всего: 5

  2. PHP / Говнокод #8072

    +160

    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
    $durationArr=array(
    								  		  "1" => '1 week',
    										  "2" => '2 weeks',
    										  "3" => '3 weeks',
    										  "4" => '4 weeks',
    										  "5" => '6 weeks',
    										  "6" => '2 months',
    										  "7" => '3 months',
    										  "8" => '4 months',
    										  "9" => '5 months',
    										  "10" => '6 months',
    										  "11" => '9 months',
    										  "12" => '12 months'
    										  );
    		
    						$durnumber=$_POST['ctrlCompareSearchFrame:lstDuration'];
    						foreach ($durationArr as $fild=>$key){
    							if ($fild==$durnumber) echo $key;
    						}

    вот такая вот проверка на существование ключа!array_key_exists не для нас!

    Rubaka, 03 Октября 2011

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

    +162

    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
    if (is_dir($mainDir))
    {
    	if ($dh = opendir($mainDir))
    		{
    		    while (($file = readdir($dh)) !== false)
    			{
    				if ( ($file!='.') && ($file!='..') ) $regions.=$file.',';
    			}
    			closedir($dh);
    		}
    }
    $regions = substr($regions, 0, -1);
    $arrRegions = explode(",", $regions);

    сразу пихать в массив файлы не судьба! надо изврат с строками

    Rubaka, 26 Сентября 2011

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

    +166

    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
    <select name="ctrlCompareSearchFrame:lstDuration" id="ctrlCompareSearchFrame_lstDuration" class="inputStyle">
    			<option <?php save_dur(1);?>value="1">1 week</option>
    			<option <?php save_dur(2);?>value="2">2 weeks</option>
    			<option <?php save_dur(3);?>value="3">3 weeks</option>
    			<option <?php save_dur(4);?>value="4">4 weeks</option>
    			<option <?php save_dur(5);?>value="5">6 weeks</option>
    			<option <?php save_dur(6);?>value="6">2 months</option>
    			<option <?php save_dur(7);?>value="7">3 months</option>
    			<option <?php save_dur(8);?>value="8">4 months</option>
    			<option <?php save_dur(9);?>value="9">5 months</option>
    			<option <?php save_dur(10);?>value="10">6 months</option>
    			<option <?php save_dur(11);?>value="11">9 months</option>
    			<option <?php save_dur(12);?>value="12">12 months</option>
    		</select>

    "зачем мне цикл ,если платят за обьем кода" думал программер

    Rubaka, 20 Сентября 2011

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

    +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
    function Parsing($raw)
    {
    
    	$RawProperty=array();
    	$Property=array();
    	$raw=str_ireplace("\n","",$raw);
    	$raw=str_replace("\r","<br/>",$raw);
    
    	preg_match_all("|<Policy>(.*)</Policy>|U",$raw,$RawProperty,PREG_OFFSET_CAPTURE);
    //print_r($RawProperty);
    	for ($k=0;$k<count($RawProperty[0]);$k++){
    
    		$Property[$k]['Insurer']=str_cut_btw_substrs("<InsurerLogoURL>","</InsurerLogoURL>",$RawProperty[0][$k][0]);
    		$Property[$k]['InsurerName']=str_cut_btw_substrs("<InsurerName>","</InsurerName>",$RawProperty[0][$k][0]);
    		$Property[$k]['Underwriter']=str_cut_btw_substrs("<UnderwriterName>","</UnderwriterName>",$RawProperty[0][$k][0]);
    		$Property[$k]['LinkURL']=str_cut_btw_substrs("<LinkURL>","</LinkURL>",$RawProperty[0][$k][0]);
    		$Property[$k]['Productname']=str_cut_btw_substrs("<ProductName>","</ProductName>",$RawProperty[0][$k][0]);
    		$Property[$k]['PremiumText']=str_cut_btw_substrs("<PremiumText>","</PremiumText>",$RawProperty[0][$k][0]);
    		$Property[$k]['PremiumEXText']=str_cut_btw_substrs("<PremiumEXText>","</PremiumEXText>",$RawProperty[0][$k][0]);
    		$Property[$k]['ExcessText']=str_cut_btw_substrs("<ExcessText>","</ExcessText>",$RawProperty[0][$k][0]);
    		$Property[$k]['LuggageText']=str_cut_btw_substrs("<LuggageText>","</LuggageText>",$RawProperty[0][$k][0]);
    		$Property[$k]['MedicalText']=str_cut_btw_substrs("<MedicalText>","</MedicalText>",$RawProperty[0][$k][0]);
    		$Property[$k]['CancelationText']=str_cut_btw_substrs("<CancelationText>","</CancelationText>",$RawProperty[0][$k][0]);
    		$Property[$k]['LiabilityText']=str_cut_btw_substrs("<LiabilityText>","</LiabilityText>",$RawProperty[0][$k][0]);
    		$Property[$k]['AdditionalFeatures']=str_cut_btw_substrs("<AdditionalFeatures>","</AdditionalFeatures>",$RawProperty[0][$k][0]);
    
    		//add fields "ExplanationText" and "IsShaded"
    		$Property[$k]['IsShaded']=str_cut_btw_substrs("<IsShaded>","</IsShaded>",$RawProperty[0][$k][0]);
    		$Property[$k]['ExplanationText']=str_cut_btw_substrs("<ExplanationText>","</ExplanationText>",$RawProperty[0][$k][0]);
    		$Property[$k]['IsBasicCover']=str_cut_btw_substrs("<IsBasicCover>","</IsBasicCover>",$RawProperty[0][$k][0]);
    		$Property[$k]['IsComprCover']=str_cut_btw_substrs("<IsComprCover>","</IsComprCover>",$RawProperty[0][$k][0]);
    
    								}
    	return $Property;
    }

    разбор xml ответа от сервера

    Rubaka, 20 Сентября 2011

    Комментарии (16)
  6. Куча / Говнокод #7909

    +128

    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
    <th style='border-left: 1px solid #97cbee;'>Premium<br />without<br />excess<span><img src='Artog/Images/empty/empty.gif' /></span>
    					<div style='position: relative; top: 0'>
    						<IMG class='str3' width='16' heigth='16' title='The excess can be removed from some plans in return for a higher premium.<br/>You can select this option when purchasing the plan from the insurer.' src="Artog/Images/Icons/InfoIcon28x28.png" />
    					</div>
    				</th>
    				<th style='border-left: 1px solid #97cbee'>Luggage/<br />Personal<br />effects<span><img src='Artog/Images/empty/empty.gif' /></span>
    					<div style='position: relative'>
    						<IMG class='str3' width='16' heigth='16' title='Coverage on luggage (typically important for people with a lot of good quality travel gear)' src="Artog/Images/Icons/InfoIcon28x28.png" />
    					</div>
    				</th>
    				<th style='border-left: 1px solid #97cbee'>Medical<br />expenses<span><img src='Artog/Images/empty/empty.gif' /></span>
    					<div style='position: relative'>
    						<IMG class='str2' width='16' heigth='16' title='How much will be contributed to any doctor's bills, emergency surgery etc. (for obvious reasons this is generally important for all travelers)' src="Artog/Images/Icons/InfoIcon28x28.png" />
    					</div>
    				</th>
    				<th style='border-left: 1px solid #97cbee'>Cancellation<br />costs<span><img src='Artog/Images/empty/empty.gif' /></span>
    					<div style='position: relative'>
    						<IMG class='str2' width='16' heigth='16' title='How much will be paid from inconvenience due to cancellation of flights etc. (typically important for people with a complex itinerary)' src="Artog/Images/Icons/InfoIcon28x28.png" />
    					</div>
    				</th>

    разбираю тут 1 проект
    <th style='border-left: 1px solid #97cbee'> <---------- индусы не знают ,что такое класс в css

    Rubaka, 20 Сентября 2011

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