|
|
 |
Комплектующие. Каталог.
#!/usr/bin/perl
#use strict;
use warnings;
use CGI::WebOut; # safe output
use CGI::WebIn; # form input
use CGI::Tools; # html tools
$CGI::WebOut::ErrorReporting = 0; # no errors from WebOut
# Define variables
our $DIR_catalog = "../priceman/catalog";
our $DIR_catalog_img = "../../photo/catalog";
our $DIR_catalog_real = "/photo/catalog";
our $FILE_catalog = "catalog.db";
our $DIR_temp = "tmp";
our $DIR_forms = "forms";
our $SCRIPT = "catalog.pl";
our ($FRM_action, $FRM_price);
our ($TPL_table, $TPL_priceid);
my $pricefile=$IN{'priceid'};
$pricefile =~ s/\0//g; # anti null-byte poisoning
$pricefile =~ s/\|//g;
$pricefile =~ s/\\//g;
$pricefile =~ s/\///g;
$pricefile =~ s/;//g;
###
# MAIN
#
# analyze input data
&view_catalog;
exit;
#
# MAIN -- END
###
sub view_catalog() {
open (CATALOG, "$DIR_catalog/$FILE_catalog");
@catalog = ;
close (CATALOG);
foreach $catalog (@catalog) {
@entry = split (/\|\|/, $catalog);
$code=$entry[0];
$is_cmt_1 = $is_cmt_2 = "";
$TPL_name = "name$code";
$TPL_code = "code$code";
$TPL_quan = "quan$code";
$TPL_name_value = $entry[1];
$TPL_code_value = $entry[2];
$TPL_quan_value = $entry[3];
$TPL_image_value = join("", $TPL_code_value, ".jpg");
$is_cmt_01 = $is_cmt_02 = "";
if (!(-e "$DIR_catalog_img/big/$TPL_image_value"))
{
$is_cmt_01 = "";
}
$TPL_table=join ("", $TPL_table, grab {show_form("catalog_entry_view")});
}
show_form("catalog_main_view");
}
###
# Show HTML form
#
sub show_form {
my $form_nm = $_[0];
my (@form, $form);
my $form_name = join ("", $form_nm, ".frm");
open (FFL, "$DIR_forms/$form_name");
while ($form=)
{
# dereferensing variables
$form =~ s/(\$\w+)/$1/gee;
print $form;
}
close (FFL);
}
#sub show_form
##
|