cities.pl
Copying Source is Forbidden
59 lines of code
1
#!/usr/local/bin/perl
2
3
# must have's!
4
use strict;
5
use warnings;
6
use CGI::Carp qw(fatalsToBrowser);
7
8
use lib "/var/www/html/Pm";
9
10
use Bc_chef qw(cookie_get);
11
use Bc_sql qw(sql_execute
12
user_exists
13
get_country_cities
14
$QUERY_PAGE
15
$QUERY_UID
16
$LOGGEDIN
17
18
$DB
19
);
20
use Bc_misc qw(get_param);
21
use Html qw(pre_html_header);
22
use Redir qw(error_redir);
23
use Security qw(banned);
24
25
$DB->{'mysql_enable_utf8'} = 1;
26
27
my $DEBUG = 0;
28
29
my $country = get_param("c");
30
if (not $country) {
31
if (not @ARGV) {
32
print pre_html_header();
33
#print "<table border=0 cellpading=0 cellspacing=0 height=100% width=100%><tr><td align=center>\n";
34
#print " at least gimme a country ID to work with!\n";
35
#print "</td></tr></table>";
36
37
exit 1;
38
} else {
39
# oh! we got command line arguments! cool
40
$country = $ARGV[0];
41
$country =~ s/c\=//;
42
}
43
}
44
45
my $add999 = get_param("add999");
46
my @cities = get_country_cities($country, $add999);
47
48
my $rv = "";
49
50
foreach my $city (@cities) {
51
$rv .= "$city\n";
52
}
53
54
$rv =~ s/(\n)*$//;
55
56
print pre_html_header({type=>"text/plain"});
57
print $rv;
58
59
exit 1;