-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmintools.php
69 lines (64 loc) · 1.88 KB
/
admintools.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
<?php
header('Content-Type: application/javascript; charset=utf-8');
header('Cache-Control: no-cache, must-revalidate'); // HTTP/1.1
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
require_once('./config/confadmin.php');
$success="false";
$result="";
$cache="./thumb";
if($_GET['admin_login']!=$adlogin||$_GET['admin_pw']!=$adpw) {
$result="login error";
} else {
$action=$_GET['action'];
if($action=="deletethumb") {
$folder = new DirectoryIterator($cache);
$filenbr=0;
foreach($folder as $file) {
if($file->isFile() && !$file->isDot() && ($file->getFilename()!="writetest.html")) {
unlink($file->getPathname());
$filenbr=$filenbr+1;
}
}
$result="delete ".$filenbr." files in thumb";
$success=true;
} else if($action=="initdeletesaveaccount") {
$result=array();
$fichierjson="./config/accounts.json";
if ($json = @file_get_contents($fichierjson)) {
$json = json_decode($json, true);
$accounts= $json['accounts'];
foreach( $accounts as $key => $value){
$result[]=$key;
}
}
$success=true;
} else if($action=="deletesaveaccount") {
if($_GET['accountsav']) {
$account=$_GET['accountsav'];
$result=array();
$fichierjson="./config/accounts.json";
if ($json = @file_get_contents($fichierjson)) {
$json = json_decode($json, true);
$accounts= $json['accounts'];
unset($accounts[$account]);
$acountencode='{"accounts":'.json_encode($accounts).'}';
file_put_contents($fichierjson, $acountencode);
foreach( $accounts as $key => $value){
$result[]=$key;
}
}
$success=true;
} else {
$result="You didn't choose the account to delete";
}
} else {
$result="error";
}
}
$json = json_encode($result);
$json = '{"success":"'.$success.'","resultat":'.$json."}";
if (isset($_GET['callback'])) {
echo $_GET['callback'].'('.$json.');';
} else {
echo $json;
}