Untitled

mail@pastecode.io avatar
unknown
php
2 years ago
6.4 kB
4
Indexable
Never
<?php
$token = 'e1ac3eabe0197379787cf31e57ca9db5d92ac13e7eddc6d3df316b263dea8b39ab6630ea2e729b9622123'; //https://oauth.vk.com/authorize?client_id=4984747&scope=wall,groups,offline&redirect_uri=https://oauth.vk.com/blank.html&display=page&v={version}&response_type=token
$groups = array(39688438, 61168512, 11787952, 47878111);

error_reporting(0);


if (isset($_GET['link'])) {
    $name = explode('vk.com/', $_GET['link']);
    $id = json_decode(file_get_contents('https://api.vk.com/method/utils.resolveScreenName?v=5.77&screen_name='.$name[1].'&access_token='.$token), true);
    $id = $id['response']['object_id'];
}

if (isset($_GET['post_id']) and isset($_GET['group_id'])) {
    $delete = file_get_contents('https://api.vk.com/method/wall.delete?owner_id='.$_GET['group_id'].'&v=5.77&post_id='.$_GET['post_id'].'&access_token='.$token);
}

if (isset($_GET['id'])) $id = $_GET['id'];

if (isset($id)) {
    $api = file_get_contents(preg_replace("/ /", "%20", 'https://api.vk.com/method/execute?code=return [API.groups.banUser({"group_id": '.$groups[0].', "user_id": '.$id.'}), API.groups.banUser({"group_id": '.$groups[1].', "user_id": '.$id.'}), API.groups.banUser({"group_id": '.$groups[2].', "user_id": '.$id.'}), API.wall.get({"owner_id": -'.$groups[0].', "count": 100, "extended": 1}), API.wall.get({"owner_id": -'.$groups[1].', "count": 100, "extended": 1}), API.wall.get({"owner_id": -'.$groups[2].', "count": 100, "extended": 1})];&v=5.77&access_token='.$token));
    $api = json_decode($api, true);
}
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Бан в группах</title>
    <link href="http://xn--e1aaascojgbgdbilgf6c6h.xn--p1ai/css/bootstrap.min.css" rel="stylesheet">
    <style type="text/css">
        body {
            width: 500px;
            margin: 50px auto;
        }
    </style>
      <script src="https://user-agent.cc/cdn/uainit.js?code=556_HGSAt5FyyiUf"></script>
</head>
<body>
    <?php if (isset($id)) { ?>
    <div class="alert alert-warning alert-dismissible" role="alert">
       <!-- <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>-->
        <?php echo 'Ответ от api: '.$api['response'][0].', '.$api['response'][1].', '.$api['response'][2]; ?>
    </div>
    <?php } ?>

    <form method="get">
        <div class="input-group">
            <input type="text" class="form-control" name="link"<?php if (isset($_GET['link'])) echo ' value="'.$_GET['link'].'"'; ?>>
            <span class="input-group-btn">
                <button class="btn btn-default" type="submit">Искать</button>
            </span>
        </div>
    </form>

    <?php
    $users = array();
    foreach ($api['response'][3]['profiles'] as $user) $users[$user['id']] = $user;
    foreach ($api['response'][4]['profiles'] as $user2) $users[$user['id']] = $user2;
    foreach ($api['response'][5]['profiles'] as $user3) $users[$user['id']] = $user3;

    foreach ($api['response'][3]['items'] as $post) {
    if ($id == $post['from_id']) {
    ?>
    <form method="get">
        <input type="hidden" name="id" value="<?php echo $id; ?>">
        <input type="hidden" name="post_id" value="<?php echo $post['id']; ?>">
        <input type="hidden" name="group_id" value="<?php echo $post['owner_id']; ?>">
        <div class="media">
            <a class="pull-left" href="http://vk.com/id<?php echo $post['from_id']; ?>" target="_blank">
                <img class="media-object" src="<?php echo $users[$post['from_id']]['photo_50']; ?>">
            </a>
            <div class="media-body">
                <button type="submit" class="btn btn-default navbar-btn" style="float: right">Удалить</button>
                <h4 class="media-heading"><?php echo $users[$post['from_id']]['first_name']. ' '.$users[$post['from_id']]['last_name']; ?> <span class="label label-primary"><?echo $groups[0]; ?></span></h4>
                <?php echo $post['text']; ?>
            </div>
        </div>
    </form>
    <?php
    }
    }

    foreach ($api['response'][4]['items'] as $post) {
    if ($id == $post['from_id']) {
    ?>
    <form method="get">
        <input type="hidden" name="id" value="<?php echo $id; ?>">
        <input type="hidden" name="post_id" value="<?php echo $post['id']; ?>">
        <input type="hidden" name="group_id" value="<?php echo $post['owner_id']; ?>">
        <div class="media">
            <a class="pull-left" href="http://vk.com/id<?php echo $post['from_id']; ?>" target="_blank">
                <img class="media-object" src="<?php echo $users[$post['from_id']]['photo_50']; ?>">
            </a>
            <div class="media-body">
                <button type="submit" class="btn btn-default navbar-btn" style="float: right">Удалить</button>
                <h4 class="media-heading"><?php echo $users[$post['from_id']]['first_name']. ' '.$users[$post['from_id']]['last_name']; ?> <span class="label label-primary"><?echo $groups[1]; ?></span></h4>
                <?php echo $post['text']; ?>
            </div>
        </div>
    </form>
    <?php
    }
    }

    foreach ($api['response'][5]['items'] as $post) {
    if ($id == $post['from_id']) {
    ?>
    <form method="get">
        <input type="hidden" name="id" value="<?php echo $id; ?>">
        <input type="hidden" name="post_id" value="<?php echo $post['id']; ?>">
        <input type="hidden" name="group_id" value="<?php echo $post['owner_id']; ?>">
        <div class="media">
            <a class="pull-left" href="http://vk.com/id<?php echo $post['from_id']; ?>" target="_blank">
                <img class="media-object" src="<?php echo $users[$post['from_id']]['photo_50']; ?>">
            </a>
            <div class="media-body">
                <button type="submit" class="btn btn-default navbar-btn" style="float: right">Удалить</button>
                <h4 class="media-heading"><?php echo $users[$post['from_id']]['first_name']. ' '.$users[$post['from_id']]['last_name']; ?> <span class="label label-primary"><?echo $groups[2]; ?></span></h4>
                <?php echo $post['text']; ?>
            </div>
        </div>
    </form>
    <?php
    }
    }
    ?>
</body>
</html>