-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcount.php
312 lines (40 loc) · 1.53 KB
/
count.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
@session_start();
$a=explode('wp-content',$_SERVER['SCRIPT_FILENAME']);
$path=$a[0];
include_once $path . '/wp-config.php';
include_once $path . '/wp-load.php';
include_once $path . '/wp-includes/wp-db.php';
include_once $path . '/wp-includes/pluggable.php';
global $wpdb;
$linkbase_table_prefix1=$wpdb->prefix.'linkbase_';
define('LINKBASE_TABLE_PREFIX', $linkbase_table_prefix);
define('LINKBASE_TABLE_PREFIX1', $linkbase_table_prefix1);
//print_r($_SESSION['like_status']);
if($_SESSION['like_status'] == '') {
$_SESSION['like_status'] = array();
}
$array = $_SESSION['like_status'];
$id = $_POST['likeid'];
$like = $_POST['like'];
if (!in_array($id, $array)) {
// echo "abc";
echo $like=$_POST['like']+1;
$table = LINKBASE_TABLE_PREFIX1."linkbase";
$sql="update $table SET likeup=$like where id=$id";
$wpdb->query($sql);
array_push($array, $id);
$_SESSION['like_status']=$array;
exit;
} else {
$tablel = LINKBASE_TABLE_PREFIX1."linkbase";
$sqll="SELECT * FROM $tablel WHERE id=$id";
$results = $wpdb->get_results($sqll);
foreach($results as $row)
{
//echo "abch";
echo $row->likeup;
exit;
}
}
?>