将域放入脚本[关闭]

I have a index.php which will be loaded on many sites

<?php
$id=$_GET[id];
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://site1.com/?user_id=86&res=".base64_encode("site2.ru")."&dn=50&delay=1&de=".base64_encode("://SITE_DOMAIN/folder/?id=".$id));
exit;
?>

How can this code be changed, if i need to fill the place "SITE_DOMAIN" with domain name, on which index.php is loaded?

You asked:

i need to fill the place "SITE_DOMAIN" with domain name, on which index.php is loaded

Use $_SERVER['SERVER_NAME'] for this.

See the PHP manual for more detail: http://php.net/manual/en/reserved.variables.server.php