From what I gather, you're trying to restrict access to certain files UNLESS the user is logged in.
So you don't want your visitors to be able to get at a file unless PHP says they are allowed to get it. Correct? Something of an online purchase system, buy a picture, but you can't see and download it until after you've paid. Yes?
From that standpoint, you have just a few options that I know of.
www.php.net/readfile
www.php.net/fopen
www.php.net/fpassthru
There is absolutely no reason that those should not work for you.
If you have memory issues, you can increase the memory limit in your php.ini file or use ini_set()
This IS NOT redirecting the user, it is feeding the user a file stream. There is absoultely NO WAY you can REDIRECT the user to the file without invoking .htaccess ( that I know of anyway )
If that will not work for osme reason, you need to explain to us why it won't work for you, so we can see if we can find a way around it.
Furthermore, you SHOULD NOT be using HTTP_REFERER ( the referer ) and you SHOULD NOT be using REMOTE_ADDR ( the IP addr. ) to check whether or not a user is allowed to get a file. HTTP_REFERER is set on the client side, and IP addresses regularly change ON EACH REQUEST for AOL users, can be teh same for many people over Proxy / NAT / Router and can be spoofed.