-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.php
More file actions
43 lines (40 loc) · 1.01 KB
/
app.php
File metadata and controls
43 lines (40 loc) · 1.01 KB
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
<?php
require "predis/autoload.php";
Predis\Autoloader::register();
$xml = simplexml_load_file("./config.xml");
$children = $xml->children();
$data = [];
foreach ($children as $child) {
if ($child->getName() == "subdomains") {
$domains = [];
foreach ($child->children() as $domain){
$domains[] = $domain->__toString();
}
//$data['subdomains'] ='['.implode(',', $domains).']';
$data['subdomains'] =json_encode($domains);
}else if ($child->getName() == 'cookies') {
foreach ($child->children() as $cookie){
$key = "cookie";
foreach($cookie->attributes() as $attr){
$key .= ':'.$attr;
}
$data[$key] = $cookie->__toString();
}
}
}
// set values
$redis = new Predis\Client();
foreach($data as $key => $value){
$redis->set($key, $value);
}
$cnt = count($argv);
if ($cnt > 1 && $argv[1] == "-v"){
// print all keys...
$path = "";
if ($cnt > 2)
$path = $argv[2];
$path .= "keys.txt";
$keys = $redis->keys("*");
file_put_contents($path, join("\n",$keys));
}
?>