Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 39 additions & 23 deletions judges/azenv.php
Original file line number Diff line number Diff line change
@@ -1,32 +1,48 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php
##########################################################################
#
# AZ Environment variables 1.05 © 2024 AZ
# Civil Liberties Advocacy Network
# http://clan.cyaccess.com http://clanforum.cyaccess.com
#
# AZenv is written in PHP & Perl. It is coded to be simple,
# fast and have negligible load on the server.
# AZenv is primarily aimed for programs using external scripts to
# verify the passed Environment variables.
# Only the absolutely necessary parameters are included.
# AZenv is free software; you can use and redistribute it freely.
# Please do not remove the copyright information.
#
##########################################################################
if (isset($_GET["json"])) {
header('Content-Type: application/json');
$arr = array();
foreach ($_SERVER as $header => $value ){
if (strpos($header , 'REMOTE')!== false || strpos($header , 'HTTP')!== false || strpos($header , 'REQUEST') !== false) {
$arr[$header] = $value;
}
}
$json = json_encode($arr);

echo $json;
exit;
} else {
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>AZ Environment variables 1.04</title>
<title>AZ Environment variables 1.05</title>
</head>
<body>
<pre>
<?php
##########################################################################
#
# AZ Environment variables 1.04 � 2004 AZ
# Civil Liberties Advocacy Network
# http://clan.cyaccess.com http://clanforum.cyaccess.com
#
# AZenv is written in PHP & Perl. It is coded to be simple,
# fast and have negligible load on the server.
# AZenv is primarily aimed for programs using external scripts to
# verify the passed Environment variables.
# Only the absolutely necessary parameters are included.
# AZenv is free software; you can use and redistribute it freely.
# Please do not remove the copyright information.
#
##########################################################################

foreach ($_SERVER as $header => $value )
{ if (strpos($header , 'REMOTE')!== false || strpos($header , 'HTTP')!== false ||
strpos($header , 'REQUEST')!== false) {echo $header.' = '.$value."\n"; } }
foreach ($_SERVER as $header => $value ) {
if (strpos($header , 'REMOTE')!== false || strpos($header , 'HTTP')!== false || strpos($header , 'REQUEST')!== false) {
echo $header.' = '.$value."\n";
}
}
}
?>
</pre>
</body>
</html>
</html>
46 changes: 33 additions & 13 deletions judges/azenv.pl
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
#!C:/perl/bin/perl
#!/usr/local/bin/perl
#!/usr/bin/perl
#
# Use the correct shebang according to OS.
# You can rename this script to azenv.cgi if .pl
# extension is not supported.
#
##########################################################################
#
# AZ Environment variables 1.04 � 2004 AZ
#
# AZ Environment variables 1.05 © 2024 AZ
# Civil Liberties Advocacy Network
# http://clan.cyaccess.com http://clanforum.cyaccess.com
#
#
# AZenv is written in PHP & Perl. It is coded to be simple,
# fast and have negligible load on the server.
# AZenv is primarily aimed for programs using external scripts to
Expand All @@ -21,25 +20,46 @@
#
##########################################################################

print <<EOC;
my $query_string = $ENV{'QUERY_STRING'} || '';
%params = map { split(/=/, $_) } split(/&/, $query_string);
if (exists $params{"json"}) {
use JSON;
%arr = ();
foreach $var (keys(%ENV)) {
if ($var =~ /REMOTE/ || $var =~ /HTTP/ || $var =~ /REQUEST/) {
$arr{$var} = $ENV{$var};
}
}
$json = encode_json(\%arr);
print <<EOC;
Content-Type: application/json

$json
EOC

} else {
print <<EOC;
Content-type: text/html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>AZ Environment variables 1.04</title>
<title>AZ Environment variables 1.05</title>
</head>
<body>
<pre>
EOC

foreach $var (keys(%ENV))
{ if ($var =~ /REMOTE/ || $var =~ /HTTP/ || $var =~ /REQUEST/)
{ print $var.' = '.$ENV{$var}."\n"; } }

print <<EOC;

foreach $var (keys(%ENV)) {
if ($var =~ /REMOTE/ || $var =~ /HTTP/ || $var =~ /REQUEST/) {
print $var.' = '.$ENV{$var}."\n";
}
}

print <<EOC;
</pre>
</body>
</html>
EOC
}