$_SERVER['HTTP_HOST'] . Only for some reason it was said about SQL injection and about anything other than XSS. <script type="text/javascript" src="<?=$_SERVER['HTTP_HOST'] ?>/my.js"></script> www.user.com ". Suppose the address of my site " www.hacker.com ". All I have to do is drop you a link to a special page on my site, from where I will make the most common redirect to your own site. Only for the redirect I use some unusual headlines. As the HTTP target, I will specify your own site " www.user.com ", but as a host - my " www.hacker.com ". Although, in principle, the absolute form of the HTTP target is not unusual.GET http://www.user.com HTTP/1.1
Host:www.hacker.com
SERVER['HTTP_HOST'] substitute my host. Your link src="<?=$_SERVER['HTTP_HOST'] ?>/my.js " will not look like you expected " www.user.com/my.js ", but " www.hacker.com/my.js " As a result, your browser with a clear conscience will download the script from my site and execute it.*.js Link to css also good . Well, or as a last resort, on iframe .Therefore, as usual, never trust the data that came from the client.
Source: https://habr.com/ru/post/279829/
All Articles