rendered paste body<? /** * Parodo failo surce koda * * @param Failas $source * @return grazina html */function source(){ //apsauga : pakeiciam failo pavadinima kuris prasideda ../ $code=explode("/",getenv("SCRIPT_NAME")); $code=$code[count($code)-1]; $code=ereg_replace("(\.\.)+","",$code); //truputeli patvarkom koda $code=ereg_replace("([_a-zA-Z0-9-]+)+/([_a-zA-Z0-9-]+\.)+php","\\0</a>",$code); $forbiddenfile="db.inc.php|.htaccess|config.php"; if(ereg($forbiddenfile,$code)) { echo "The file that you want to show the source is not allowed"; exit; } clearstatcache(); if(!file_exists($code)) { return false; } $handle=fopen($code,"r"); // atidaryti source koda $size=filesize($code); $temp=fread($handle,$size); echo "<B><FONT size=3>"; $colorcode=highlight_string($temp); // nustatome spalvas echo "</font></b>"; return true;}//naudojimo pavyzdyssource();?>