-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapprovelinks.php
546 lines (66 loc) · 2.94 KB
/
approvelinks.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
<?php
$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_PREFIX1', $linkbase_table_prefix1);
//$result = $_REQUEST['id'];
if($_REQUEST['id']!='0') {
if($_REQUEST['id']=='1') { //Approve All User
echo $sqip="UPDATE ".LINKBASE_TABLE_PREFIX."linkbase SET approved = '1',denied=0";
$wpdb->query($sqip);
echo "All approved";
} elseif($_REQUEST['id']=='2') { //Approve only Unregister user
global $wpdb;
$sql = "SELECT * FROM ".LINKBASE_TABLE_PREFIX."linkbase WHERE userid = '0'";
$results = $wpdb->get_results($sql);
if(count($results) > 0)
{
foreach($results as $result)
{
$sqip="UPDATE ".LINKBASE_TABLE_PREFIX."linkbase SET approved = '1',denied=0 WHERE id = '".$result->id."'";
$wpdb->query($sqip);
}
echo "All Unregister user approved";
}
$sl = "SELECT * FROM ".LINKBASE_TABLE_PREFIX."approvelinks WHERE sltd = '1'";
$results = $wpdb->get_results($sl);
foreach($results as $result)
{
$sqip="UPDATE ".LINKBASE_TABLE_PREFIX."approvelinks SET sltd = '0' WHERE id = '".$result->id."'";
$wpdb->query($sqip);
}
$sqi="UPDATE ".LINKBASE_TABLE_PREFIX."approvelinks SET sltd = '1' WHERE id = '".$_REQUEST['id']."'";
$wpdb->query($sqi);
} elseif($_REQUEST['id']=='3') { //Auto Approve
$sqip="UPDATE ".LINKBASE_TABLE_PREFIX."linkbase SET approved = '1',denied=0";
$wpdb->query($sqip);
$sl = "SELECT * FROM ".LINKBASE_TABLE_PREFIX."approvelinks WHERE sltd = '1'";
$results = $wpdb->get_results($sl);
foreach($results as $result)
{
$sqip="UPDATE ".LINKBASE_TABLE_PREFIX."approvelinks SET sltd = '0' WHERE id = '".$result->id."'";
$wpdb->query($sqip);
}
$sqip1="UPDATE ".LINKBASE_TABLE_PREFIX."approvelinks SET sltd = '1' WHERE id = '".$_REQUEST['id']."'";
$wpdb->query($sqip1);
echo "Auto Approve All links";
}
}
/*
global $wpdb;
$sql = "SELECT *FROM ".LINKBASE_TABLE_PREFIX."linkbase WHERE approved = '0'";
$results = $wpdb->get_results($sql);
if(count($results) > 0)
{
foreach($results as $result)
{
$sqip="UPDATE ".LINKBASE_TABLE_PREFIX."linkbase SET approved = '1'";
$wpdb->query($sqip);
}
}
*/