Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3 | daniel-mar | 1 | #!/usr/bin/php |
2 | <?php |
||
3 | |||
4 | require_once __DIR__ . '/includes/db.inc.php'; |
||
5 | require_once __DIR__ . '/includes/wildcard.inc.php'; |
||
6 | |||
7 | array_shift($argv); |
||
8 | #if (!isset($argv[0]) || (trim($argv[0])=='')) $argv[0] = '*'; |
||
9 | if (!isset($argv[0])) $argv[0] = ''; # keine wildcards erlauben |
||
10 | |||
11 | $arg = trim(implode(' ', $argv)); |
||
12 | # while ($arg = array_shift($argv)) { |
||
13 | # $wildcard = trim(mywc($arg)); |
||
14 | $wildcard = trim($arg); # keine wildcards erlauben |
||
15 | |||
16 | $res = db_query("SELECT * FROM stam_entries |
||
17 | WHERE cat LIKE '".db_real_escape_string($wildcard)."' |
||
18 | AND state != 'S' |
||
19 | ORDER BY ts ASC, cat ASC"); |
||
20 | if (!$res) { |
||
21 | fwrite(STDERR, db_error()."\n"); |
||
22 | db_close(); |
||
23 | exit(1); |
||
24 | } |
||
25 | if (db_num_rows($res) == 0) { |
||
26 | fwrite(STDERR, "Category '$wildcard' not found!\n"); |
||
27 | exit(1); |
||
28 | } |
||
29 | while ($row = db_fetch_array($res)) { |
||
30 | $id = $row['id']; |
||
31 | $cat = $row['cat']; |
||
32 | $txt = $row['txt']; |
||
33 | $src = $row['src']; |
||
34 | $ts = $row['ts']; |
||
35 | $short_ts = date('d.m.y H:i', strtotime($ts)); |
||
36 | echo "$txt\n"; |
||
37 | } |
||
38 | # } |