您好,登錄后才能下訂單哦!
本篇內(nèi)容介紹了“phpnow php探針環(huán)境檢測(cè)的實(shí)現(xiàn)方法”的有關(guān)知識(shí),在實(shí)際案例的操作過(guò)程中,不少人都會(huì)遇到這樣的困境,接下來(lái)就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!
<?php /* http://phpnow.org YinzCN_at_Gmail.com */ error_reporting(E_ALL); define('TimeZone', +8.0); function _GET($n) { return isset($_GET[$n]) ? $_GET[$n] : NULL; } function _SERVER($n) { return isset($_SERVER[$n]) ? $_SERVER[$n] : '[undefine]'; } if (_GET('act') == 'phpinfo') { if (function_exists('phpinfo')) phpinfo(); else echo 'phpinfo() has been disabled.'; exit; } $Info = array(); $Info['php_ini_file'] = function_exists('php_ini_loaded_file') ? php_ini_loaded_file() : '[undefine]'; if (_GET('act') == 'getip') { $i = _SERVER('SERVER_NAME').'|'._SERVER('REMOTE_ADDR').'|'._SERVER('SERVER_SOFTWARE').'|'.(function_exists('mysql_close')?mysql_get_client_info():'').'|'._SERVER('DOCUMENT_ROOT'); $c = @file_get_contents('http://phpnow.org/myip.php?'.base64_encode($i)); if (preg_match('/^\d+\.\d+\.\d+\.\d+$/', $c) == 1) echo $c; else echo 'false'; exit; } function colorhost() { $c = array('#87cefa', '#ffa500', '#ff6347', '#9acd32', '#32cd32', '#ee82ee'); $a = str_split(_SERVER('SERVER_NAME')); $k = $l = 0; foreach ($a as &$d) { while ($k==$l) $k = array_rand($c); $d = '<b >'.$d.'</b>'; $l = $k; } return implode('', $a); } function get_ea_info($name) { $ea_info = eaccelerator_info(); return $ea_info[$name]; } function get_gd_info($name) { $gd_info = gd_info(); return $gd_info[$name]; } define('YES', '<span >Yes</span>'); define('NO', '<span >No</span>'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>PHPnow Works!</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="author" content="YinzCN" /> <meta name="reply-to" content="YinzCN@Gmail.com" /> <meta name="copyright" content="YinzCN" /> <style type="text/css"> <!-- body { font-family : verdana, tahoma; font-size : 12px; margin-top : 10px; } form { margin : 0; } table { border-collapse : collapse; } .info tr td { border : 1px solid #000000; padding : 3px 10px 3px 10px ; } .info th { border : 1px solid #000000; font-weight : bold; height : 16px; padding : 3px 10px 3px 10px; background-color : #9acd32; } input { border : 1px solid #000000; background-color : #fafafa; } a { text-decoration : none; color : #000000; } a:hover { text-decoration : underline; } a.arrow { font-family : webdings, sans-serif; font-size : 10px; } a.arrow:hover { color : #ff0000; text-decoration : none; } .item { white-space: nowrap; text-align: right; } --> </style> <script type="text/JavaScript"> function $(id) { return document.getElementById(id); } function get_ip() { var XMLHttp, r; XMLHttp = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP"); XMLHttp.onreadystatechange = function() { if (XMLHttp.readyState == 4) { r = XMLHttp.responseText; if (r == 'false') $('ip_r').innerHTML = '獲取外網(wǎng) IP 失敗!'; else $('ip_r').innerHTML = '此服務(wù)器互聯(lián)網(wǎng) IP<br /><a href="http://'+r+'" >'+r+'</a>'; } } XMLHttp.open("GET", "?act=getip", true); XMLHttp.send(); } </script> </head> <body onload="get_ip();"> <div > <div > <div > <div><a href="http://phpnow.org/go.php?id=1005">為何只能本地訪問(wèn)?</a></div> <div id="ip_r" >正在獲取 IP 地址</div> </div> <div > <div ><a href="<?=_SERVER('PHP_SELF')?>?" ><?=colorhost()?></a></div> <div ># Let's <b >PHP</b> <b >now</b> <b>!</b></div> </div> </div> <br /> <table width="100%" class="info"> <tr> <th colspan="2">Server Information</th> </tr> <tr> <td class="item">SERVER_NAME</td> <td><?=_SERVER('SERVER_NAME')?></td> </tr> <tr> <td class="item">SERVER_ADDR:PORT</td> <td><?=_SERVER('SERVER_ADDR').':'._SERVER('SERVER_PORT')?></td> </tr> <tr> <td class="item">SERVER_SOFTWARE</td> <td><?=stripos(_SERVER('SERVER_SOFTWARE'), 'PHP')?_SERVER('SERVER_SOFTWARE'):_SERVER('SERVER_SOFTWARE').' PHP/'.PHP_VERSION?></td> </tr> <tr> <td class="item">PHP_SAPI</td> <td><?=PHP_SAPI?></td> </tr> <tr> <td class="item" >php.ini</td> <td><?=$Info['php_ini_file']?></td> </tr> <tr> <td class="item">網(wǎng)站主目錄</td> <td><?=_SERVER('DOCUMENT_ROOT')?></td> </tr> <tr> <td class="item">Server Date / Time</td> <td><?=gmdate('Y-m-d', time()+TimeZone*3600)?> <?=gmdate('H:i:s', time()+TimeZone*3600)?> <span >(<?=(TimeZone<0?'-':'+').gmdate('H:i', abs(TimeZone)*3600)?>)</span></td> </tr> <tr> <td class="item">Other Links</td> <td> <a href='<?=_SERVER('PHP_SELF')?>?act=phpinfo'>phpinfo()</a> | <?=file_exists('phpMyAdmin') ? '<a href="/phpMyAdmin">phpMyAdmin</a>' : '<a href="http://phpnow.org">PHPnow.org</a>'?> </td> </tr> </table> <hr /> <table width="100%" class="info"> <tr> <th colspan="2">PHP 組件支持</th> </tr> <tr> <td class="item">Zend Optimizer</td> <td><?=defined('OPTIMIZER_VERSION') ? YES.' / '.OPTIMIZER_VERSION : NO?></td> </tr> <tr> <td class="item">MySQL 支持</td> <td><?=function_exists('mysql_close') ? YES.' / client lib version '.mysql_get_client_info() : NO?></td> </tr> <tr> <td class="item">GD library</td> <td><?=function_exists('gd_info') ? YES.' / '.get_gd_info('GD Version') : NO?></td> </tr> <tr> <td class="item">eAccelerator</td> <td><?=function_exists('eaccelerator_info') ? YES.' / '.get_ea_info('version') : NO?></td> </tr> </table> <hr /> <form method="post" action="<?=_SERVER('PHP_SELF')?>"> <table width="100%" class="info"> <tr> <th colspan="4">MySQL 連接測(cè)試</th> </tr> <tr> <td>MySQL 服務(wù)器</td> <td><input type="text" name="mysqlHost" value="localhost" /></td> <td>MySQL 數(shù)據(jù)庫(kù)名</td> <td><input type="text" name="mysqlDb" value="test" /></td> </tr> <tr> <td>MySQL 用戶名</td> <td><input type="text" name="mysqlUser" value="root" /></td> <td>MySQL 用戶密碼</td> <td><input type="text" name="mysqlPassword" /></td> </tr> <tr> <td colspan="4" align="right"><input type="submit" value="連接" name="act" /> </td> </tr> </table> </form> <?php if(isset($_POST['act'])) {?> <br /> <table width="100%" class="info"> <tr> <th colspan="4">MySQL 測(cè)試結(jié)果</th> </tr> <?php $link = @mysql_connect($_POST['mysqlHost'], $_POST['mysqlUser'], $_POST['mysqlPassword']); $errno = mysql_errno(); if ($link) $str1 = '<span >OK</span> ('.mysql_get_server_info($link).')'; else $str1 = '<span >Failed</span><br />'.mysql_error(); ?> <tr> <td colspan="2">服務(wù)器 <?=$_POST['mysqlHost']?></td> <td colspan="2"><?=$str1?></td> </tr> <tr> <td colspan="2">數(shù)據(jù)庫(kù) <?=$_POST['mysqlDb']?></td> <td colspan="2"><?=(@mysql_select_db($_POST['mysqlDb'],$link))?'<span >OK</span>':'<span >Failed</span>'?></td> </tr> </table> <?}?> <hr /> <p ><a href="http://validator.w3.org/check?uri=referer" >Valid XHTML 1.0 Strict</a> / <a href="http://zh.wikipedia.org/wiki/Copyleft" ><b>Copyleft</b></a> ! 2007-? by <a href="http://phpnow.org">PHPnow.org</a></p> </div> </body> </html>
“phpnow php探針環(huán)境檢測(cè)的實(shí)現(xiàn)方法”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識(shí)可以關(guān)注億速云網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實(shí)用文章!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。