1. Список говнокодов пользователя bodix

    Всего: 1

  2. PHP / Говнокод #26698

    +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
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    <?php
        echo count($arr);
        $i = count($arr) - 1;
        for ($i; $i >= 0; $i--) {
        ?>
        <div class="post" id="p<?php echo $arr[$i]->_id; ?>">
          <div class="p_title"><?php echo $arr[$i]->title; ?></div>
          <div class="p_content"><?php echo $arr[$i]->content; ?></div>
          <div class="p_date"><?php echo $arr[$i]->date; ?></div>
          <form id="<?php echo $arr[$i]->_id; ?>" action="index.php" method="get">
            <!--<textarea rows="4" cols="50" name="removid" style="display: none;" ><?php echo $arr[$i]->_id; ?></textarea>-->
              <input type="text" name="removid"  form="<?php echo $arr[$i]->_id; ?>" value="<?php echo $arr[$i]->_id; ?>"/>
            <input type="submit" class="p_remove" onclick="dele('<?php echo $arr[$i]->_id; ?>');" form="<?php echo $arr[$i]->_id; ?>" value="Удалить"/>
          </form><!--</div>-->
          <?php echo $arr[$i]->_id; ?>
        </div>
        <?php
        }
        ?>
    
    <script>
          function dele(param){
            var jsVar = "<?php
            $removid = $_GET['removid'];
            $bulk = new MongoDB\Driver\BulkWrite;
            //$bulk->delete(['_id'=> new MongoDB\BSON\ObjectId($removid)]);
            $query = new MongoDB\Driver\Query(['_id'=> new MongoDB\BSON\ObjectId($removid)]);
            $bulk->delete(['_id'=> new MongoDB\BSON\ObjectId($removid)]);
            $writeConcern = new MongoDB\Driver\WriteConcern(MongoDB\Driver\WriteConcern::MAJORITY, 1000);
            try {
              $result = $manager->executeBulkWrite('forum.posts', $bulk, $writeConcern);
              //header('Location: https://benar.wtf/index.php');
    
            }
            catch (MongoDB\Driver\Exception\BulkWriteException $e) {
              $result = $e->getWriteResult();
            }
    
            ?>";
    
    
          }
    
        </script>

    Сделал вещь

    bodix, 27 Мая 2020

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