/src/typo3_src-4.2.0alpha1/misc/phpcheck/incfile.php

00001 <?php
00002         // This checks for my own IP at home. You can just remove the if-statement.
00003 if (1==0 || ($_SERVER['REMOTE_ADDR']!='127.0.0.1'))     {
00004         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!');
00005 }
00006 
00007 SetCookie('test_script_cookie', 'Cookie Value!', 0, '/');
00008 
00009 include('../../t3lib/class.t3lib_div.php');
00010 
00011 error_reporting (E_ALL ^ E_NOTICE);
00012 
00013 define("TYPO3_OS", stristr(PHP_OS,"win")&&!stristr(PHP_OS,"darwin")?"WIN":"");
00014 /*
00015 define("PATH_thisScript",
00016         TYPO3_OS=="WIN" ?
00017         str_replace('//','/',str_replace('\\','/', $HTTP_SERVER_VARS["PATH_TRANSLATED"]?$HTTP_SERVER_VARS["PATH_TRANSLATED"]:getenv("PATH_TRANSLATED"))) :
00018         (php_sapi_name()=="cgi"?(getenv("PATH_TRANSLATED")?getenv("PATH_TRANSLATED"):getenv("SCRIPT_FILENAME")):$HTTP_SERVER_VARS["PATH_TRANSLATED"])
00019 );
00020         */
00021 
00022 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"])));
00023 define('PATH_site', dirname(PATH_thisScript).'/');
00024 
00025 
00026 
00027 if (count($_GET) || $_SERVER["HTTP_REFERER"])   {
00028         # KOMPENSATED:
00029         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>";
00030         t3lib_div::debug(t3lib_div::getIndpEnv("_ARRAY"));
00031 
00032         t3lib_div::debug(array(
00033                 "PHP_OS"=>PHP_OS,
00034                 "TYPO3_OS"=>TYPO3_OS,
00035                 "PATH_thisScript"=>PATH_thisScript,
00036                 "php_sapi_name()" => php_sapi_name()
00037         ));
00038 
00039 
00040 
00041 
00042         ##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"));
00043 
00044 
00045         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>";
00046         $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");
00047         $lines=array();
00048                 $lines[] = '<tr bgcolor="#eeeeee">
00049                         <td>Key</td>
00050                         <td nowrap>getenv()</td>
00051                         <td nowrap>HTTP_SERVER_VARS</td>
00052                         <td nowrap>_SERVER</td>
00053                         <td nowrap>HTTP_ENV_VARS</td>
00054                         <td nowrap>_ENV</td>
00055                 </tr>';
00056         while(list(,$v)=each($envTestVars))     {
00057                 $lines[] = '<tr>
00058                         <td bgcolor="#eeeeee">'.htmlspecialchars($v).'</td>
00059                         <td nowrap>'.htmlspecialchars(getenv($v)).'&nbsp;</td>
00060                         <td nowrap>'.htmlspecialchars($GLOBALS["HTTP_SERVER_VARS"][$v]).'&nbsp;</td>
00061                         <td nowrap>'.htmlspecialchars($GLOBALS["_SERVER"][$v]).'&nbsp;</td>
00062                         <td nowrap>'.htmlspecialchars($GLOBALS["HTTP_ENV_VARS"][$v]).'&nbsp;</td>
00063                         <td nowrap>'.htmlspecialchars($GLOBALS["_ENV"][$v]).'&nbsp;</td>
00064                 </tr>';
00065         }
00066         echo '<table border=1 style="font-family:verdana; font-size:10px;">'.implode("",$lines).'</table>';
00067 
00068         echo '<table border=1 style="font-family:verdana; font-size:10px;">
00069         <tr><td>'.htmlspecialchars('$GLOBALS["HTTP_SERVER_VARS"]["DOCUMENT_ROOT"]').'</td><td>'.htmlspecialchars($GLOBALS["HTTP_SERVER_VARS"]["DOCUMENT_ROOT"]).'</td></tr>
00070         <tr><td>'.htmlspecialchars('$HTTP_SERVER_VARS["PATH_TRANSLATED"]').'</td><td>'.htmlspecialchars($HTTP_SERVER_VARS["PATH_TRANSLATED"]).'</td></tr>
00071         <tr><td>'.htmlspecialchars('$GLOBALS["HTTP_SERVER_VARS"]["REDIRECT_URL"]').'</td><td>'.htmlspecialchars($GLOBALS["HTTP_SERVER_VARS"]["REDIRECT_URL"]).'</td></tr>
00072         <tr><td>'.htmlspecialchars('$GLOBALS["HTTP_SERVER_VARS"]["REQUEST_URI"]').'</td><td>'.htmlspecialchars($GLOBALS["HTTP_SERVER_VARS"]["REQUEST_URI"]).'</td></tr>
00073         </table>';
00074 
00075 
00076 
00077         echo "Cookie 'test_script_cookie': '<strong>".$HTTP_COOKIE_VARS["test_script_cookie"]."</strong>'<BR>";
00078 
00079 
00080         echo '<HR><a name="link1"></a>';
00081         echo '<div style="border: 1px solid black; padding: 10px 10px 10px 10px;"><h3>What to do now?</h3>
00082                 <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>
00083                 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>
00084                 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).
00085                 <br>
00086                 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>
00087 
00088                 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>
00089                 <br>
00090                 <br>
00091                 I am operating with these categories of servers. <strong>Please identify your configuration and label your email with that "type":</strong><br><br>
00092 
00093                 <table border=1>
00094 <tr bgcolor="#eeeeee">
00095         <td><em>TYPE:</em></td>
00096         <td><em>Description:</em></td>
00097 </tr>
00098 <tr>
00099         <td>WA13CGI</td>
00100         <td>Windows / Apache 1.3.x / CGI</td>
00101 </tr>
00102 <tr>
00103         <td>WA2CGI</td>
00104         <td>Windows / Apache 2.x / CGI</td>
00105 </tr>
00106 <tr>
00107         <td>WA13ISAPI</td>
00108         <td>Windows / Apache 1.3.x / ISAPI-module</td>
00109 </tr>
00110 <tr>
00111         <td>WA2ISAPI</td>
00112         <td>Windows / Apache 2.x / ISAPI-module</td>
00113 </tr>
00114 <tr>
00115         <td>WISS_CGI</td>
00116         <td>Windows / ISS / CGI</td>
00117 </tr>
00118 <tr>
00119         <td>WISS_ISAPI</td>
00120         <td>Windows / ISS / ISAPI-module</td>
00121 </tr>
00122 <tr>
00123         <td>MA13MOD</td>
00124         <td>Mac (Darwin) / Apache 1.3.x / Module</td>
00125 </tr>
00126 <tr>
00127         <td>LA13CGI</td>
00128         <td>Linux / Apache 1.3.x / CGI</td>
00129 </tr>
00130 <tr>
00131         <td>LA2CGI</td>
00132         <td>Linux / Apache 2.x / CGI</td>
00133 </tr>
00134 <tr>
00135         <td>LA13MOD</td>
00136         <td>Linux / Apache 1.3.x / Module</td>
00137 </tr>
00138 <tr>
00139         <td>LA2MOD</td>
00140         <td>Linux / Apache 2.x / Module</td>
00141 </tr>
00142 </table>
00143 
00144 
00145                 </p></div>';
00146         echo '<a href="index.php/arg1/arg2/arg3/#link2" name="link2">Go to this page again (PATH_INFO).</a><BR>';
00147 
00148         phpinfo();
00149 } else {
00150         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>';
00151 }
00152 ?>

This documentation has been generated automatically from TYPO3 source code using Doxygen and is provided as is by Cast Iron Coding as a courtesy to other TYPO3 developers and users. Please consider Cast Iron Coding — a full-service web development agency in Portland, Oregon specializing in TYPO3 extension development — for all of your TYPO3 development and consulting needs!