Re: PHP and Apache configuration
| From: | Kyle Terry | Date: | Mon, 19 Jan 2009 19:35:04 +0000 |
| Subject: | Re: PHP and Apache configuration | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-286686@lists.php.net to get a copy of this message | ||
On Mon, Jan 19, 2009 at 11:28 AM, R B <rbpphp@gmail.com> wrote:
> Hello,
>
> I need that every time someone access one image file in my server, then
> redirect to a php file.
>
> I make this well with:
>
> Redirect 301 imagefile.jpg scriptfile.php
>
> But i need that the file scriptfile.php can only be accessed by this
> redirect command.
>
> If someone try to access directly from the url
> http://www.mydomain.com/xyz/scriptfile.php, i want to send an
> error
> access.
>
> I tried with:
>
> <Files scriptfile.php>
> Order allow,deny
> Deny from all
> </Files>
> But with this configuration, the redirect command cant access the
> scriptfile.php
>
> Do you have the solution for this?
>
> thanks.
>
You could use sessions. Start a session and set a redirect true variable of
some sort.
<?php
session_start();
//image script
$_SESSION['redirect'] = true;
//image redirect here.
?>
<?php
//scriptfile.php
if($_SESSION['redirect']){
//do your stuff.
unset($_SESSION['redirect']);
} else {
echo 'error';
}
?>
Get the idea?
--
Kyle Terry | www.kyleterry.com