PluginProbe
WebberZone Top 10 — Popular Posts / 1.0.1
WebberZone Top 10 — Popular Posts v1.0.1
4.5.2 4.5.1 4.5.0 4.4.3 4.4.2 4.4.1 4.4.0 4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 trunk 1.0 1.0.1 1.1 1.2 1.3 1.4 1.4.1 1.5 1.5.1 1.5.2 1.5.3 1.6 All 118 releases
top-10 / top-10_ajax.php

top-10_ajax.php in WebberZone Top 10 — Popular Posts 1.0.1, at top-10_ajax.php

35 lines 856 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if (!function_exists('add_action')) {
4 $wp_root = '../../..';
5 if (file_exists($wp_root.'/wp-load.php')) {
6 require_once($wp_root.'/wp-load.php');
7 } else {
8 require_once($wp_root.'/wp-config.php');
9 }
10 }
11
12 // Ajax Increment Counter
13 tptn_inc_count();
14 function tptn_inc_count() {
15 global $wpdb;
16 $table_name = $wpdb->prefix . "top_ten";
17
18 $id = intval($_GET['top_ten_id']);
19 if($id > 0) {
20 $results = $wpdb->get_results("select postnumber, cntaccess from $table_name where postnumber = '$id'");
21 $test = 0;
22 if ($results) {
23 foreach ($results as $result) {
24 $wpdb->query("update $table_name set cntaccess = cntaccess + 1 where postnumber = $result->postnumber");
25 $test = 1;
26 }
27 }
28 if ($test == 0) {
29 $wpdb->query("insert into $table_name (postnumber, cntaccess) values('$id', '1')");
30 }
31 }
32 }
33
34 ?>
35