| AND OR | string words | *

html and code

|

view php source

| see demonstration of view php source


this will show you the source of any PHP file with syntax-highlighting



full source of view php source [ line 1 - 38 ] | download view php source

1    <?php
2    echo '<form name="form1" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
3     // echo '<input type="text" name="selected_file">'; // disabled for demo
4    echo '<input type="text" name="xxx" value="index.php">'// bogus field
5    echo '<input type="hidden" name="selected_file" value="index.php">'// just for demo
6    echo '<input type="submit" value="View">';
7    echo '</form>';
8    echo '<hr>';
9    // security - checks for the right referrer
10    if(substr($_SERVER['HTTP_REFERER'],-strlen($_SERVER["PHP_SELF"])) == $_SERVER["PHP_SELF"])
11       $real_adress 1;
12    else
13       $real_adress 0;
14    if(!$_POST['selected_file'] == '' && $real_adress == 1)
15    {
16        $userfile $_POST['selected_file'];
17        echo '<b>full path:</b> ' $userfile;
18        $myArray split('/'$userfile);
19        $selected_file_name end($myArray);
20        echo '<br /><b>filename:</b> ' $selected_file_name '<hr>'
21        $strFile file($selected_file_name);
22        $newStr join(" ",$strFile);
23        echo '<div style="background:whitesmoke; width: 600px;">';
24         #HTML comment "start copy here"
25         echo "nnn<!--// -----n";
26         echo "START COPY HEREn";
27         echo "----- -->nnn";
28        highlight_string($newStr);
29        // HTML comment "END copy here"
30        echo "nnn<!--// -----n";
31        echo "END COPYn";
32        echo "----- -->nnn";
33        echo '</div>';
34        echo '<p><hr><i>End Of File</i></p>';
35    }else{
36        echo 'Please select a file.';
37    }
38   ?>



18 hits by 9 users in the last 30 minutes.