Fixed bug #10304: Links in the warning box are not visible as links (thanks to Georg...
[Packages/TYPO3.CMS.git] / misc / phpcheck / incfile.php
1 <?php
2 // This checks for my own IP at home. You can just remove the if-statement.
3 if (1==0 || ($_SERVER['REMOTE_ADDR']!='127.0.0.1')) {
4 die('In the source distribution of TYPO3, this script is disabled by a die() function call.<br/><b>Fix:</b> Open the file misc/phpcheck/incfile.php and remove/out-comment the line that outputs this message!');
5 }
6
7 SetCookie('test_script_cookie', 'Cookie Value!', 0, '/');
8
9 include('../../t3lib/class.t3lib_div.php');
10
11 error_reporting (E_ALL ^ E_NOTICE);
12
13 define("TYPO3_OS", stristr(PHP_OS,"win")&&!stristr(PHP_OS,"darwin")?"WIN":"");
14 /*
15 define("PATH_thisScript",
16 TYPO3_OS=="WIN" ?
17 str_replace('//','/',str_replace('\\','/', $HTTP_SERVER_VARS["PATH_TRANSLATED"]?$HTTP_SERVER_VARS["PATH_TRANSLATED"]:getenv("PATH_TRANSLATED"))) :
18 (php_sapi_name()=="cgi"?(getenv("PATH_TRANSLATED")?getenv("PATH_TRANSLATED"):getenv("SCRIPT_FILENAME")):$HTTP_SERVER_VARS["PATH_TRANSLATED"])
19 );
20 */
21
22 define("PATH_thisScript", str_replace('//','/', str_replace('\\','/', php_sapi_name()=="cgi"||php_sapi_name()=="isapi" ? $HTTP_SERVER_VARS["PATH_TRANSLATED"]:$HTTP_SERVER_VARS["SCRIPT_FILENAME"])));
23 define('PATH_site', dirname(PATH_thisScript).'/');
24
25
26
27 if (count($_GET) || $_SERVER["HTTP_REFERER"]) {
28 # KOMPENSATED:
29 echo "<H3>t3lib_div::getIndpEnv()</H3><p>These are 'system variables' returned from t3lib_div::getIndpEnv() and should be universal for any server configuration:</p>";
30 t3lib_div::debug(t3lib_div::getIndpEnv("_ARRAY"));
31
32 t3lib_div::debug(array(
33 "PHP_OS"=>PHP_OS,
34 "TYPO3_OS"=>TYPO3_OS,
35 "PATH_thisScript"=>PATH_thisScript,
36 "php_sapi_name()" => php_sapi_name()
37 ));
38
39
40
41
42 ##t3lib_div::debug(parse_url("http://admin:palindrom@192.168.1.4:8080/typo3/32/temp/phpcheck/index.php/arg1/arg2/arg3/index.php?arg1,arg2,arg3&p1=parameter1&p2[key]=value#link1"));
43
44
45 echo "<H3>Raw values</H3><p>These are the raw 'system variables' returned from getenv(), HTTP_SERVER_VARS, HTTP_ENV_VARS etc. These are displayed here so we can find the right values via this testscript to map to with t3lib_div::getIndpEnv()</p>";
46 $envTestVars = explode(",","REQUEST_URI,REMOTE_ADDR,REMOTE_HOST,PATH_INFO,SCRIPT_NAME,SCRIPT_FILENAME,HTTP_HOST,HTTP_USER_AGENT,HTTP_ACCEPT_ENCODING,HTTP_REFERER,QUERY_STRING");
47 $lines=array();
48 $lines[] = '<tr bgcolor="#eeeeee">
49 <td>Key</td>
50 <td nowrap>getenv()</td>
51 <td nowrap>HTTP_SERVER_VARS</td>
52 <td nowrap>_SERVER</td>
53 <td nowrap>HTTP_ENV_VARS</td>
54 <td nowrap>_ENV</td>
55 </tr>';
56 while(list(,$v)=each($envTestVars)) {
57 $lines[] = '<tr>
58 <td bgcolor="#eeeeee">'.htmlspecialchars($v).'</td>
59 <td nowrap>'.htmlspecialchars(getenv($v)).'&nbsp;</td>
60 <td nowrap>'.htmlspecialchars($GLOBALS["HTTP_SERVER_VARS"][$v]).'&nbsp;</td>
61 <td nowrap>'.htmlspecialchars($GLOBALS["_SERVER"][$v]).'&nbsp;</td>
62 <td nowrap>'.htmlspecialchars($GLOBALS["HTTP_ENV_VARS"][$v]).'&nbsp;</td>
63 <td nowrap>'.htmlspecialchars($GLOBALS["_ENV"][$v]).'&nbsp;</td>
64 </tr>';
65 }
66 echo '<table border=1 style="font-family:verdana; font-size:10px;">'.implode("",$lines).'</table>';
67
68 echo '<table border=1 style="font-family:verdana; font-size:10px;">
69 <tr><td>'.htmlspecialchars('$GLOBALS["HTTP_SERVER_VARS"]["DOCUMENT_ROOT"]').'</td><td>'.htmlspecialchars($GLOBALS["HTTP_SERVER_VARS"]["DOCUMENT_ROOT"]).'</td></tr>
70 <tr><td>'.htmlspecialchars('$HTTP_SERVER_VARS["PATH_TRANSLATED"]').'</td><td>'.htmlspecialchars($HTTP_SERVER_VARS["PATH_TRANSLATED"]).'</td></tr>
71 <tr><td>'.htmlspecialchars('$GLOBALS["HTTP_SERVER_VARS"]["REDIRECT_URL"]').'</td><td>'.htmlspecialchars($GLOBALS["HTTP_SERVER_VARS"]["REDIRECT_URL"]).'</td></tr>
72 <tr><td>'.htmlspecialchars('$GLOBALS["HTTP_SERVER_VARS"]["REQUEST_URI"]').'</td><td>'.htmlspecialchars($GLOBALS["HTTP_SERVER_VARS"]["REQUEST_URI"]).'</td></tr>
73 </table>';
74
75
76
77 echo "Cookie 'test_script_cookie': '<strong>".$HTTP_COOKIE_VARS["test_script_cookie"]."</strong>'<BR>";
78
79
80 echo '<HR><a name="link1"></a>';
81 echo '<div style="border: 1px solid black; padding: 10px 10px 10px 10px;"><h3>What to do now?</h3>
82 <p>1) Click this link above once more: <a href="index.php?arg1,arg2,arg3&p1=parameter1&p2[key]='.substr(md5(time()),0,4).'#link1">Go to this page again.</a><BR>
83 2) Then save this HTML-page and send it to kasperYYYY@typo3.com with information about 1) which webserver (Apache/ISS), 2) Unix/Windows, 3) CGI or module (ISAPI)<br>
84 2a) You might help us find any differences in your values to this <a href="reference.html" target="_blank">reference example</a> by comparing the values before you send the result (thanks).
85 <br>
86 3) If you are really advanced you try and click the link below here. With CGI-versions of servers it will most likely give an error page. If it does not, please send the output to me as well (save HTML-page and send to kasperYYYY@typo3.com). If you do this PATH_INFO test, please let me know.<br><br>
87
88 4) For the really, really advanced folks, it might be interesting to see the output if you could place this link in the root of a domain. That means the index.php script will be executed from eg. "http://www.blablabla.com/" and not "http://www.blablabla.com/kaspers_test/" - it can make a difference.<br>
89 <br>
90 <br>
91 I am operating with these categories of servers. <strong>Please identify your configuration and label your email with that "type":</strong><br><br>
92
93 <table border=1>
94 <tr bgcolor="#eeeeee">
95 <td><em>TYPE:</em></td>
96 <td><em>Description:</em></td>
97 </tr>
98 <tr>
99 <td>WA13CGI</td>
100 <td>Windows / Apache 1.3.x / CGI</td>
101 </tr>
102 <tr>
103 <td>WA2CGI</td>
104 <td>Windows / Apache 2.x / CGI</td>
105 </tr>
106 <tr>
107 <td>WA13ISAPI</td>
108 <td>Windows / Apache 1.3.x / ISAPI-module</td>
109 </tr>
110 <tr>
111 <td>WA2ISAPI</td>
112 <td>Windows / Apache 2.x / ISAPI-module</td>
113 </tr>
114 <tr>
115 <td>WISS_CGI</td>
116 <td>Windows / ISS / CGI</td>
117 </tr>
118 <tr>
119 <td>WISS_ISAPI</td>
120 <td>Windows / ISS / ISAPI-module</td>
121 </tr>
122 <tr>
123 <td>MA13MOD</td>
124 <td>Mac (Darwin) / Apache 1.3.x / Module</td>
125 </tr>
126 <tr>
127 <td>LA13CGI</td>
128 <td>Linux / Apache 1.3.x / CGI</td>
129 </tr>
130 <tr>
131 <td>LA2CGI</td>
132 <td>Linux / Apache 2.x / CGI</td>
133 </tr>
134 <tr>
135 <td>LA13MOD</td>
136 <td>Linux / Apache 1.3.x / Module</td>
137 </tr>
138 <tr>
139 <td>LA2MOD</td>
140 <td>Linux / Apache 2.x / Module</td>
141 </tr>
142 </table>
143
144
145 </p></div>';
146 echo '<a href="index.php/arg1/arg2/arg3/#link2" name="link2">Go to this page again (PATH_INFO).</a><BR>';
147
148 phpinfo();
149 } else {
150 echo '<a href="index.php?arg1,arg2,arg3&p1=parameter1&p2[key]=value#link1" name="link1">Click this link to start the test.</a><BR>';
151 }
152 ?>