Re: Hide the real URL
| From: | Richard Lynch | Date: | Fri, 27 Jul 2007 05:04:22 +0000 |
| Subject: | Re: Hide the real URL | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-259629@lists.php.net to get a copy of this message | ||
On Thu, July 26, 2007 8:18 am, elk dolk wrote:
> Hi all,
>
> I want to hide the real URL to my images by masking it with PHP
> the code looks like this:
>
> $query = "SELECT * FROM table";
> $result=mysql_query($query);
>
> while ($row = mysql_fetch_array($result))
> {
> echo "<img
> src='http://www.mysite.com/img/{$FileName}'/>";
> }
>
> if you look at the source in browser you will see:
>
> <img src='http://www.mysite.com/img/111.jpg' />
>
> how can I show it like this:
>
> <img src='show.php?FileName=111.jpg' />
Change the URL to exactly what you typed and write a show.php script
that does a http://php.net/readfile on $FileName
You've missed a few minor bits and pieces, like $FileName never
actually gets pulled out of $row, but you're almost finished, except
for the debugging code and security issues:
http://phpsec.org/
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?