source.php Viewing source files _php Tutorial

Source: Internet
Author: User
/**
* Show Source
*
* @author Avenger
* @version $Id 2003-07-10 9:09:03 $
*/
Require_once ' header.inc.php ';

Tpl_load (' Left.tpl ');

Check URL Value
if (!isset ($_get[' file ')) {

$body = "No page URL specified.";

} else {

Fix the security hole, thx for jun_test#hotmail.com
$url = Str_replace ('.. ', ' ', $_get[' file ');

if (file_exists ($url)) {
$body = "

Source of:/". Htmlentities ($url)."

";

If This was a legal dir, then it was under the docroot, else use basename
if (dirname ($url)) {
$page _name = $Global [' Path ']. /$url ";
} else {
$page _name = basename ($url);
}

if (Strpos ($page _name, ' header.inc.php ') | | $page _name== ' header.inc.php ') {$page _name= ' Header.inc.bak ';}
if (Strpos ($page _name, ' config.php ') | | $page _name== ' config.php ') {$page _name= ' My/config.php.bak ';}

$body. = " \ n ";
$body .= highlight_file($page_name,true);
$body .= "
\ n


\ n ";

} else {

$body. = "

The file does not exist!

Exceed PHP was unable to link to the Page you requested. The page might be temporarily unavailable.\n ";
}

}

The $left _1 = ' open source ' (open source) is registered as a certification mark by the non-profit software organization (Open Source Initiative Association of the United States) and is formally defined to describe the software that the source code can be used by the public, and the use of the software, Modifications and distributions are also not subject to license restrictions. Open source software is usually copyrighted ... [More ...] ';

$left _2 = '


Here are some of the common files used by the site:

    • main.php

    • header.inc.php

    • global.php

    • function.inc.php

    • layerout.inc.php

    • calendar.inc.php


The source.php file itself.



';

My name:)
$s _name = ' source.php ';

Import template NOW!!!
$TPL->setfile ("main", "Left.tpl");

Import Block
$TPL->setblock ("main", "Aleft", "left1");

$tpl->setvar (
Array
' Ltitle ' = ' about Open Source ',
' Left ' = $left _1,
));

$tpl->parse (' left1 ', ' Aleft ', true);

$tpl->setvar (
Array
' Ltitle ' = ' other page code ',
' Left ' = $left _2,
));

$tpl->parse (' left1 ', ' Aleft ', true);


$tpl->setvar ("Filehead", File_head ());
$tpl->setvar ("Filepic", "');
$tpl->setvar ("TITLE", "Show Source-". Htmlentities ($url));
$tpl->setvar ("DESC", "open source, Show source,php");
$tpl->setvar ("KEYWORDS", "open source, Show source,php");
$tpl->setvar ("BAR", ");
$tpl->setvar ("BODY", $body);
$tpl->setvar ("Filefoot", File_foot ());

Tpl_output ();
?>

http://www.bkjia.com/PHPjc/317459.html www.bkjia.com true http://www.bkjia.com/PHPjc/317459.html techarticle ? php/** *showsource * * @authorAvengeravenger @php.net * @version $Id 2003-07-109:09:03$ */require_once ' header. Inc.php '; Tpl_load (' Left.tpl '); Checkurlvalue if (!isset ($_get[' file ')) ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.