use strict; my $path = "/usr/local/www/data-dist/txt/"; my %FORM; my $iarea; my $quevoto; my @TRUC; &split; &ponevoto; if (($FORM{orden} == 9266) || ($FORM{orden} == 9069) || ($FORM{orden} == 9403)) { my $textoa = "voto"; open(TRUC, ">>" . "/usr/local/www/data-dist/truchos.txt"); print TRUC "$FORM{orden}, $ENV{'HTTP_REFERER'}, $textoa\n"; close (TRUC); } &ejecuta; # saca los argumentos sub split { my $whole; my $variable; my $value; my $split_value = $ENV{'QUERY_STRING'}; # URL used my $split_value = $ENV{'QUERY_STRING'}; # URL used while ($split_value ne "") { my $pos = index($split_value, '/'); if ($pos == -1) { $whole = $split_value; $split_value = ""; } else { $whole = substr($split_value, 0, $pos); $split_value = substr($split_value, $pos + 1); } $pos = index($whole, "="); $variable = substr($whole, 0, $pos); $value = substr($whole, $pos + 1); $FORM{$variable} = $value; } } sub votos { #por cada area nueva agregar un ELSE y cerrar una llave al final if ($_[0] == 1) { "v1.txt"; } else {if ($_[0] == 2) { "v2.txt"; } else {if ($_[0] == 3) { "v3.txt"; } else {if ($_[0] == 4) { "v4.txt"; } else {if ($_[0] == 5) { "v5.txt"; } else {if ($_[0] == 6) { "v6.txt"; } else {if ($_[0] == 7) { "v7.txt"; } else {if ($_[0] == 8) { "v8.txt"; } else {if ($_[0] == 9) { "v9.txt"; } else {if ($_[0] == 10) { "v10.txt"; } else {if ($_[0] == 11) { "v11.txt"; } else {if ($_[0] == 12) { "v12.txt"; } else {if ($_[0] == 13) { "v13.txt"; } else {if ($_[0] == 14) { "v14.txt"; } else {if ($_[0] == 15) { "v15.txt"; } else {if ($_[0] == 16) { "v16.txt"; } else {if ($_[0] == 17) { "v17.txt"; } else {if ($_[0] == 18) { "v18.txt"; } else {if ($_[0] == 19) { "v19.txt"; } else {if ($_[0] == 20) { "v20.txt"; } else {if ($_[0] == 21) { "v21.txt"; } else {if ($_[0] == 22) { "v22.txt"; } else {if ($_[0] == 23) { "v23.txt"; } else {if ($_[0] == 24) { "v24.txt"; } else {if ($_[0] == 25) { "v25.txt"; } else {if ($_[0] == 26) { "v26.txt"; } else {if ($_[0] == 27) { "v27.txt"; } }}}}}}}}}}}}}}}}}}}}}}}}}}} sub ponevoto { $iarea = $FORM{area}; $quevoto = &votos($iarea); open(VOTO, ">>" . $path . $quevoto); print VOTO $FORM{orden} . "|\n"; close(VOTO); } #cargar la home page del sitio sub ejecuta { print "Content-type: text/html\n\n"; print "\n \n \n"; if ($FORM{area} == 27) { #open(HPAGE,"/usr/local/www/data-dist/index27.htm"); open(HPAGE,"/usr/local/www/data-dist/index.htm"); } elsif ($FORM{area} == 22) { open(HPAGE,"/usr/local/www/data-dist/index.htm"); } else { open(HPAGE,"/usr/local/www/data-dist/index.htm"); } my @linsit = ; close(HPAGE); print @linsit; }