Warning: include(includes//header.php): Failed to open stream: No such file or directory in /home/rwfsycpxpzj0/public_html/sperling.com/a/show-code/index.php on line 9

Warning: include(): Failed opening 'includes//header.php' for inclusion (include_path='.:/opt/alt/php84/usr/share/pear:/opt/alt/php84/usr/share/php:/usr/share/pear:/usr/share/php') in /home/rwfsycpxpzj0/public_html/sperling.com/a/show-code/index.php on line 9
Bird Logo

Showing your code

by tedd




Hello,

Using hight_light(__FILE__) will show all your code, like this (i.e., this script):


<?php session_start();
        
        ini_set('error_reporting', E_ALL);
        ini_set('display_errors',1);        
        ignore_user_abort();
        ini_set( 'register_globals', '0' );
?>

<?php include('includes//header.php'); ?>

    <div id="content">
            
        <img src="images/border/bird.gif"alt="Bird Logo">
                            
        <h1>Showing your code</h1>
        <p>by tedd</p>
        <br/><hr/></br>            
        <?php
        $starttime = microtime();
        $startarray = explode(" ", $starttime);
        $starttime = $startarray[1] + $startarray[0];
        ?>
            
<!-- • -->
<?php

    echo("<h3>Hello,</h3><p>Using hight_light(__FILE__) 
    will show all your code, like this (i.e., this script):</p><br/>");
    
    highlight_file (__FILE__);
    
    echo("<hr><br/><h3>But,</h3><p>Using my code will show 
    only the you code you want to show, between the markers, like 
    this:</p><br/><br/>");

?>
<!-- • -->
        
        <?php include("doc.php") ?>    
        
        <br/><hr/><br/>
        <h3>Here's my code, entitled doc.php</h3>
        
        <?php highlight_file ("doc.php"); ?>
        
        <?php
        $endtime = microtime();
        $endarray = explode(" ", $endtime);
        $endtime = $endarray[1] + $endarray[0];
        $totaltime = $endtime - $starttime; 
        $totaltime = round($totaltime,5);
        echo("<br/><br/><br/>This page loaded in $totaltime seconds.");                        
        ?>        
            
    </div>

<?php include('includes//footer.php'); ?>


But,

Using my code will show only the you code you want to show, between the markers, like this:



CODE:
<?php echo("<h3>Hello,</h3><p>Using hight_light(__FILE__) will show all your code, like this (i.e., this script):</p><br/>"); highlight_file (__FILE__); echo("<hr><br/><h3>But,</h3><p>Using my code will show only the you code you want to show, between the markers, like this:</p><br/><br/>"); ?>



Here's my code, entitled doc.php

<?php

            // What is shown between the • is displayed.
            
            $filename = basename($_SERVER['PHP_SELF']);
            $filesize = filesize($filename);
            $file = fopen( $filename, "r" );
            $text = fread( $file, $filesize );
            fclose( $file );
            
            $marker = "•";    
            $first = strpos($text, $marker) + 8;            
            $last = strrpos($text, $marker) - 6;                
            $len = $last - $first;

            $text = substr ( $text, $first , $len);
            $text = "CODE:<br/>" . htmlspecialchars($text);
            echo("<pre>");        
            echo($text);
            echo("</pre>");        
?>



This page loaded in 0.00091 seconds.

Warning: include(includes//footer.php): Failed to open stream: No such file or directory in /home/rwfsycpxpzj0/public_html/sperling.com/a/show-code/index.php on line 57

Warning: include(): Failed opening 'includes//footer.php' for inclusion (include_path='.:/opt/alt/php84/usr/share/pear:/opt/alt/php84/usr/share/php:/usr/share/pear:/usr/share/php') in /home/rwfsycpxpzj0/public_html/sperling.com/a/show-code/index.php on line 57