Include "rpm-qa" file.
[nethome.git] / public_html / cgi-bin / postget.php
1 <?php
2         $path_priv="/home/lace/priv/";
3         $getget=isset($HTTP_GET_VARS["_getget"]);
4         $wherename=($getget ? "_getget" : "_postget");
5         $where=$HTTP_GET_VARS[$wherename];
6         unset($HTTP_GET_VARS[$wherename]);
7
8         foreach ($HTTP_GET_VARS as $key=>$val) {
9                 if (ereg("^_priv_(postget.*)\$",$val,$matched)) {
10                         $permit=array("127.0.0.1"=>1,"192.168.192.1"=>1,"192.168.90.11"=>1,"192.168.90.12"=>1);
11                         if (!$permit[$HTTP_SERVER_VARS["REMOTE_ADDR"]])
12                                 print("Forbidden:"
13                                                 ." REMOTE_ADDR=".htmlspecialchars($HTTP_SERVER_VARS["REMOTE_ADDR"])
14                                                 .",key=".htmlspecialchars($key)
15                                                 .",val=".htmlspecialchars($val)
16                                                 ."<br />"
17                                                 );
18                         else
19                                 $HTTP_GET_VARS[$key]=chop(join(" ",file($path_priv.$matched[1],false/*use_include_path*/)));
20                         }
21                 }
22
23         if ($getget) {
24                 $first='?';
25                 foreach ($HTTP_GET_VARS as $key=>$val) {
26                         $where.="${first}".urlencode($key)."=".urlencode($val);
27                         $first='&';
28                         }
29                 header("Location: $where");
30                 }
31         header("Content-type: text/html");
32         print('<?xml version="1.0" encoding="iso-8859-1"?>'."\n");
33 ?>
34 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
35 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
36 <head><title>postget</title></head>
37 <?php
38
39         if ($getget) {
40                 print(""
41                                 ."<body onload=\"window.location.href=document.links[0].href;\"><p>\n"
42                                 ."<a href=\"".htmlspecialchars($where)."\">get</a>\n"
43                                 ."</p></body>\n");
44                 }
45         else {
46                 print(""
47                                 ."<body onload=\"document.forms[0].submit();\">\n"
48                                 ."<form action=\"".htmlspecialchars($where)."\" method=\"post\"><p>\n");
49                 foreach ($HTTP_GET_VARS as $key=>$val)
50                         print("<input type=\"hidden\" name=\"".htmlspecialchars($key)."\" value=\"".htmlspecialchars($val)."\" />\n");
51                 print("<input type=\"submit\" />\n");
52                 print("</p></form></body>\n");
53                 }
54
55 ?>
56 </html>