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 | |||
6 | array_shift($argv); |
||
7 | if (!isset($argv[0]) || (trim($argv[0])=='')) { |
||
8 | echo "Syntax: $0 <category>\n"; |
||
9 | echo "Category may not be a wildcard\n"; |
||
10 | exit(2); |
||
11 | } |
||
12 | |||
13 | $arg = trim(implode(' ', $argv)); |
||
14 | $res = db_query("SELECT DISTINCT cat FROM stam_entries |
||
15 | WHERE cat = '".db_real_escape_string($arg)."' |
||
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); |