How can PHP be used to refer back to the index file when opening pages from an iframe?

When opening pages from an iframe in PHP, you can refer back to the index file by using the $_SERVER['HTTP_REFERER'] variable. This variable contains the URL of the page that referred the user to the current page, which in this case would be the index file. By using this variable, you can create a link or redirect the user back to the index file when needed.

<?php
if(isset($_SERVER['HTTP_REFERER'])) {
    $referer = $_SERVER['HTTP_REFERER'];
    echo '<a href="' . $referer . '">Go back to index</a>';
} else {
    echo 'Index file not found.';
}
?>