Re: [squid-users] Can I somehow use PHP scripting in ERROR files?

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Sat, 07 Apr 2001 11:10:57 +0200

Not exacly.

Simplest approach for what you are describing is probably to monitor the
Squid access.log file, and trigger the action from there.

  #!/bin/sh
  tail -f access.log | while read time delay ip code size method user
hier mime; do
    if [ "x$code" = "TCP_DENIED/401" ]; then
      ... action for ERR_ACCESS_DENIED ...
    fi
  done

Another approach is to change the Squid generated error pages to make a
soft redirect to some other PHP aware server using "meta" HTML tags.

Note: Triggering on ERR_CACHE_ACCESS_DENIED (TCP_DENIED/407) is probably
not a good idea as this is sent on the first requests of every session
(plust quite a bit more when using some buggy browsers who forget that
they are logged in).

--
Henrik Nordstrom
Squid Hacker
Daniël Mostertman wrote:
> 
> Hi all,
> 
> Is there any possibility that I could somehow use PHP in the ERROR
> documents?
> 
> Like if someone tries to access a blocked site that it will open the
> ERR_ACCESS_DENIED page,
> or with authentication the ERR_CACHE_ACCESS_DENIED page, and that the first
> line will be like:
> 
> <?php mail("%w","Someone requested a blocked site","%U"); ?>
> 
> Is it possible to make Squid PHP aware?
> 
> Or, alternatively, is it possible to make Squid send an e-mail to the
> cache_mgr
> whenever a user requests a blocked site and didn't pass the authentication
> test?
> 
> Or, do I then have to use redirection programs?
> 
> TIA
> 
> // Daniël
Received on Sat Apr 07 2001 - 03:27:14 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:59:11 MST