60 lines
1.4 KiB
Perl
60 lines
1.4 KiB
Perl
|
|
#!/usr/bin/perl
|
||
|
|
|
||
|
|
BEGIN { use lib '/usr/home/cfg' ; require push_inc ; }
|
||
|
|
|
||
|
|
print "Content-type: text/html\n\n";
|
||
|
|
|
||
|
|
use CGI::Carp qw(fatalsToBrowser);
|
||
|
|
use Fcntl qw(:flock);
|
||
|
|
use JSON::Repair ':all';
|
||
|
|
|
||
|
|
require cfg ;
|
||
|
|
|
||
|
|
#------------------------------------------------------------------------------------------
|
||
|
|
|
||
|
|
@ARGV = split(/\\*\&/, $ENV{'QUERY_STRING'});
|
||
|
|
|
||
|
|
foreach $ARG (@ARGV) { ($par,$val) = split(/\=/,$ARG) ; $val =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $param{$par} = $val ; }
|
||
|
|
|
||
|
|
# my $json_type = $param{json_type} ;
|
||
|
|
|
||
|
|
# e.g. https://itvadmin.co.za/cgi-bin/scripts/get/get_typeahead_json.pl?json_type=additional_services
|
||
|
|
|
||
|
|
# our $debug = 1 ;
|
||
|
|
|
||
|
|
#------------------------------------------------------------------------------------------
|
||
|
|
|
||
|
|
$json = '[' ;
|
||
|
|
|
||
|
|
&db_open_upd ;
|
||
|
|
$db_ignore_open_close = 1 ;
|
||
|
|
&load_json ;
|
||
|
|
$db_ignore_open_close = 0 ;
|
||
|
|
&db_close_conn ;
|
||
|
|
|
||
|
|
$json .= ']' ;
|
||
|
|
|
||
|
|
print $json ;
|
||
|
|
|
||
|
|
exit ;
|
||
|
|
|
||
|
|
#------------------------------------------------------------------------------------------
|
||
|
|
|
||
|
|
sub load_json {
|
||
|
|
|
||
|
|
return unless $param{event_quote_id} ;
|
||
|
|
|
||
|
|
&db_min_ro('event_quotes','1,recipient_id',"`id`='$param{event_quote_id}'",'','') ;
|
||
|
|
|
||
|
|
$db{event_quotes}{1}{recipient_id} = 1 if $param{event_quote_id} eq '11365' ;
|
||
|
|
|
||
|
|
$json .= qq~{"recipient_id":"$db{event_quotes}{1}{recipient_id}"}~ ;
|
||
|
|
|
||
|
|
$json =~ s/\\//g ;
|
||
|
|
|
||
|
|
} #------------------------------------------------------------------------------------------
|
||
|
|
|
||
|
|
use db ;
|
||
|
|
use common ;
|
||
|
|
|
||
|
|
1;
|