Page 1 of 1
exploring show_source
Posted: Fri Sep 26, 2003 10:48 pm
by kAsPeR
hm...well, i can't get this code to work...even after overriding safe_mode(i'm on tripod uk)
ne one have ne suggestions?
...btw, blah.php is this program that's running the code...
Code: Select all
<?php
ini_set("safe_mode", "0");
ob_start();
// Show source of file
show_source ( 'blah.php' );
$contents = ob_get_contents();
ob_end_clean();
$contents = explode('<br>', @contents);
echo '<html><body>';
foreach ($contents as $line){
echo '<font color="cccccc"><ul>'.$line.'</ul></font><br>';
}
echo '</body></html>';
?>
?>
Posted: Sat Sep 27, 2003 7:00 am
by JAM
Code: Select all
$contents = explode('<br>', @contents);
and @ ?
Posted: Sat Sep 27, 2003 7:02 am
by Cruzado_Mainfrm
make sure you change the @content to $content cuz that doesn't seem to be a function anyways
Posted: Sat Sep 27, 2003 12:10 pm
by kAsPeR
k...well, this is my new code...does the same thing tho....
Code: Select all
<?php
ini_set("safe_mode", "0");
ob_start();
// Show source of file
show_source ( 'blah.php' );
$contents = ob_get_contents();
ob_end_clean();
$explode_contents = explode('<br>', $contents);
echo '<html><body>';
foreach ($explode_contents as $line){
echo '<font color="cccccc"><ul>'.$line.'</ul></font><br>';
}
echo '</body></html>';
?>
Posted: Sat Sep 27, 2003 12:37 pm
by volka
you can't change the safemode settings via
ini_set()http://php.net/manual/en/features.safe-mode.php wrote:safe_mode "0" PHP_INI_SYSTEM
safe_mode_gid "0" PHP_INI_SYSTEM
safe_mode_include_dir NULL PHP_INI_SYSTEM
safe_mode_exec_dir "" PHP_INI_SYSTEM
safe_mode_allowed_env_vars PHP_ PHP_INI_SYSTEM
safe_mode_protected_env_vars LD_LIBRARY_PATH PHP_INI_SYSTEM
open_basedir NULL PHP_INI_SYSTEM
disable_functions "" PHP_INI_SYSTEM
disable_classes "" PHP_INI_SYSTEM
and
wouldn't make much sense otherwise (from the provider's point of view)
But if your script can get the file's content somehow
mixed highlight_string ( string str [, bool return]) might be useful
btw:
and that's true for show_source et al. as well.
<br /> is used instead of
<br>