Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- set_time_limit(0);
- error_reporting(0);
- define('HASHTAG_NAMESPACE', '#j2team');/* Sửa hashtag tại đây , chữ thường không viết hoa*/
- $token = 'token';
- $idgroup = '1665434437020609'; /* Id Group */
- $post = json_decode(request('https://graph.facebook.com/v2.9/' .$idgroup. '/feed?fields=id,message,created_time,from&limit=1000&access_token=' . $token), true); /* Get Data Post*/
- $timelocpost = date('Y-m');
- $danhsachtukhoa = array('đm', 'cc', 'fuck', 'dm', 'óc chó');
- $logcmt = file_get_contents("logcmt.txt");
- $logpost= file_get_contents("log.txt");
- for ($i = 0; $i < 1000; $i++) {
- $idpost = $post['data'][$i]['id'];
- $messagepost = $post['data'][$i]['message'];
- $time = $post['data'][$i]['created_time'];
- if (strpos($time, $timelocpost) !== false) {
- /* Check hashtag */
- if (strpos(strtolower($messagepost), HASHTAG_NAMESPACE) === FALSE) {
- if (strpos($logpost, $idpost) === FALSE) {
- $arraycmt = array('Bổ sung #hashtag vào bài viết nhé, ' . $post['data'][$i]['from']['name'] . '!' . "\n\n" . 'Link : https://community.j2.team/hashtags.html',
- 'Ơi bạn gì đó ơi quên thêm #hashtag kìa ' . "\n\n" . ' Link : https://community.j2.team/hashtags.html',
- 'Bạn bè anh em tin tưởng bạn mà bạn lại quên #hashtag thế à ' . $post['data'][$i]['from']['name'] . ' ! Bổ sung #hashtag ngay nào' . "\n\n" . 'Link : https://community.j2.team/hashtags.html'
- );
- $random_cmt = array_rand($arraycmt);
- $comment = $arraycmt[$random_cmt];
- request('https://graph.facebook.com/' . urlencode($idpost) . '/comments?method=post&message=' . urlencode($comment) . '&access_token=' . $token);
- $luulog = fopen("log.txt", "a");
- fwrite($luulog, $idpost . "\n");
- fclose($luulog);
- } else {
- echo 'Đã nhắc hashtag';
- }
- }
- /* END Check hashtag */
- /* Scan cmt */
- $getcmt = json_decode(request('https://graph.facebook.com/v2.9/' . $idpost . '?fields=comments.summary(true).limit(10000){message}&access_token=' . $token), true);
- $count = $getcmt['comments']['summary']['total_count'];
- for ($a = 0; $a < $count; $a++) {
- $cmt = $getcmt['comments']['data'][$a]['message'];
- $idcmt = $getcmt['comments']['data'][$a]['id'];
- $cmtcham = array(".", "..", "...", "....");
- if (in_array($cmt, $cmtcham)) {
- if (strpos($logcmt, $idcmt) === FALSE) {
- $comment = 'Chấm sẽ bị ban bạn nhé';
- request('https://graph.facebook.com/' . urlencode($idcmt) . '/comments?method=post&message=' . urlencode($comment) . '&access_token=' . $token);
- $luulog = fopen("logcmt.txt", "a");
- fwrite($luulog, $idcmt . "\n");
- fclose($luulog);
- }
- }
- /* Scan reply cmt */
- $getrepcmt = json_decode(request('https://graph.facebook.com/v2.9/' . $idcmt . '?fields=comments.summary(true).limit(10000){message}&access_token=' . $token), true);
- $count_repcmt = $getrepcmt['comments']['summary']['total_count'];
- for ($b = 0; $b < $count_repcmt; $b++) {
- $cmtrep = $getrepcmt['comments']['data'][$b]['message'];
- $idcmtrep = $getrepcmt['comments']['data'][$b]['id'];
- $lamoscar1 = " " . strtolower($cmtrep);
- if(strposa($lamoscar1, $danhsachtukhoa, 1)) {
- if (strpos($logcmt, $idcmtrep) === FALSE) {
- $getinfo_user = json_decode(request('https://graph.facebook.com/v2.9/' . $idcmtrep . '?access_token=' . $token), true);
- $name = $getinfo_user["from"]["name"];
- $comment = 'Nè ' . $name . ' cmt từ cấm kìa ';
- request('https://graph.facebook.com/' . urlencode($idcmt) . '/comments?method=post&message=' . urlencode($comment) . '&access_token=' . $token);
- $luulog = fopen("logcmt.txt", "a");
- fwrite($luulog, $idcmtrep . "\n");
- fclose($luulog);
- }else{
- echo 'Đã nhắc nhở';
- }
- }
- /* END Scan reply cmt */
- }
- $lamoscar = " " . strtolower($cmt);
- if(strposa($lamoscar, $danhsachtukhoa, 1)) {
- if (strpos($logcmt, $idcmt) === FALSE) {
- $arraycmt = array('Chửi bậy à', 'Văn hoá tý đi bạn :v', 'Khẻ nào cưng', 'Xoá cmt hoặc lên vip'); //array cmt
- $random_cmt = array_rand($arraycmt);
- $comment = $arraycmt[$random_cmt];
- request('https://graph.facebook.com/' . urlencode($idcmt) . '/comments?method=post&message=' . urlencode($comment) . '&access_token=' . $token);
- $luulog = fopen("logcmt.txt", "a");
- fwrite($luulog, $idcmt . "\n");
- fclose($luulog);
- }else{
- echo 'Đã nhắc nhở';
- }
- }
- }
- /* END Scan cmt */
- }
- }
- function strposa($haystack, $needles=array(), $offset=0) {
- $chr = array();
- foreach($needles as $needle) {
- $res = strpos($haystack, $needle, $offset);
- if ($res !== false) $chr[$needle] = $res;
- }
- if(empty($chr)) return false;
- return min($chr);
- }
- function request($url)
- {
- if (!filter_var($url, FILTER_VALIDATE_URL)) {
- return FALSE;
- }
- $options = array(
- CURLOPT_URL => $url,
- CURLOPT_RETURNTRANSFER => TRUE,
- CURLOPT_HEADER => FALSE,
- CURLOPT_FOLLOWLOCATION => TRUE,
- CURLOPT_ENCODING => '',
- CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.87 Safari/537.36',
- CURLOPT_AUTOREFERER => TRUE,
- CURLOPT_CONNECTTIMEOUT => 15,
- CURLOPT_TIMEOUT => 15,
- CURLOPT_MAXREDIRS => 5,
- CURLOPT_SSL_VERIFYHOST => 2,
- CURLOPT_SSL_VERIFYPEER => 0
- );
- $ch = curl_init();
- curl_setopt_array($ch, $options);
- $response = curl_exec($ch);
- $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
- curl_close($ch);
- unset($options);
- return $http_code === 200 ? $response : FALSE;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment