Rev 4 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4 | daniel-mar | 1 | #!/usr/bin/php |
2 | <?php |
||
3 | |||
4 | require_once __DIR__ . '/includes/db.inc.php'; |
||
5 | require_once __DIR__ . '/includes/src.inc.php'; |
||
6 | |||
7 | if ($argc <> 1) { |
||
8 | echo "Syntax: $argv[0]\n"; |
||
9 | exit(2); |
||
10 | } |
||
11 | |||
12 | if (isset($stam_cfg['weblog_host']) && !empty($stam_cfg['weblog_host'])) { |
||
13 | db_close(); |
||
14 | |||
15 | $weblog_host = $stam_cfg['weblog_host']; |
||
16 | $weblog_user = $stam_cfg['weblog_user']; |
||
17 | $weblog_pass = $stam_cfg['weblog_pass']; |
||
18 | $weblog_base = $stam_cfg['weblog_base']; |
||
19 | |||
20 | if (!db_connect($weblog_host, $weblog_user, $weblog_pass)) { |
||
21 | fwrite(STDERR, "Weblog MySQL connect error\n"); |
||
22 | exit(2); |
||
23 | } |
||
24 | |||
25 | if (!db_select_db($weblog_base)) { |
||
26 | fwrite(STDERR, "Weblog MySQL DB select error\n"); |
||
6 | daniel-mar | 27 | db_close(); |
4 | daniel-mar | 28 | exit(2); |
29 | } |
||
30 | |||
31 | $res = db_query("select * from stam_weblog order by id asc"); |
||
32 | while ($row = db_fetch_array($res)) { |
||
33 | $ent = $row['inp']; |
||
34 | if (isset($stam_cfg['weblog_password']) && !empty($stam_cfg['weblog_password'])) { |
||
35 | $iv = 'AAAAAAAAAAAAAAAA'; |
||
36 | $ent = openssl_decrypt(base64_decode($ent), 'AES-128-CBC', $stam_cfg['weblog_password'], OPENSSL_RAW_DATA, $iv); |
||
37 | } |
||
38 | echo $row['ts'] . ': ' . $ent . "\n"; |
||
39 | |||
40 | } |
||
41 | } |
||
42 | |||
43 | # --- |
||
44 | |||
45 | function green($txt) { |
||
46 | return "\033[1;32;40m".$txt."\033[0m"; |
||
47 | } |