Ejemplo n.º 1
0
<?php

echo '<div class="wrap" id="poststuff">';
if (sm_post('exclude_users_button')) {
    sm_save_excluded_users();
} else {
    if (sm_post('delete_userdata')) {
        sm_delete_userdata();
    }
}
echo '<form method="POST">';
echo sm_start_box('Session Manager - All Sessions by User');
sm_show_all_sessions();
echo sm_end_box();
echo sm_start_box('Actions');
sm_render_actions('by_user');
echo sm_end_box();
echo '</form>';
echo '</div>';
Ejemplo n.º 2
0
<?php

//yr-settings
echo '<div class="wrap" id="poststuff">
		<h2>' . __('Session Manager, Settings', 'yc') . '</h2>';
if (sm_post('sm_update_settings')) {
    sm_update_settings();
} else {
    if ($filename = sm_post('exclude_filename')) {
        sm_exclude_filename($filename);
    } else {
        if ($session_id = sm_post('exclude_session')) {
            sm_exclude_user($session_id);
        }
    }
}
sm_render_settings();
function sm_render_settings()
{
    $left_width = 420;
    $input_width = 420;
    $sm_settings = get_option('sm_settings');
    $detail_start = '<div style="margin-bottom: 5px;">';
    $detail_end = '</div>';
    $track_admin_detail = $detail_start . __('Should the plugin track hits on admin pages?', 'sm') . $detail_end;
    $track_expiry_detail = $detail_start . __('How many days should the data be kept for?', 'sm') . $detail_end;
    $robot_hits_detail = $detail_start . __('If you mark a user/ip address as a robot then should stats from them ever be shown?', 'sm') . $detail_end;
    echo sm_start_box('General Settings');
    echo '	<form method="POST">';
    echo '	<table style="width: 100%;">';
    echo '	<tr>
Ejemplo n.º 3
0
    echo sm_start_box('Session Manager - URL stats: ' . sm_shorten_url($url));
    sm_hits_by_page($url);
    echo sm_end_box();
    echo '</form>';
} else {
    if ($session_id = sm_get('session_id')) {
        echo '<form method="POST">';
        echo sm_start_box('Session Manager - Individual session stats: ' . sm_real_name($session_id, sm_get_user_by_session($session_id)));
        sm_show_session_stats($session_id);
        echo sm_end_box();
        echo '</form>';
    } else {
        if (sm_post('exclude_pages_button')) {
            sm_save_excluded_pages();
        } else {
            if (sm_post('delete_pagedata')) {
                sm_delete_pagedata();
            }
        }
        echo sm_start_box('Session Manager - Filter Controls');
        sm_render_filters('by_page');
        echo sm_end_box();
        echo '<form method="POST">';
        echo sm_start_box('Stats by page');
        sm_show_by_page();
        echo sm_end_box();
        echo sm_start_box('Actions');
        sm_render_actions('by_page');
        echo sm_end_box();
        echo '</form>';
    }
function sm_delete_userdata()
{
    global $wpdb, $table_name;
    if ($users = sm_post('exclude_users')) {
        foreach ($users as $session_id => $user_id) {
            $sql = 'DELETE FROM ' . $table_name . '
					WHERE
						session_id ="' . mysql_real_escape_string($session_id) . '" ';
            if ($user_id) {
                $sql .= 'OR user_id = ' . $user_id;
            }
            $wpdb->query($sql);
        }
        sm_display_feedback(__('User data has been deleted', 'sm'));
    } else {
        sm_display_error(__('Please select at least one user', 'sm'));
    }
}