什么地方有用php写的程序语法高亮的代码? highlight_string()或show_source()highlight_file();看手册 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 up像editplus,你在参数选项的设置和语法中自己定制就可以了,其他的类似。 highlight_string()highlight_file()这两个函数可以高亮度显示php代码其他代码不行 http://phpuser.com 网站用到了这个东西,你可以去研究一下啦。 (“语法加亮”显示PHP的原代码) 兄弟你有福呀!<? if($simple == "y") { header( "Content-type: text/plain"); // $filename = "/usr/local/something.txt"; $dirr = $page_url; if(!eregi( "/etc/passwd", $dirr)) { $dir = "./"; $fd = fopen($dir.$page_url, "r"); $contents = fread( $fd, filesize($page_url)); echo $contents; fclose($fd); } else { echo "<html><head><title></title></head><body>n"; echo "<center>n"; echo "<FONT COLOR="#FF0000" size=+2 FACE="Arial, Sans-serif"><h1>WARNING:</h1></font>n"; echo "</center>n"; echo "sorry you may <blink><b><font size="+2">NOT</font></b></blink> access the passwd file :-) "; $dte = date( "l dS of F Y h:i:s A"); $remote_ip = getenv( "REMOTE_ADDR"); $requested = getenv( "REQUEST_URI"); mail( "[email protected]", "[darkseed] password access", "A user at $dte tried to access the /etc/passwdn $remote_ipn$requestedn"); echo "your remote IP is mailed to the sysadmin right now!,after 3 or more attempts you domain is being blocked! if you don't wan't this or you accedently accessed the passwd (Yeah right?!) please mail to <a href="mailto:[email protected]">[email protected]</a>"; echo "</body></html>n"; } } else { ?> <!-- REQUIRED PARAMETERS TO URL: ----------------------------------------------------------------- page_url - The php page you wish to view. Default from Rasmus Lerdor. Example: http://gw/source.php3?page_url=/mail.php3 OPTIONAL PARAMETERS TO URL: ---------------------------------------------------------------- &fontsize={size} - Something I've implemented to keep long code lines from word wrapping to next line. (keeps same font throughout). Example: http://gw/source.php3?page_url=/myphpdoc.php3&fontsize=-3 &formatcode={any} - Uses the html tag "<code>" and "</code>" around the php3 code. (This is for us who are mono-spaced code writers and like to see our code documentation as such). &formatcode must be lower case and can be set to any value. Example: http://gw/source.php3?page_url=/myphpdoc.php3&formatcode=y Example with all parameters: http://gw/source.php3?page_url=/source.php3&formatcode=y&fontsize=-2 //--> <?php $page_url=escapeshellcmd($page_url); if($simple == "y") { $page_url=escapeshellcmd($dir.$page_url); } if (!isset($page_url)) { echo( "Invalid page URL specified. Try:<BR><B>source.php3?page_url=/source.php3</B>"); exit; } ?> <HTML> <HEAD> <TITLE>Source: <?echo $page_url; ?></TITLE> </HEAD> <BODY bgcolor=white> <? /* include "rotate.php3"; if($lnk[$i] != "" && $img[$i] != ""){ echo($lnk[$i].$img[$i]."</A>"); if($comments){ if($cmt[$i]){ echo("<br>$cmt[$i]"); }else{ echo("<br>$dcomment"); } } }else{ echo($errormsg); } */ ?> <a href="http://www.teknosurf3.com/cgi-bin/ads.pl?darkseed+K+index+1+advert=NonSSI"> <img src="http://www.teknosurf3.com/cgi-bin/ads.pl?darkseed+K+index+1" valign=top></a> <div align="left"> <table border="0" width="620" align="left" cellspacing="0" cellpadding="0"> <tr> <td width="100%"> <FONT FACE="Arial, Sans-Serif, Serif"><P ALIGN="right"> [ <a href="http://www.darkseed.net/php3/list.php3">BACK</a> ]</P> </FONT> <FONT FACE="tahoma, verdana, arial, sans-serif" SIZE=6> <B><FONT COLOR=NAVY>PHP Source Code of <?php echo $page_url; ?></FONT></B><BR> <?php if (!isset($fontsize)) { echo "<FONT SIZE=3 FACE="Arial, Sans-serif, Sans, Serif">"; } else { echo "<FONT SIZE=".$fontsize. ">"; } ?> <HR COLOR=NAVY NOSHADE> <?php $simple = "false"; $legal_dirs = array( "/manual"=>1, "/include"=>1, "/php3"=>1); $dir = dirname($page_url); if ($dir && $legal_dirs[$dir]) { $page_name = $DOCUMENT_ROOT . $page_url; } else { $page_name = basename($page_url); } echo( "<!-- $page_name -->n"); if (file_exists($page_name)) { $datemod = date( "h:i A m/d/Y", filectime($page_name)); $strlastmod=( "<B>Last Modified: </B>".$datemod); $strprintdate= " <B>Modification date: </B>".date( "h:i A m/d/Y"); $sfilesize= " <B>Size: </B>".filesize($page_name); $strlastmod=$strlastmod.$strprintdate.$sfilesize; echo $strlastmod; echo( "<BR><HR NOSHADE COLOR=NAVY>"); /* if (isset($formatcode)) */ echo( "<CODE>"); show_source( "./".$page_name); /* if (isset($formatcode)) */ echo( "</CODE>"); } ?> <HR COLOR=NAVY NOSHADE> </td> </tr> <tr> <td> <FONT FACE="Arial, Sans-Serif, Serif"><P ALIGN="right"> [ <a href="http://www.darkseed.net/php3/list.php3">BACK</a> ]</A> </FONT> <br> <? include "rotate.php3"; if($lnk[$i] != "" && $img[$i] != ""){ echo($lnk[$i].$img[$i]. "</A>"); if($comments){ if($cmt[$i]){ echo( "<br>$cmt[$i]"); }else{ echo( "<br>$dcomment"); } } }else{ echo($errormsg); } ?> </td> </tr> </table> </div> </BODY> </HTML> <? } ?> 楼上的代码其实精华的就是show_source()函数,可以高亮显示php代码btw,上面代码有安全漏洞 回溯算法,非算法高手勿进! 求正则表达式(?<=[^\]a-z0-9-=\"'\\/])这块什么意思 php中序列化函数,json函数分别在什么时候用?想听下各位的经验之谈 PHP 多表查询的问题 拜求各位大神赐教..... private和protected 怎么加了一个 { } 就是语法错了? 关于 Warning: session_start() 关于登陆邮件服务器,发送邮件的问题。 php多个表查询的问题 josn转数组 疑问,请PHP高手帮助 请教申请过主页的朋友一个问题
像editplus,你在参数选项的设置和语法中自己定制就可以了,
其他的类似。
highlight_file()这两个函数可以高亮度显示php代码
其他代码不行
if($simple == "y") {
header( "Content-type: text/plain");
// $filename = "/usr/local/something.txt";
$dirr = $page_url;
if(!eregi( "/etc/passwd", $dirr)) {
$dir = "./";
$fd = fopen($dir.$page_url, "r");
$contents = fread( $fd, filesize($page_url));
echo $contents;
fclose($fd);
} else {
echo "<html><head><title></title></head><body>n";
echo "<center>n";
echo "<FONT COLOR="#FF0000" size=+2 FACE="Arial, Sans-serif"><h1>WARNING:</h1></font>n";
echo "</center>n";
echo "sorry you may <blink><b><font size="+2">NOT</font></b></blink> access the passwd file :-) ";
$dte = date( "l dS of F Y h:i:s A");
$remote_ip = getenv( "REMOTE_ADDR");
$requested = getenv( "REQUEST_URI");
mail( "[email protected]", "[darkseed] password access",
"A user at $dte tried to access the /etc/passwdn $remote_ipn$requestedn");
echo "your remote IP is mailed to the sysadmin right now!,
after 3 or more attempts you domain is being blocked! if you don't wan't
this or you accedently accessed the passwd (Yeah right?!)
please mail to <a href="mailto:[email protected]">[email protected]</a>";
echo "</body></html>n";
} } else {
?> <!--
REQUIRED PARAMETERS TO URL:
-----------------------------------------------------------------
page_url - The php page you wish to view. Default
from Rasmus Lerdor.
Example:
http://gw/source.php3?page_url=/mail.php3
OPTIONAL PARAMETERS TO URL:
----------------------------------------------------------------
&fontsize={size} - Something I've implemented to keep long
code lines from word wrapping to next line.
(keeps same font throughout).
Example:
http://gw/source.php3?page_url=/myphpdoc.php3&fontsize=-3
&formatcode={any} - Uses the html tag "<code>" and "</code>"
around the php3 code. (This is for us
who are mono-spaced code writers and like
to see our code documentation as such).
&formatcode must be lower case and can
be set to any value.
Example:
http://gw/source.php3?page_url=/myphpdoc.php3&formatcode=y Example with all parameters:
http://gw/source.php3?page_url=/source.php3&formatcode=y&fontsize=-2
//-->
<?php $page_url=escapeshellcmd($page_url);
if($simple == "y") { $page_url=escapeshellcmd($dir.$page_url); } if (!isset($page_url)) {
echo( "Invalid page URL specified. Try:<BR><B>source.php3?page_url=/source.php3</B>");
exit;
}
?>
<HTML>
<HEAD>
<TITLE>Source: <?echo $page_url; ?></TITLE>
</HEAD>
<BODY bgcolor=white>
<?
/*
include "rotate.php3";
if($lnk[$i] != "" && $img[$i] != ""){
echo($lnk[$i].$img[$i]."</A>");
if($comments){
if($cmt[$i]){
echo("<br>$cmt[$i]");
}else{
echo("<br>$dcomment");
}
}
}else{
echo($errormsg);
}
*/
?> <a href="http://www.teknosurf3.com/cgi-bin/ads.pl?darkseed+K+index+1+advert=NonSSI">
<img src="http://www.teknosurf3.com/cgi-bin/ads.pl?darkseed+K+index+1" valign=top></a> <div align="left">
<table border="0" width="620" align="left" cellspacing="0" cellpadding="0">
<tr>
<td width="100%">
<FONT FACE="Arial, Sans-Serif, Serif"><P ALIGN="right">
[ <a href="http://www.darkseed.net/php3/list.php3">BACK</a> ]</P>
</FONT>
<FONT FACE="tahoma, verdana, arial, sans-serif" SIZE=6>
<B><FONT COLOR=NAVY>PHP Source Code of <?php echo $page_url; ?></FONT></B><BR> <?php if (!isset($fontsize)) {
echo "<FONT SIZE=3 FACE="Arial, Sans-serif, Sans, Serif">";
} else {
echo "<FONT SIZE=".$fontsize. ">";
}
?> <HR COLOR=NAVY NOSHADE> <?php
$simple = "false";
$legal_dirs = array( "/manual"=>1, "/include"=>1, "/php3"=>1);
$dir = dirname($page_url); if ($dir && $legal_dirs[$dir]) {
$page_name = $DOCUMENT_ROOT . $page_url;
} else {
$page_name = basename($page_url);
} echo( "<!-- $page_name -->n"); if (file_exists($page_name)) {
$datemod = date( "h:i A m/d/Y", filectime($page_name));
$strlastmod=( "<B>Last Modified: </B>".$datemod);
$strprintdate= " <B>Modification date: </B>".date( "h:i A m/d/Y");
$sfilesize= " <B>Size: </B>".filesize($page_name);
$strlastmod=$strlastmod.$strprintdate.$sfilesize;
echo $strlastmod;
echo( "<BR><HR NOSHADE COLOR=NAVY>");
/* if (isset($formatcode)) */ echo( "<CODE>");
show_source( "./".$page_name);
/* if (isset($formatcode)) */ echo( "</CODE>");
}
?> <HR COLOR=NAVY NOSHADE>
</td>
</tr>
<tr>
<td>
<FONT FACE="Arial, Sans-Serif, Serif"><P ALIGN="right">
[ <a href="http://www.darkseed.net/php3/list.php3">BACK</a> ]</A>
</FONT>
<br>
<?
include "rotate.php3";
if($lnk[$i] != "" && $img[$i] != ""){
echo($lnk[$i].$img[$i]. "</A>");
if($comments){
if($cmt[$i]){
echo( "<br>$cmt[$i]");
}else{
echo( "<br>$dcomment");
}
}
}else{
echo($errormsg);
}
?>
</td>
</tr>
</table>
</div>
</BODY>
</HTML>
<? } ?>
btw,上面代码有安全漏洞