Php download page page in div, java script not working

I use ajax to load pages in a div, the page is loading fine but I cannot run php and javascript on this loaded page

on the server I load the page as follows

file_get_contents('../' . $PAGE_URL);

in the browser I set the contents of the div using

eval("var r = " + response.responseText);

and setting innerHTML for this div with receiving information but when I get the new inner page php or java script is not working

mean what should be like that?

+3
source share
3 answers

, php , , , , . - include('../' . $PAGE_URL);, php. javascript, , , <html> <body> <head> div. , , , . <frame>.

+2

javascript , , .

onload(). .

+1
<?php
    $file = false;

    if(isset($_GET['load'] && is_string($_GET['load'])) {
        $tmp = stripclashes($_GET['load']);
        $tmp = str_replace(".","",$tmp);

        $file = $tmp . '.php';
    }

    if($file != false && file_exists($file) && is_readable($file)) {
        require_once $file;
    }

?>

file.php? load = test

PHP, HTML

target = document.getElementById('page');    
target.innerHTML = response.responseText;

, , , . , . , , , responseText DIV, XSS. , . , - file_get_contents, . PHP file_get_contents, ... , . ,

<?php
     echo file_get_contents("http://www.google.com");
?>

, , ? .

AJAX AJAXs?

0

Source: https://habr.com/ru/post/1755779/


All Articles