1. PHP / Говнокод #1243

    +140.3

    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
    if (isset($aCart['color_caption'])) {
        if (!isset($aCart['color_name']) && isset($aCart['color_caption'])) {
            $aInsert['color_name']    = $aCart[$i]['color_caption'];
            $aInsert['color_caption'] = $aCart[$i]['color_caption'];
        }
        elseif (isset($aCart['color_name']) && !isset($aCart['color_caption'])) {
            $aInsert['color_name']    = $aCart[$i]['color_name'];
            $aInsert['color_caption'] = $aCart[$i]['color_name'];
        }
        elseif (!isset($aCart['color_name']) && !isset($aCart['color_caption'])) {
            $aInsert['color_name']    = 'N/A';
            $aInsert['color_caption'] = 'N/A';
        }
        else {
            $aInsert['color_name']    = $aCart['color_caption'];
            $aInsert['color_caption'] = $aCart['color_name'];
        }
    }

    Чем была забита моя голова не известно. Как я такую логику придумал?!

    guest, 24 Июня 2009

    Комментарии (0)
  2. C++ / Говнокод #1242

    +19.1

    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
    int GetControlImplementationsCount()
    {
    	//return 17;
    	return 18;
    }
    
    CControlImplementation* GetControlImplementation(int index)
    {
    	switch (index)
    	{
    	case 0: return new CButtonImp();
    	case 1: return new CFormImp();
    	case 2: return new CLabelImp();
    	case 3: return new CHorizontalAlignment();
    	case 4: return new CVerticalAlignment();
    	case 5: return new CMouseButton();
    	case 6: return new CActionEvent();
    	case 7: return new CMouseEvent();
    	case 8: return new CWindowEvent();
    	case 9: return new CCheckBoxImp();
    	case 10: return new CComboBoxImp();
    	case 11: return new CListBoxImp();
    	case 12: return new CRadioButtonImp();
    	case 13: return new CTextBoxImp();
    	case 14: return new CItemEvent();
    	case 15: return new CTextEvent();
    	case 16: return new CButtonGroupImp();
    	case 17: return new DialogImpl();
    	}
    
    	return NULL;
    }

    вот так кладут в ДВО РАН.

    guest, 23 Июня 2009

    Комментарии (10)
  3. SQL / Говнокод #1241

    −861.8

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    select
    	....
    	if(n.Pinned=1,concat(n.Name,' <img src=/images/icons/897634.gif>'),n.Name) as Name
    from
    	news n
    	left outer join ....
    	.....
    where
    	....

    Как вам html-верстка в sql запросах?

    guest, 23 Июня 2009

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

    +140.1

    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
    function parce($string)
    
    
    
    {//function open
    $breaktags=array ("<"," ","=","","т");
       
       for ($pos=0;$pos<strlen($string);$pos++)
       {//for text
         
         if (substr($string,$pos,1)=="{" and substr($string,$pos+1,1)=="%")
    		{// if open symbols finded
    		   $tagopened=1;
    		   while($tagopened==1){//while opened
    			   for($inpos=$pos+2;$inpos<10000;$inpos++){// =)
    				   if ( (substr($string,$inpos,1)=="%" and substr($string,$inpos+1,1)=="}") or in_array(substr($string,$inpos,1),$breaktags)) {break 2;$tagopened=0;}//br
    				   $intag=$intag.substr($string,$inpos,1);
    		   }//for inpos
    		}//while opened closing
    		$intag=explode("->",$intag,2);
    		echo("$intag[0] with $intag[1] action!<br>");
    		unset($intag);
    				} else {//if symbols finded
    					$symbol=substr($string,$pos,1);
    					echo("$symbol");
    				}
    				
       }//for all text closing
       
    }//function end;

    guest, 23 Июня 2009

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

    +147

    1. 1
    2. 2
    3. 3
    <?php
       if ($_SESSION['gde'] != 'tut') {exit();}
    ?>

    Ты не тут? Выйди!

    guest, 22 Июня 2009

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

    +92

    1. 1
    2. 2
    3. 3
    header('Location: '.$_SERVER['REQUEST_URI']);
    exit();
    die();

    на всякий случай :)

    guest, 21 Июня 2009

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

    +143

    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
    if ($pagefir){ // тута мы выдаём списог всех аэродромов данного РЦ нахуй 
    				$icao = sql("SELECT * FROM airport WHERE fir='".$pagefir."' order by ikao desc");
    				echo '
    				<h3>Recent articles</h3>
    				<p>';
    
    				while ($airport = mysql_fetch_array($icao))
    					{
    					echo '<a href="airport.php?icao='.$airport[ikao].'"><img src="images/strelica2.gif" width="3px" height="5px" alt="" />'.$airport[name].'('.$airport[town].')</a>';		
    					}
    
    				echo '<a href="#"><img src="images/strelica2.gif" width="3px" height="5px" alt="" /> URRR Ростов (г. Ростов-на-Дону)</a>
    
    				</p>';}

    восемь

    guest, 21 Июня 2009

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

    +147

    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
    function sql($query){
    	/* Переменные для соединения с базой данных */ 
    	$hostname = "localhost"; 
    	$username = "modx"; 
    	$password = "22222"; 
    	$dbName = "modx"; 
    	/* создать соединение */ 
    	mysql_connect($hostname,$username,$password) OR DIE("Не могу создать соединение "); 
    	/* выбрать базу данных. Если произойдет ошибка - вывести ее */ 
    	mysql_select_db($dbName) or die(mysql_error());  
    	$res = mysql_query($query);
    	mysql_close(); 
    
    }

    восемь

    guest, 21 Июня 2009

    Комментарии (3)
  9. Java / Говнокод #1234

    +63.4

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    case PLUG_ACTION_GET_MESSAGE: {
    	msgIn++;
    	//при входящем плюсует еще и к исходящим, недоработка движка?
    	msgOut--;
    }
    			
    case PLUG_ACTION_SEND_MESSAGE: {
    	msgOut++;
    }

    guest, 21 Июня 2009

    Комментарии (9)
  10. VisualBasic / Говнокод #1233

    −82

    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
    <%
    ' Set your settings
        strFileURL = "http://www.youtube.com/"
     
    ' Fetch the file
        Set objXMLHTTP = CreateObject("MSXML2.XMLHTTP")
     
        objXMLHTTP.open "GET", strFileURL, false
        objXMLHTTP.send()
     
        If objXMLHTTP.Status = 200 Then
    	  Response.write(objXMLHTTP.ResponseBody)
        End if
     
        Set objXMLHTTP = Nothing
    %>

    guest, 20 Июня 2009

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