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

    +142

    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
    <?php
    
    /* 
     * To change this license header, choose License Headers in Project Properties.
     * To change this template file, choose Tools | Templates
     * and open the template in the editor.
     */
    session_start();
    require "db.php";
    $id = $_GET["id"];
    pagedel($id);
    header ("location: index.php");
    
    function pagedel($id){    // функция удаления страниц
        $sql = "DELETE FROM mesage WHERE id=$id";
        mysql_query($sql) or die (mysql_error());
    }
    
    ?>

    не работает фукция удаления строки

    radiomonter, 11 Мая 2015

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

    +141

    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
    <?php 
     
    require_once 'db.php';
     error_reporting(E_ALL);
    //полученный масиф (B!) на предыдущей страницы методом Post
    $first_name = filter_input(INPUT_POST, 'first_name');
    $email = filter_input(INPUT_POST, 'email');
    $phone = filter_input(INPUT_POST, 'phone');//PHONE BLYAD
    $text = filter_input(INPUT_POST, 'text');
    $date = date("Y-m-d H:i:s");
    //Теперь сделаем запрос к базе, который внесет наши данные в таблицу:
    $query = $dblink->prepare("INSERT INTO `claims` (`date`,`first_name`, `email`, `phone`, `text`) VALUES (?, ?, ?, ?,?);");
    $result = $query->execute (array($date, $first_name, $email, $phone, $text));//MAYBE IT'S CAN RAISE PDOException, see more in documentation
     
    //Если запрос пройдет успешно то в переменную result вернется true
    if($result)
    { $URL="http://masterdnepr.dp.ua/";
     header ("Location: $URL");
     }
    else {echo "Ваши данные не добавлены";
    
    }
    ?>

    Вот так заработало

    radiomonter, 11 Мая 2015

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

    +142

    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
    <form method="post" action="/php/form.php" id="add_form">
      <label>Как к Вам обращаться:</label>
      <div class="row">
      <div class="col-lg-6">
        <div class="input-group">
          <span class="input-group-addon glyphicon glyphicon-user"></span>
          <input type="text" class="form-control" name="first_name" placeholder="Имя" aria-label="...">
        </div><!-- /input-group -->
      </div><!-- /.col-lg-6 -->
    </div><!-- /.row -->
      <label>Email (не публикуется):</label>
     <div class="input-group">
      <span class="input-group-addon glyphicon glyphicon-envelope " id="basic-addon1"></span>
      <input type="text" class="form-control" name="email" placeholder="Электронная почта" aria-describedby="basic-addon1">
    </div>
    <label>Телефон (не публикуется):</label>
    <div class="input-group">
    	  <span class="input-group-addon glyphicon glyphicon-phone"></span>
    	  <input type="text" class="form-control" name="phone" placeholder="телефон" aria-describedby="basic-addon1">
    	</div>
      
    </div>
         <center><label>Опишите суть ситуации:</label></center>
      <div>
    <center><textarea name="text" required="" rows="8" style="width: 510;"></textarea></center>
    </div>
    
    
    <dl>
    
    </dl>
          </div>
          <div class="modal-footer"><center>
            <button type="button" class="btn btn-danger" data-dismiss="modal">Отказаться</button>
            <button type="submit" class="btn btn-success"  data-toggle="tooltip" data-placement="right" title="После Вашей заявки,мастер свяжеться с Вами в ближайшее время">Заказать мастера</button>
    		</center>
          </div>
        </div>
    	</form>

    вот сама форма

    radiomonter, 11 Мая 2015

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

    +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
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    <?php 
     
    require_once 'db.php';
     error_reporting(E_ALL);
    //полученный масиф (B!) на предыдущей страницы методом Post
    $first_name = filter_input(INPUT_POST, 'first_name');
    $email = filter_input(INPUT_POST, 'email');
    $phone = filter_input(INPUT_POST, 'phone');//PHONE BLYAD
    $text = filter_input(INPUT_POST, 'text');
    $date = date("Y-m-d H:i:s");
    //Теперь сделаем запрос к базе, который внесет наши данные в таблицу:
    $query = $dblink->prepare("INSERT INTO `claims` (`time`,`first_name`, `email`, `phone`, `text`) VALUES (?, ?, ?, ?,?);");
    $result = $query->execute (array($date, $first_name, $email, $phone, $text));//MAYBE IT'S CAN RAISE PDOException, see more in documentation
     
    //Если запрос пройдет успешно то в переменную result вернется true
    if($result)
    {echo $URL="http://masterdnepr.dp.ua/#home";
     header ("Location: $URL");}
    else {echo "Ваши данные не добавлены";
    
    }
    ?>

    не приходят данные.Пишет Ваши данные не добавлены

    radiomonter, 11 Мая 2015

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

    −47

    1. 1
    Оффтоп здесь

    3_14dar, 11 Мая 2015

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

    +142

    1. 1
    URxvt*foreground: #C0C0C0

    Вот что монокай с urxvt делает.

    codemonkey, 10 Мая 2015

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

    +142

    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
    String tp22 = "";
    int v1 = (Math.random(8))+1;
     if (v1=1)
     { tp22.charAt(1)="a";}
     if (v1=2)
     { tp22.charAt(1)="b";}
     if (v1=3)
     { tp22.charAt(1)="c";}
     if (v1=4)
     { tp22.charAt(1)="d";}
     if (v1=5)
     { tp22.charAt(1)="e";}
     if (v1=6)
     { tp22.charAt(1)="f";}
     if (v1=7)
     { tp22.charAt(1)="g";}
     if (v1=8)
     { tp22.charAt(1)="h";}
     if (v1=9)
     { tp22.charAt(1)="i";}

    Получаем случайную букву.

    Imp, 10 Мая 2015

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

    +142

    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
    typedef enum {
            INIT1=0, INIT2,  INIT3,  INIT4,  INIT5,  INIT6,  INITN,
            BIND1,   BIND2,  BIND3,  BIND4,  BIND5,  BIND6,  BINDN,
            YIELD1,  YIELD2, YIELD3, YIELD4, YIELD5, YIELD6, YIELDN, 
            COMPARE, CHECK, FILTER, CFILTER, PFILTER, CHOOSE, NOOP, CONTINUE,
            GET_ENODE, 
            GET_CGR1, GET_CGR2, GET_CGR3, GET_CGR4, GET_CGR5, GET_CGR6, GET_CGRN,
            IS_CGR
        } opcode;
    ...
    ...
    ...
    
    
    
            switch (m_pc->m_opcode) {
            case INIT1:
                m_app          = m_registers[0];
                if (m_app->get_num_args() != 1)
                    goto backtrack;
                m_registers[1] = m_app->get_arg(0);
                m_pc = m_pc->m_next;
                goto main_loop;
                
            case INIT2:
                m_app          = m_registers[0];
                if (m_app->get_num_args() != 2)
                    goto backtrack;
                m_registers[1] = m_app->get_arg(0);
                m_registers[2] = m_app->get_arg(1);
                m_pc = m_pc->m_next;
                goto main_loop;
                
            case INIT3:
                m_app          = m_registers[0];
                if (m_app->get_num_args() != 3)
                    goto backtrack;
                m_registers[1] = m_app->get_arg(0);
                m_registers[2] = m_app->get_arg(1);
                m_registers[3] = m_app->get_arg(2);
                m_pc = m_pc->m_next;
                goto main_loop;
                
            case INIT4:
                m_app          = m_registers[0];
                if (m_app->get_num_args() != 4)
                    goto backtrack;
                m_registers[1] = m_app->get_arg(0);
                m_registers[2] = m_app->get_arg(1);
                m_registers[3] = m_app->get_arg(2);
                m_registers[4] = m_app->get_arg(3);
                m_pc = m_pc->m_next;
                goto main_loop;
                
            case INIT5:
                m_app          = m_registers[0]; 
                if (m_app->get_num_args() != 5)
                    goto backtrack;
                m_registers[1] = m_app->get_arg(0);
                m_registers[2] = m_app->get_arg(1);
                m_registers[3] = m_app->get_arg(2);
                m_registers[4] = m_app->get_arg(3);
                m_registers[5] = m_app->get_arg(4);
                m_pc = m_pc->m_next;
                goto main_loop;
                
            case INIT6: 
                m_app          = m_registers[0];
                if (m_app->get_num_args() != 6)
                    goto backtrack;
                m_registers[1] = m_app->get_arg(0);
                m_registers[2] = m_app->get_arg(1);
                m_registers[3] = m_app->get_arg(2);
                m_registers[4] = m_app->get_arg(3);
                m_registers[5] = m_app->get_arg(4);
                m_registers[6] = m_app->get_arg(5);
                m_pc = m_pc->m_next;
                goto main_loop;
                
            case INITN:
                m_app      = m_registers[0];
                m_num_args = m_app->get_num_args();
                if (m_num_args != static_cast<const initn *>(m_pc)->m_num_args)
                    goto backtrack;
                for (unsigned i = 0; i < m_num_args; i++)
                    m_registers[i+1] = m_app->get_arg(i);
                m_pc = m_pc->m_next;
                goto main_loop;

    Из изходников STM-солвера Z3
    https://github.com/Z3Prover/z3/blob/master/src/smt/mam.cpp#L2298
    Почему нельзя было оставить только вариант INITN? Цикл отбирает так много ресурсов?

    j123123, 10 Мая 2015

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

    +142

    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
    class Ship{
    
    public static void main(String []args){
    //бла-бла-бла
    String s = Ship.getTp22();
    }
    String getTp22(){
    public String tp22 = "-*";
    int v1 = (Math.random(8))+1;
     if (v1=1)
     { tp22.charAt(1)="a";}
     if (v1=2)
     { tp22.charAt(1)="b";}
     if (v1=3)
     { tp22.charAt(1)="c";}
     if (v1=4)
     { tp22.charAt(1)="d";}
     if (v1=5)
     { tp22.charAt(1)="e";}
     if (v1=6)
     { tp22.charAt(1)="f";}
     if (v1=7)
     { tp22.charAt(1)="g";}
     if (v1=8)
     { tp22.charAt(1)="h";}
     if (v1=9)
     { tp22.charAt(1)="i";}
    
    return tp22;
    }
    
    }

    Гениальный способ генерации строки со случайной буквой.

    Imp, 10 Мая 2015

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

    +141

    1. 1
    2. 2
    3. 3
    4. 4
    function GetArgs(const str:string):string;
    begin
      result:=strpas(pathgetargs(pchar(str))); //UB
    end;

    result:=strpas(pathgetargs(pchar(str))); //UB
    Плохой мальчик.

    Stertor, 09 Мая 2015

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