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

    +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
    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
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    95. 95
    <?php
    $month_cols = array("january" => 31,
    	            "february" => 28,
                        "march" => 31,
                        "april" => 30,
                        "may" => 31,
                        "june" => 30,
                        "july" => 31,
                        "august" => 31,
                        "september" => 30,
                        "october" => 31,
                        "november" => 30,
                        "december" => 31);
    
    if($_POST["month_to_change"])
    {
    $month_to = $_POST["month_to_change"];
     for($i = 1; $i <= $month_cols[$_POST["month_to_change"]]; $i++)
     {
      $description = mysql_real_escape_string($_POST["textar_".$i]);
      mysql_query("UPDATE `calender` SET `description` = '$description' WHERE `day` = '$i' AND `month` = '$month_to' LIMIT 1");
     }
    }
    
      echo "<h3>Лунный календарь</h3>";
    
      if($_POST["month_change"])
      {
       if($_POST["month"] == "january") $jan_sel = "selected";
       if($_POST["month"] == "february") $feb_sel = "selected";
       if($_POST["month"] == "march") $mar_sel = "selected";
       if($_POST["month"] == "april") $apr_sel = "selected";
       if($_POST["month"] == "may") $may_sel = "selected";
       if($_POST["month"] == "june") $jun_sel = "selected";
       if($_POST["month"] == "july") $jul_sel = "selected";
       if($_POST["month"] == "august") $aug_sel = "selected";
       if($_POST["month"] == "september") $sep_sel = "selected";
       if($_POST["month"] == "october") $oct_sel = "selected";
       if($_POST["month"] == "november") $nov_sel = "selected";
       if($_POST["month"] == "december") $dec_sel = "selected";
      }
      else
      {
       $jan_sel = "selected";
      }
    
      $changing_month = $_POST["month"];
      if($changing_month == "") $changing_month = "january";
    
      echo "<table>\n";
      echo "<tr><td>\n";
      echo "<form name=\"form_name\" id=\"form_id\" action=\"\" method=\"post\">\n";
      echo "<select name=\"month\" onChange=\"this.form.submit()\">\n
      	<option value=\"january\" $jan_sel>Январь</option>\n
    	<option value=\"february\" $feb_sel>Февраль</option>\n
            <option value=\"march\" $mar_sel>Март</option>\n
            <option value=\"april\" $apr_sel>Апрель</option>\n
            <option value=\"may\" $may_sel>Май</option>\n
            <option value=\"june\" $jun_sel>Июнь</option>\n
            <option value=\"july\" $jul_sel>Июль</option>\n
            <option value=\"august\" $aug_sel>Август</option>\n
            <option value=\"september\" $sep_sel>Сентябрь</option>\n
            <option value=\"october\" $oct_sel>Октябрь</option>\n
            <option value=\"november\" $nov_sel>Ноябрь</option>\n
            <option value=\"december\" $dec_sel>Декабрь</option>\n
            </select>\n";
      echo "<input type=\"hidden\" name=\"month_change\" value=\"change\">\n";
      echo "</td></tr>\n";
    
      for($i = 1; $i <= $month_cols[$changing_month]; $i++)
      {
    
      $q_q2 = mysql_query("SELECT `description` FROM `calender` WHERE `day` = '$i' AND `month` = '$changing_month' LIMIT 1");
    
      $descr = mysql_fetch_row($q_q2);
    
       echo "<tr valign=\"top\" cols=\"5\">
              <td><b>$i</b></td>
              <td>
              <textarea name=\"textar_$i\">".$descr[0]."</textarea>
              </td>
    </tr>\n";
      }
    
      echo "<tr>
             <td colspan=\"2\" align=\"right\">
             <input type=\"submit\" value=\"Сохранить\">
             </td>
    </tr>\n";
    
      echo "<input type=\"hidden\" name=\"month_to_change\" value=\"$changing_month\">\n";
    
      echo "</form>";
      echo "</table>";
    ?>

    А это уже часть, которая апдейтит базу :-)

    varg242, 22 Января 2011

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

    +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
    <?php
    
    $ident = mysql_connect("localhost", "root", "");
    mysql_select_db("database");
    
    $month_cols = array("january" => 31,
    	            "february" => 28,
                        "march" => 31,
                        "april" => 30,
                        "may" => 31,
                        "june" => 30,
                        "july" => 31,
                        "august" => 31,
                        "september" => 30,
                        "october" => 31,
                        "november" => 30,
                        "december" => 31);
    
    foreach($month_cols as $key => $value)
    {
     for($i = 1; $i <= $value; $i++)
     {
      mysql_query("INSERT INTO `calender` SET `day` = '$i', `month` = '$key'");
     }
    }
    
    mysql_close($ident);
    
    ?>

    Недавнее творение.
    Нужно было создать базу данных, которая потом будет апдейтиться.

    varg242, 22 Января 2011

    Комментарии (13)
  3. Куча / Говнокод #5350

    +155

    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
    Добровольно сдаю ботнет, разбираем ники:
    realbugmenot
    realbugmenot1
    realbugmenot2
    realbugmenot3
    realbugmenot4
    realbugmenot5
    realbugmenot6
    realbugmenot7
    realbugmenot8
    bugmenot10
    bugmenot11
    bugmenot12
    bugmenot13
    bugmenot14
    bugmenot15
    
    у всех пароли 12345

    Зы: петушок московский нашёл работу в сингапуре?

    bugmenot15, 22 Января 2011

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

    +168

    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
    private function infernal($logic){
    		$logic = str_split($logic);
    		while(!empty($logic)){
    			foreach($logic as $char){
    				$char = str_split($char);
    				while(!empty($char)){
    					foreach($char as $char2){
    						if($char2!="0") unset($char);
    						$this->check($char, $char2);
    					}
    				}
    			}
    		}
    	return $logic;
    }

    похоже что писал на больную голову

    XyHb, 22 Января 2011

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

    +133

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    /* тыц */
    /*wbr:after { content: '\00200B'; }*/
    /* they say it's better */
    wbr {
      width: 0px;
      display: inline-block;
      overflow: hidden;
    }

    Вконтакте.
    http://vkontakte.ru/css/rustyle.css?104
    Привет тем, кто сказал Пашке Дурову, что костыль - это не очень хорошо.

    7ion, 21 Января 2011

    Комментарии (20)
  6. C# / Говнокод #5347

    +133

    1. 1
    2. 2
    3. 3
    4. 4
    int type = int.Parse(r.Cells[3].Value.ToString());
    if (type == 1 || type == 3 || type == 5 || type == 6 || type == 7) type--;
    else if (type == 4) type = 2;
    else if (type == 666) type = 3;

    Парсим данные из XLS-файла.

    Kirinyale, 21 Января 2011

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

    +79

    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
    String [] itemmas = item.split("~");
    
    String start = "";
    String end = "";
    String task = "";
    String project = "";
    String wtype = "";
    String desc = "";
    try{
       start = itemmas[0];
    }catch (Exception e){}
    try{
       end = itemmas[1];
    }catch (Exception e){}
    try{
       task = itemmas[2];
    }catch (Exception e){}
    try{
       project = itemmas[3];
    }catch (Exception e){}
    try{
       wtype = itemmas[4];
    }catch (Exception e){}
    try{
       desc = itemmas[5];
    }catch (Exception e){}
    
    if(start==null||start.equals("null")){start="";};
    if(end==null||end.equals("null")){end="";};
    if(task==null||task.equals("null")){task="";};
    if(project==null||project.equals("null")){project="";};
    if(wtype==null||wtype.equals("null")){wtype="";};
    if(desc==null||desc.equals("null")){desc="";};

    gorsash, 21 Января 2011

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

    +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
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    if(!isset($_SESSION['captcha'])) $error = "Please Enable Cookies";
        else {
            $name = $_POST["name"];
            $msg = $_POST["msg"];
            if(strlen($msg) <= 2)
            {   $error = "слишком маленькое сообщение";   }
            else if($_POST["captcha"] !== $_SESSION["captcha"])
            {   $error = "символы не введено не верно";   }
            else if(strlen($name) > 25)
            {   $error = "слишком длиное имя"; }
            else if(strlen($msg) > 256)
            {   $error = "слишком длиное сообщение"; }
            else if(strlen($name) > 25 && strlen($msg) >256)
            {   $error = "слишком длинное имя и сообщение";  }
            else if(strlen($name) <= 25 && strlen($msg) <=256)
            {
                    $msg = str_value($msg);
                    if($msg == "") $error = "введите сообщение";
                    else {
                        write_file($name,$msg);
                        $d2d_1 = mktime(0,0,0,1,1,2037);
                        setcookie('nameData',$name,$d2d);
                        $error = "";
                    }
                }
            }
        }

    сперто из гостевой книги

    skylex_hacker, 21 Января 2011

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

    +169

    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 razbstrok($text)
    {
    $nomer1=0;
    $stroki = array();
    	$nomer1 = strpos($text, ".", $nomer1+1);
    	while($nomer1!=false)
    	{
    		$stroki[count($stroki)]=substr($text, 0, $nomer1);
    		$text = substr($text, $nomer1+1, strlen($text)-1-$nomer1);
    		$nomer1 = strpos($text, ".", $nomer1+1);
    	}
    	$i=1;
    	$i=0;
    	while($i<count($stroki))
    	{
    	if($stroki[$i]=="")
    		{
    		$stroki[$i]=NULL; //убрать пустые клетки
    		}
    	$i=$i+1;
    	}
    	return $stroki;
    }
    
    ...
    
    $i=0;
    while($i<count(razbstrok($_GET["razdeliteli"])))
    {
    //echo(razbstrok($_GET["razdeliteli"])[$i]);
    $stroki = razbstrok($_GET["razdeliteli"]);
    echo($stroki[$i]);
    $i=$i+1;
    echo('<br>');
    }

    explode? Нет, не слышал.

    basename, 21 Января 2011

    Комментарии (33)
  10. Java / Говнокод #5343

    +97

    1. 1
    2. 2
    3. 3
    if (stage < 4 || stage > 4) {
    	loadWizard();
    }

    ситуации или-или (с)

    squaremas, 21 Января 2011

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