<?php/* Use: Save the above code as dao4.php, such as the test Validatecode.rar in the site http://www.php.cn, then use the following code to indicate the download connection. FileName? site=1&file= file such as the following URL: */$ADMIN [' defaulturl '] = "http://www.php.cn/404.htm";//hotlinking return address $okaysites = Array ("http://www.php.cn/", "http://php.cn"); Whitelist $ADMIN [' url_1 '] = "http://www.php.cn/download/"; Download location 1 $ADMIN [' url_2 '] = ""; Download location 2, etc. $reffer = $HTTP _referer; if ($reffer) { $yes = 0; while (list ($domain, $subarray) = each ($okaysites)) { if (Ereg ($subarray, "$reffer")) { $yes = 1; } } $theu = "url". "_" . "$site"; if ($ADMIN [$theu] and $yes = = 1) { header ("Location: $ADMIN [$theu]/$file"), } else { header ("Location: $ Admin[defaulturl] "); } } else {Header ("Location: $ADMIN [Defaulturl]");}?>