Table of Contents
phpnow php探针环境检测代码,phpnow探针
用phpnow搭建了一个php环境,那从哪打开数据库列表
构建了PHP环境后,写完的代码放在哪
Home php教程 php手册 phpnow php探针环境检测代码,phpnow探针

phpnow php探针环境检测代码,phpnow探针

Jun 13, 2016 am 09:22 AM
php phpnow

phpnow php探针环境检测代码,phpnow探针

<&#63;php
/*
 http://phpnow.org
 YinzCN_at_Gmail.com
*/

error_reporting(E_ALL);

define('TimeZone', +8.0);

function _GET($n) { return isset($_GET[$n]) &#63; $_GET[$n] : NULL; }
function _SERVER($n) { return isset($_SERVER[$n]) &#63; $_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') &#63; php_ini_loaded_file() : '[undefine]';

if (_GET('act') == 'getip') {
 $i = _SERVER('SERVER_NAME').'|'._SERVER('REMOTE_ADDR').'|'._SERVER('SERVER_SOFTWARE').'|'.(function_exists('mysql_close')&#63;mysql_get_client_info():'').'|'._SERVER('DOCUMENT_ROOT');
 $c = @file_get_contents('http://phpnow.org/myip.php&#63;'.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 style="color: '.$c[$k].';">'.$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 style="color: #008000; font-weight : bold;">Yes</span>');
define('NO', '<span style="color: #ff0000; font-weight : bold;">No</span>');
&#63;>
<!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 &#63; new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
 XMLHttp.onreadystatechange = function() {
  if (XMLHttp.readyState == 4)
  {
   r = XMLHttp.responseText;
   if (r == 'false') $('ip_r').innerHTML = '获取外网 IP 失败!';
   else $('ip_r').innerHTML = '此服务器互联网 IP<br /><a href="http://'+r+'" style="color: #999999;">'+r+'</a>';
  }
 }
 XMLHttp.open("GET", "&#63;act=getip", true);
 XMLHttp.send();
}
</script>
</head>
<body onload="get_ip();">
<div style="margin: 0 auto; width: 600px;">

<div style="height: 60px;">
 <div style="float: right; margin: 5px; text-align: center;">
  <div><a style="color: #ffa500;" href="http://phpnow.org/go.php&#63;id=1005">为何只能本地访问&#63;</a></div>
  <div id="ip_r" style="color: #999999;">正在获取 IP 地址</div>
 </div>

 <div style="float: left;">
  <div style="font-weight: bold; font-size: 2.2em;"><a href="<&#63;=_SERVER('PHP_SELF')&#63;>&#63;" style="text-decoration: none;"><&#63;=colorhost()&#63;></a></div>
  <div style="margin: 5px auto;"># Let's <b style="color: #777BB4;">PHP</b> <b style="color: #FF4500;">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><&#63;=_SERVER('SERVER_NAME')&#63;></td>
 </tr>

 <tr>
  <td class="item">SERVER_ADDR:PORT</td>
  <td><&#63;=_SERVER('SERVER_ADDR').':'._SERVER('SERVER_PORT')&#63;></td>
 </tr>

 <tr>
  <td class="item">SERVER_SOFTWARE</td>
  <td><&#63;=stripos(_SERVER('SERVER_SOFTWARE'), 'PHP')&#63;_SERVER('SERVER_SOFTWARE'):_SERVER('SERVER_SOFTWARE').' PHP/'.PHP_VERSION&#63;></td>
 </tr>

 <tr>
  <td class="item">PHP_SAPI</td>
  <td><&#63;=PHP_SAPI&#63;></td>
 </tr>

 <tr>
  <td class="item" style="color: #ff0000;">php.ini</td>
  <td><&#63;=$Info['php_ini_file']&#63;></td>
 </tr>

 <tr>
  <td class="item">网站主目录</td>
  <td><&#63;=_SERVER('DOCUMENT_ROOT')&#63;></td>
 </tr>

 <tr>
  <td class="item">Server Date / Time</td>
  <td><&#63;=gmdate('Y-m-d', time()+TimeZone*3600)&#63;> <&#63;=gmdate('H:i:s', time()+TimeZone*3600)&#63;> <span style="color: #999999;">(<&#63;=(TimeZone<0&#63;'-':'+').gmdate('H:i', abs(TimeZone)*3600)&#63;>)</span></td>
 </tr>

 <tr>
  <td class="item">Other Links</td>
  <td>
  <a href='<&#63;=_SERVER('PHP_SELF')&#63;>&#63;act=phpinfo'>phpinfo()</a>
  | <&#63;=file_exists('phpMyAdmin') &#63; '<a href="/phpMyAdmin">phpMyAdmin</a>' : '<a href="http://phpnow.org">PHPnow.org</a>'&#63;>
  </td>
 </tr>
</table>

<hr />

<table width="100%" class="info">
 <tr>
  <th colspan="2">PHP 组件支持</th>
 </tr>

 <tr>
  <td class="item">Zend Optimizer</td>
  <td><&#63;=defined('OPTIMIZER_VERSION') &#63; YES.' / '.OPTIMIZER_VERSION : NO&#63;></td>
 </tr>

 <tr>
  <td class="item">MySQL 支持</td>
  <td><&#63;=function_exists('mysql_close') &#63; YES.' / client lib version '.mysql_get_client_info() : NO&#63;></td>
 </tr>

 <tr>
  <td class="item">GD library</td>
  <td><&#63;=function_exists('gd_info') &#63; YES.' / '.get_gd_info('GD Version') : NO&#63;></td>
 </tr>

 <tr>
  <td class="item">eAccelerator</td>
  <td><&#63;=function_exists('eaccelerator_info') &#63; YES.' / '.get_ea_info('version') : NO&#63;></td>
 </tr>
</table>

<hr />

<form method="post" action="<&#63;=_SERVER('PHP_SELF')&#63;>">
<table width="100%" class="info">
 <tr>
  <th colspan="4">MySQL 连接测试</th>
 </tr>

 <tr>
  <td>MySQL 服务器</td>
  <td><input type="text" name="mysqlHost" value="localhost" /></td>
  <td>MySQL 数据库名</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>

<&#63;php if(isset($_POST['act'])) {&#63;>
<br />

<table width="100%" class="info">
 <tr>
  <th colspan="4">MySQL 测试结果</th>
 </tr>

<&#63;php
$link = @mysql_connect($_POST['mysqlHost'], $_POST['mysqlUser'], $_POST['mysqlPassword']);
$errno = mysql_errno();
if ($link) $str1 = '<span style="color: #008000; font-weight: bold;">OK</span> ('.mysql_get_server_info($link).')';
else $str1 = '<span style="color: #ff0000; font-weight: bold;">Failed</span><br />'.mysql_error();
&#63;>
 <tr>
  <td colspan="2">服务器 <&#63;=$_POST['mysqlHost']&#63;></td>
  <td colspan="2"><&#63;=$str1&#63;></td>
 </tr>

 <tr>
  <td colspan="2">数据库 <&#63;=$_POST['mysqlDb']&#63;></td>
  <td colspan="2"><&#63;=(@mysql_select_db($_POST['mysqlDb'],$link))&#63;'<span style="color: #008000; font-weight: bold;">OK</span>':'<span style="color: #ff0000; font-weight: bold;">Failed</span>'&#63;></td>
 </tr>
</table>
<&#63;}&#63;>
<hr />

<p style="text-align: right; margin: 0;"><a href="http://validator.w3.org/check&#63;uri=referer" style="color: #999999;">Valid XHTML 1.0 Strict</a> / <a href="http://zh.wikipedia.org/wiki/Copyleft" style="color: #008000;"><b>Copyleft</b></a> ! 2007-&#63; by <a href="http://phpnow.org">PHPnow.org</a></p>

</div>
</body>
</html>
Copy after login

用phpnow搭建了一个php环境,那从哪打开数据库列表

在浏览器里面输入 127.0.0.1/phpmyadmin
输入账号root 密码安装时你设置的mysql密码 就可以登录管理数据库了

如果phpmyadmin 文件夹被删除或者没有 去phpmyadmin官方下载一个放到htdocs 目录下就行了
 

构建了PHP环境后,写完的代码放在哪

phpnow中的根目录中的htdocs文件夹就是你网页(也就是你的站点)的根目录。当你在浏览器地址栏输入“localhost”或者“http://你的ip地址”的时候,浏览器进入的就是这个htdocs文件夹。刚刚安装完phpnow的时候,你的htdocs文件夹应该有一个index.html文件,你第一次在浏览器地址栏输入“localhost”或者“http://你的ip地址”的时候,浏览器会浏览到index.html这个网页,你需要在这个网页测试一下数据库是否ok。然后你把htdocs文件夹中的index.html改个名字或者移到别的地方去,然后把你的php文件放到这个文件夹中就Ok了。你再在浏览器地址栏输入“localhost”或者“http://你的ip地址”,浏览器会主动搜索根目录也就是htdocs文件夹中的index文件为主页,但是如果你的根目录同时存在index.html和index.php。那么浏览器会先读取html文件,也就是先读取index.html。你也可以在htdocs文件夹中新建一个其他的文件夹,比如你的文件是一个聊天室,那么你新建一个文件夹叫做chat。然后你把你的Php文件放到chat文件夹中。然后在浏览器地址输入“localhost/chat”或者“http://你的ip地址/chat”你的php主页就显示出来了。你也可以利用地址栏不浏览主页。比如你的Php文件中有个文件叫做top.php。那么你可以在地址栏输入“localhost/chat/top.php”或者“http://你的ip地址/chat。php”,就Ok了,应该说清楚了吧??比较啰嗦了。
 

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1664
14
PHP Tutorial
1268
29
C# Tutorial
1248
24
Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Apr 05, 2025 am 12:04 AM

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

PHP Program to Count Vowels in a String PHP Program to Count Vowels in a String Feb 07, 2025 pm 12:12 PM

A string is a sequence of characters, including letters, numbers, and symbols. This tutorial will learn how to calculate the number of vowels in a given string in PHP using different methods. The vowels in English are a, e, i, o, u, and they can be uppercase or lowercase. What is a vowel? Vowels are alphabetic characters that represent a specific pronunciation. There are five vowels in English, including uppercase and lowercase: a, e, i, o, u Example 1 Input: String = "Tutorialspoint" Output: 6 explain The vowels in the string "Tutorialspoint" are u, o, i, a, o, i. There are 6 yuan in total

Explain late static binding in PHP (static::). Explain late static binding in PHP (static::). Apr 03, 2025 am 12:04 AM

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

What are PHP magic methods (__construct, __destruct, __call, __get, __set, etc.) and provide use cases? What are PHP magic methods (__construct, __destruct, __call, __get, __set, etc.) and provide use cases? Apr 03, 2025 am 12:03 AM

What are the magic methods of PHP? PHP's magic methods include: 1.\_\_construct, used to initialize objects; 2.\_\_destruct, used to clean up resources; 3.\_\_call, handle non-existent method calls; 4.\_\_get, implement dynamic attribute access; 5.\_\_set, implement dynamic attribute settings. These methods are automatically called in certain situations, improving code flexibility and efficiency.

PHP and Python: Comparing Two Popular Programming Languages PHP and Python: Comparing Two Popular Programming Languages Apr 14, 2025 am 12:13 AM

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

PHP in Action: Real-World Examples and Applications PHP in Action: Real-World Examples and Applications Apr 14, 2025 am 12:19 AM

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

PHP: A Key Language for Web Development PHP: A Key Language for Web Development Apr 13, 2025 am 12:08 AM

PHP is a scripting language widely used on the server side, especially suitable for web development. 1.PHP can embed HTML, process HTTP requests and responses, and supports a variety of databases. 2.PHP is used to generate dynamic web content, process form data, access databases, etc., with strong community support and open source resources. 3. PHP is an interpreted language, and the execution process includes lexical analysis, grammatical analysis, compilation and execution. 4.PHP can be combined with MySQL for advanced applications such as user registration systems. 5. When debugging PHP, you can use functions such as error_reporting() and var_dump(). 6. Optimize PHP code to use caching mechanisms, optimize database queries and use built-in functions. 7

The Enduring Relevance of PHP: Is It Still Alive? The Enduring Relevance of PHP: Is It Still Alive? Apr 14, 2025 am 12:12 AM

PHP is still dynamic and still occupies an important position in the field of modern programming. 1) PHP's simplicity and powerful community support make it widely used in web development; 2) Its flexibility and stability make it outstanding in handling web forms, database operations and file processing; 3) PHP is constantly evolving and optimizing, suitable for beginners and experienced developers.

See all articles