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

    +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
    <?php
    $message_file = file("engine/quest.csv");
    foreach($message_file as $line)
    {
    $elem = explode(";",$line);
    echo("<tr>
    <td align=center valign=top colspan=2><b>Имя :</b> $elem[1] ( <b>$elem[2]</b> )</td>
    </tr>
    <tr>
    <td align=center valign=top width=50%><b>E-mail :</b> <a href=mailto:$elem[3] target=_blank>$elem[3]</a></td>
    <td align=center valign=top width=50%><b>Сайт :</b> <a href=$elem[4] target=_blank>$elem[4]</a></td>
    </tr>
    <tr>
    <td valign=top colspan=2><div style=margin-left:20px; ><b>Вопрос </b>№ ($elem[0]) $elem[5]</div></td>
    </tr>
    <tr>
    <td align=right valign=top colspan=2><small>Написано : $elem[6]</small></td>
    </tr>
    <tr>
    <td bgcolor=#E0F1F7 valign=top colspan=2 ><div style=margin-left:20px;><b><font color=red>$elem[7]</font></b></div></td>
    </tr>
    <tr>
    <td valign=top colspan=2 >&nbsp;</td>
    </tr>");
    }
    echo("</table>");

    qbasic, 01 Февраля 2011

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

    +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
    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
    <?php
    session_start();
    /**
     * @author motakuji
     * @copyright 2009
     */
     if (!$_SESSION['otvet']) {
            $_SESSION['rand']=rand(1,10);
            $_SESSION['otvet']=true;
             }
     if (isset($_POST['vvod']))
     {
     if ($_POST['vvod']>$_SESSION['rand']){
            $msg="Ваше число больше";
     }
     
     elseif ($_POST['vvod']<$_SESSION['rand']){
            $msg="Ваше число меньше";
     }
     else {
            $msg="Ура!!!Вы угадали!";
            $_SESSION['otvet']=false;
     }
    }
    else $msg='Введите число от 1 до 10';
    ?>
    <html>
    <title>Game</title>
    <head>
    <center>
    <h2> <?=$msg."<br>"; ?> </h2>
    <form method="post" action="<?=$_SERVER['SCRIPT_NAME']?>">
     
    <input type="text" name="vvod" />
    <input type="submit" value="Угадать" />
     
    </form>
    </center>
    </body>
    </html>

    qbasic, 01 Февраля 2011

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

    +121

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    public static T FirstOrDefault<T>(IEnumerable<T> it)
    {
       foreach (T v in it)
         return v;
       return default(T);
    }

    Самодельный FirstOrDefault.

    Боюсь даже представить, как у автора будет выглядеть Single

    bober_maniac, 31 Января 2011

    Комментарии (3)
  4. C# / Говнокод #5465

    +118

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    public static void Clear(string[] array)
            {
                int n = default(int);
                Array.ForEach(array, element => array[n++] = String.Empty);
            }

    Смешались в кучу кони, люди...

    bober_maniac, 31 Января 2011

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

    +164

    1. 1
    2. 2
    3. 3
    4. 4
    {php}
        header('Content-type: text/html; charset=utf-8');
        $this->assign('host', $_SERVER['HTTP_HOST']);
    {/php}

    Увидел в проекте доставшемся по наследству и сел на пятую точку. Феерический гк

    wmmorgun, 31 Января 2011

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

    −102

    1. 1
    2. 2
    3. 3
    4. 4
    if( !mainLoop() == true )
    {
        return null;
    }

    Красота, нашлось в проекте от прежних разработчиков

    Werdn, 31 Января 2011

    Комментарии (3)
  7. C++ / Говнокод #5462

    +165

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    QTime time;
        time.start();
    
        for (int i = 0; i < 100; ) {
            if (time.elapsed() > 10) {
                time.start();
                ++i;
            }
        }

    Организация задержки.

    jalil, 31 Января 2011

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

    +83

    1. 1
    2. 2
    3. 3
    private double calculateValue( int number, int rate ) {
        return Math.pow( number, rate );
    }

    galak, 31 Января 2011

    Комментарии (12)
  9. Си / Говнокод #5460

    +126

    1. 1
    #define sqr(o) ((o)*(o))

    zagzag, 31 Января 2011

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

    +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
    public function DateConvertDb($value=0){
    		if(strlen($value)<1){return false;}
    		$time = explode(' ',$value);
    		$date = $time[1];
    		$year  = $time[2];
    		for($i=1;$i<13;$i++)
    		{
    			if($this->montharray[$i]==$time[0]){$month=$i;}
    		}
    		$date=str_replace(',',' ',$date);
    		$year=trim($year); $month=trim($month); $date=trim($date);
    		if($month<10){$month="0".$month;}
    		if($date<10){$date="0".$date;}
    		return $year."-".$month."-".$date;
           
    	}

    Парсинг даты перед сохранением в БД.

    zxm, 31 Января 2011

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