#!c:/apache2triad/perl/bin/perl.exe # usage example http://maint/cgi-bin/galagaHS.pl?hs=b41320bbbDcF #As secial chars cant be sent via http the following code are used # "bbb" replaced with "," # "b" replaced with a " " (yes the "bbb" replacemnt is done first" # "c" replaced with "." # so the above HiScore becomes " 41320,D.F" This was an actual hi score played on a Midway 1981 Galaga PCB. The second successful test. $cgi = new CGI; use CGI qw/:standard/; #qw/:standard/ allows $menu = param('com') rather than $menu = cgi->param('com'); my $cgi = new CGI; for $key ( $cgi->param() ) { $input{$key} = $cgi->param($key); } print qq{Content-type: text/html }; $file = "//maint/htdocs/galagaHS.log"; # This file is later included in the web page with #open file for append open(FILE,">>$file") or die "cant write $file"; ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time); $datestamp = sprintf ("%4d-%02d-%02d %02d:%02d:%02d ",$year+1900,$mon+1,$mday,$hour,$min,$sec) ; #get the text for example b41320bbbDcF into $score my $score = $input{"hs"}; # do the substitutions $score =~ s/bbb/,/g; $score =~ s/b/ /g; $score =~ s/c/\./g; #write to the file print FILE "

" , $datestamp , " , " ,$score;# , "," , $ini; #send some code back to the ESP8266 in case we are doing debug print $score ;#, "," , $ini; print FILE "

\n"; close(FILE); print qq{ }; exit;