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 | |||
10 | $arg = trim(implode(' ', $argv)); |
||
11 | # while ($arg = array_shift($argv)) { |
||
12 | $wildcard = trim(mywc($arg)); |
||
13 | |||
14 | $res = db_query("SELECT DISTINCT cat FROM stam_entries |
||
15 | WHERE cat LIKE '".db_real_escape_string($wildcard)."' |
||
16 | AND state != 'S' |
||
17 | ORDER BY ts ASC, cat ASC"); |
||
18 | if (!$res) { |
||
19 | fwrite(STDERR, db_error()."\n"); |
||
20 | db_close(); |
||
21 | exit(1); |
||
22 | } |
||
23 | while ($row = db_fetch_array($res)) { |
||
24 | exit(0); |
||
25 | } |
||
26 | exit(1); |
||
27 | # } |