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

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

    +137.5

    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
    function get($id,$lang_id)
         {
           // начнем транзакцию
           $bresult=ConnectionManager::begin();
           if (!$bresult)
            {
              ConnectionManager::rollback();
              return false;
            }
           $result=$this->db_main->getTPLRow(QUERY_ADMIN_CELLMETHOD_GET, array('id'=>$id,'lang_id'=>$lang_id));
           if (!is_array($result))
            {
              ConnectionManager::rollback();
              return false;
            }
           /*$operators=$this->db_main->getTPLData(QUERY_ADMIN_CELLMETHOD_OPETATORS_GET, array('id'=>$id));
           if (!is_array($operators))
            {
              ConnectionManager::rollback();
              return false;
            }
           $result['operator'] = $operators;*/
           // закончим транзакцию
           $cresult=ConnectionManager::commit();
           if (!$cresult)
            {
              ConnectionManager::rollback();
              return false;
            }
           if (count($result))
            return $result;
           else
            return true;
         }

    Метод получает данные из таблицы. getTPLRow делает выборку из таблицы, обратите внимание, что при этом делается begin, commit и rollback

    guest, 16 Апреля 2009

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

    −140

    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
    Public Function fRoundSumma(pDbl As Double) As Double
     On Error Resume Next
     Dim vStrSum As String
     If vFieldRoundSummuDoInt Then
        vStrSum = str(pDbl)
         If InStr(1, vStrSum, ".5") > 0 Then
            If pDbl < 0 Then
               fRoundSumma = Abs(Fix(pDbl)) + 1
               fRoundSumma = fRoundSumma * (-1)
              Else
               fRoundSumma = Fix(pDbl) + 1
            End If
           Else
            fRoundSumma = Round(pDbl, 0)
         End If
       Else
        fRoundSumma = Round(pDbl, vFieldRoundDo)
     End If
    End Function

    Такое забавное округление. Из коммерческого проекта :)

    guest, 15 Апреля 2009

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

    +83.5

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    ret = (func(a, b) == SpecNumber) ? true : false;
        if (! ret)
        {
            ShowError ("Some message", a, b));
        }

    Обратить внимание на хитрость получения значения ret, а потом как его используют :)

    guest, 15 Апреля 2009

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

    +140

    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
    <table width="100%" border="0" cellspacing="0" cellpadding="1" id="gmtbl2" class="gmtbl">
    	<tbody>
    		<tr>
    			<td colspan="3" width="100%">
    				<table width="100%" cellspacing="0" cellpadding="0">
    					<tbody>
    						<tr>
    							<td colspan="3" width="100%" height="20" id="gmtdttl" class="gmtdttl"><B><A href="http://www.gismeteo.RU/towns/27760.htm" id="tgmtdttl" class="gmtdttl" target="_blank">Саранск</A></B></td>
    						</tr>
    					</tbody>
    				</table>
    			</td>
    		</tr>
    		<tr>
    			<td width="40%" id="gmtdtext0" class="gmtdtext" align="left">Пн, ночь</td>
    			<td width="40%" id="tgmtdtext0" class="gmtdtext" align="center">0..-2 °C
    			<td width="20%" align="center"><IMG src="http://informer.gismeteo.ru/html/images/sm/1n.gif" width="26" height="26" alt="Малооблачно" title="Малооблачно"></td><tr><td width="40%" id="gmtdtext1" class="gmtdtext" align="left">   Пн, утро</td><td width="40%" id="tgmtdtext1" class="gmtdtext" align="center">+4..+6 °C<td width="20%" align="center"><IMG src="http://informer.gismeteo.ru/html/images/sm/2.gif" width="26" height="26" alt="Облачно" title="Облачно"></td><tr><td width="40%" id="gmtdtext2" class="gmtdtext" align="left">   Пн, день</td><td width="40%" id="tgmtdtext2" class="gmtdtext" align="center">+10..+12 °C<td width="20%" align="center"><IMG src="http://informer.gismeteo.ru/html/images/sm/3.gif" width="26" height="26" alt="Пасмурно" title="Пасмурно"></td><tr><td width="40%" id="gmtdtext3" class="gmtdtext" align="left">   Пн, вечер</td><td width="40%" id="tgmtdtext3" class="gmtdtext" align="center">+4..+6 °C<td width="20%" align="center"><IMG src="http://informer.gismeteo.ru/html/images/sm/3n.gif" width="26" height="26" alt="Пасмурно" title="Пасмурно"></td>
    			<tr>
    				<td colspan="3" align="center">
    					<table border="0" cellspacing="0" cellpadding="0">
    						<tbody>
    							<tr>
    								<td align="right" height="20"><IMG src="http://informer.gismeteo.ru/html/images/logo.gif" width="13" height="20" alt="/"></td>
    								<td align="left"><A href="http://www.gismeteo.RU" id="lgmtdtext" class="gmtdtext" target="_blank">GISMETEO.RU</A></td>
    							</tr>
    						</tbody>
    					</table>
    				</td>
    			</tr>
    			<tr>
    			<td heigth="5" colspan="3"></td>
    		</tr>
    	</tbody>
    </table>

    html информера, который возвращает js, генерируемый на сайте gismeteo.ru.

    guest, 13 Апреля 2009

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

    +145.6

    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
    function getCategories($id, $prefix, &$dl, $extra = '', $sc = '')
    	{
    		$dbextra = (!empty($extra)) ? " AND Id = '$extra'" : "";
    
    //		$query = $GLOBALS['db']->Query("SELECT * FROM " . PREFIX . "_modul_shop_kategorie WHERE Elter = '$id'$dbextra ORDER BY Rang ASC");
    //		if (!$query->numrows()) return;
    //
    //		$num = $query->numrows();
    
        if (isset($_SESSION['Shop']['Categories'][$id]) && $_SESSION['Shop']['Categories'][$id] === false) {
          return;
        }
    
        if (isset($_SESSION['Shop']['Categories'][$id]) && $_SESSION['Shop']['Categories'][$id] != '') {
        } else {
      		$sql = $GLOBALS['db']->Query("SELECT * FROM " . PREFIX . "_modul_shop_kategorie WHERE Elter = '$id' ORDER BY Rang ASC");
         	if (!$sql->numrows()) {
        		$_SESSION['Shop']['Categories'][$id] = false;
        		$sql->close();
         	  return;
         	}
    
          while ($row = $sql->FetchRow()) {
            $_SESSION['Shop']['Categories'][$id][$row->Id] = $row;
          }
      		$sql->close();
        }
    
        if (!empty($extra)) {
          @$Items = $_SESSION['Shop']['Categories'][$id][$extra];
        } else {
          @$Items = $_SESSION['Shop']['Categories'][$id];
        }
    //    if (!is_array($Items)) return;
    
    //		while ($item = $query->fetchrow()) {
        foreach ($Items as $item) {
    			$item->ntr = "";
    			$item->visible_title = $prefix . '' . $item->KatName;
    			$item->sub = ($item->Elter == 0) ? 0 : 1;
    
    			$item->dyn_link = "index.php?module=shop&categ=$item->Id&parent=$item->Elter&navop=" . (($item->sub==0) ? $item->Id : getParentShopcateg($item->Elter));
    			$item->dyn_link = $this->shopRewrite($item->dyn_link);
    
    			if($item->Elter == 0) $item->ntr = 1;
    
    			$mdl = array();
    ////////////////////////////////////////Рекурсия////////////////////
    			$this->getCategories($item->Id, $prefix, $mdl, $extra, $sc);
    			$item->sub = $mdl;
    			array_push($dl, $item);
    		}
    
    		return $dl;
    	}

    Часть модуля магазина в AVE CMS бывшей CP Engine
    вся соль заключается в грусном использовании сессии не поназначению с целью уменьшить количество запросов к базе данныз

    guest, 10 Апреля 2009

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

    +148

    1. 1
    <!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">

    JasperReports - говёная тулза для геренации отчётов в Java.

    Основное достоинство - бесплатность и открытость исходного кода.
    Главный минус - XML-шаблоны для отчётов.

    guest, 08 Апреля 2009

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

    +140

    1. 1
    2. 2
    3. 3
    <?
    echo "Заебись!";
    ?>

    сделать заебись

    guest, 08 Апреля 2009

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

    +148

    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
    <title>Under Construction</title>
    <html>
    <td align=center>
    	<img src="Under-Construction.gif" 
    		style="
    			display: block;
    			width: 550;
    			margin-left: auto;
    			margin-right: auto
    	
    " />
    </td>
    </html>

    HTML 5.0 + CSS 3.0

    guest, 07 Апреля 2009

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

    +151

    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
    # Безлимит со статических адресов
    ### здесь с адресов 192.168.0.0/24 пускает только в сеть 10.x.x.x, но не в интернет.
    ### при задании четко route add x.x.x.x gw 10.254.254.254, то на этот x.x.x.x ходит нормально, а дальше нини...
    iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth2 -j SNAT --to-source 10.x.x.x
    
    # Лимит с адресов полученных при подключении к pptpd
    ### здесь вообще все нормально, все кто подключаются к pptpd ходят в интернет по правильному ипу.
    iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -o eth1 -j SNAT --to-source 212.x.x.x
    
    # результат route
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    192.168.1.50    *               255.255.255.255 UH    0      0        0 ppp0
    ### здесь все клиента pptpd...
    212.x.x.x       *               255.255.255.224 U     0      0        0 eth1
    192.168.0.0     *               255.255.255.0   U     0      0        0 eth0
    10.0.0.0        *               255.0.0.0       U     0      0        0 eth2
    default         212.x.x.x       0.0.0.0         UG    0      0        0 eth1
    default         10.x.x.x        0.0.0.0         UG    1      0        0 eth2

    iptables

    guest, 07 Апреля 2009

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

    +156.4

    1. 1
    include ("/home/powerbo1/public_html/_templates-new/_page.php?userid=" . $_POST["userid"] . "&page=" . $_POST["page"] . "&url=" . $_POST["url"] . "&home=" . $_POST["home"] . "&location=" . $_POST["location"] . "&domain=" . $_POST["domain"] . "");?>

    guest, 05 Апреля 2009

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