Announcement:
World of Warcraft Bots, need some help in choosing the best bot?
World of Warcraft Bots, need some help in choosing the best bot?
News Archives
- We ain't dead (28-05-2008)
- The Blogkeepers (07-05-2008)
- RandomBase IRC (26-04-2008)
- Updates (17-04-2008)
- We're baaaaack (12-04-2008)
- There are 14 users online.
- Most users ever online was 424 on 03/16/08.
- Our poor server had to serve 35 pages in the last 15 minutes.
- And yet he managed to generate this page in 0.007 seconds.
Previous [ 1 - 2 - 3 - 4 - 5 - 6 ] Next
Statistics
Affiliates & friends
RandomBase.com isn't just one website - it is more.
Ever noticed that one some of the webmasters city's or script places they have a nice colored output from their codes. But how do they do that ? Simple ! Since PHP 4 you can 'Highlight' a code. This means the code won't be executed but that it will be printed out on a page with pre-defined colors !
To make everything easier PHP has 2 different highlights. A highlight_string and a highlight_file. The difference between those 2 is that highlight_string will only highlight the inserted string so you can code around it. Hightlight file can only output a full file. So when you are going to show the people a bit of your code you use highlight_string put if you want to output a full page code you use highlight_file.
Example 1 : Highlight_string :
<?php
highlight_string("
<?php
echo 'hello';
?>
");
?>
Will output :
<?php
echo 'hello';
?>
Example 2 : Highlight_file :
<?php
echo "<b><u>Test.php :</b></u><br>";
highlight_file("test.php");
?>
and test.php contains :
<?php
echo "test";
?>
Will output :
Test.php :
<?php
echo "test";
?>
It looks the same but with highlight_file you can do a much faster work if you have a script from some pages !
Like when you have a directory full with precious php files that you want to share. Then you can just use this code (php.net + some own edits to prevent people to read other dir's) :
<?php
$file = preg_replace('.', '', $_GET['file']);
if (!isset($file) || trim($file) == '') {
echo 'please pass me something yummy';
die(0);
}
if (!file_exists($file).'.php') {
echo '<b>'.$file.'.php</b> does not seem to exist :(';
die(0);
}
highlight_file($file.'.php');
?>
So file.php?file=test will return
<?php
echo "test";
?>










