Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use strict;
- use warnings;
- use CGI;
- my $q = CGI->new();
- my $key = $q->param('key');
- my $value = $ENV{$key};
- print "content-type: text/html \n\n";
- my $keys = %ENV;
- print "<html><head><script type=\"text/javascript\">
- function getkey(key) {
- var txtHint = document.getElementById('txtHint');
- if (key=='') {
- {
- txtHint.innerHTML='';
- return;
- }
- if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); }
- else { xmlhttp=new ActiveXObject('Microsoft.XMLHTTP') }
- xmlhttp.onreadystatechange=function() {
- if (xmlhttp.readyState==4 && xmlhttp.status==200) {
- txtHint.innerHTML=xmlhttp.responseText;
- }
- }
- xmlhttp.open('GET','proj3.pl?key='+key,true);
- xmlhttp.sent();
- }
- </script>";
- print "</head><body>";
- print "<div align=\"center\">Please select an ENV key<br>";
- print "<form><select name=\"key\" onchange=\"getkey(this.value)\">\n";
- foreach my $key (keys %ENV) {
- print "<option value=\"$key\">$key</option>", "\n";
- }
- print "</select><input type=\"submit\" value=\"Get the Key Value\">";
- print "</form></div>";
- print "<div align =\"center\" id=\"txtHint\">ENV Key => $key <br> Key Value => $value</div>";
- print "</body></html>";
Advertisement
Add Comment
Please, Sign In to add comment