Hack Forums
[PHP] php file inclusion - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Web Development (https://hackforums.net/forumdisplay.php?fid=183)
+---- Thread: [PHP] php file inclusion (/showthread.php?tid=5327109)



php file inclusion - BadGame - Jul 4, 2016

Hey,
What i am doing is getting file from folder so that it could execute,
PHP Code

<?php 
$time
=pick('<span class="duration">','</span>',$file);
$banner1 = '<a href="http://go.gl">hi</a>';
$banner2 = '<a href="http://bit.ly [WARNING: potentially infected]">why</a>';
$banners = array($banner1, $banner2);
shuffle($banners);
$homepage = file_get_contents('non.txt');
echo 
''.$homepage.''; 

non.txt
PHP Code

<?php 
<span class="duration">Length '.$time.'</span>'.$banners[0].' 

Instead of executing website shows the non.txt content as
Code
<span class="duration">Length '.$time.'</span>'.$banners[0].'
this but it should execute in the way like
Code
<span class="duration">Length 8 seconds</span><a href="http://bit.ly [WARNING: potentially infected]">why</a>
[/quote]


* - Squito - Jul 4, 2016

Try using eval().
http://php.net/manual/en/function.eval.php