Uname:Linux Sandbox-A 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64

Base Dir : /var/www/html

User : gavin


403WebShell
403Webshell
Server IP : 68.183.124.220  /  Your IP : 216.73.217.137
Web Server : Apache/2.4.18 (Ubuntu)
System : Linux Sandbox-A 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64
User : gavin ( 1000)
PHP Version : 7.0.33-0ubuntu0.16.04.16
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/wp-content/plugins/wp-statistics/includes/functions/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/wp-content/plugins/wp-statistics/includes/functions/purge-hits.php
<?php
function wp_statistics_purge_visitor_hits( $purge_hits ) {
	GLOBAL $wpdb, $WP_Statistics;

	// If it's less than 10 hits, don't do anything.
	if ( $purge_hits > 9 ) {
		// Purge the visitor's with more than the defined hits.
		$result = $wpdb->get_results(
			$wpdb->prepare( "SELECT * FROM {$wpdb->prefix}statistics_visitor WHERE `hits` > %s", $purge_hits )
		);

		$to_delete = array();

		// Loop through the results and store the requried information in an array.  We don't just process it now as deleting
		// the rows from the visitor table will mess up the results from our first query.
		foreach ( $result as $row ) {
			$to_delete[] = array( $row->ID, $row->last_counter, $row->hits );
		}
		if ( count( $to_delete ) > 0 ) {
			foreach ( $to_delete as $item ) {
				// First update the daily hit count.
				$wpdb->query(
					$wpdb->prepare(
						"UPDATE {$wpdb->prefix}statistics_visit SET `visit` = `visit` - %d WHERE `last_counter` = %s;",
						$item[2],
						$item[1]
					)
				);
				// Next remove the visitor.  Note we can't do both in a single query, looks like $wpdb doesn't like executing them together.
				$wpdb->query(
					$wpdb->prepare( "DELETE FROM {$wpdb->prefix}statistics_visitor WHERE `id` = %s;", $item[0] )
				);
			}

			$result_string = sprintf(
				__( '%s records purged successfully.', 'wp-statistics' ),
				'<code>' . count( $to_delete ) . '</code>'
			);
		} else {
			$result_string = __( 'No visitors found to purge.', 'wp-statistics' );
		}
	} else {
		$result_string = __( 'Number of hits must be greater than or equal to 10!', 'wp-statistics' );
	}

	if ( $WP_Statistics->get_option( 'prune_report' ) == true ) {
		$blogname  = get_bloginfo( 'name' );
		$blogemail = get_bloginfo( 'admin_email' );

		$headers[] = "From: $blogname <$blogemail>";
		$headers[] = "MIME-Version: 1.0";
		$headers[] = "Content-type: text/html; charset=utf-8";

		if ( $WP_Statistics->get_option( 'email_list' ) == '' ) {
			$WP_Statistics->update_option( 'email_list', $blogemail );
		}

		wp_mail(
			$WP_Statistics->get_option( 'email_list' ),
			__( 'Database pruned on', 'wp-statistics' ) . ' ' . $blogname,
			$result_string,
			$headers
		);
	}

	return $result_string;
}

Youez - 2016 - github.com/yon3zu
LinuXploit