[squid-users] Rf. : Re: [squid-users] squid and custom error page

From: Yannick MASSE/INFO/FR/DELMAS <masse@dont-contact.us>
Date: Mon, 13 Jan 2003 17:08:35 +0100

I want to know if there is a problem with squid displaying picture or
executing PHP code in a custom error page. My error page works fine with
squidguard, but I stop using it so it would be nice if I could get my
error page to work with squid.

Using squidguard, MyPage.php was in /var/www/html directory. This
directory is also a document root for the Apache server. Squid use its own
directory for error info pages: /etc/squid/errors.

So I tried to write this in squid.conf
deny_info /var/www/html/MyPage.php BAD_DOMAINS
but then squid won't start

Is there a way to make squid use a different directory than the default
one for error pages?
Can I configure another Apache server to run with a document root
directory same as the squid error pages one?

Thanks and regards
Yannick

Here is the code anyway:

<?php

  isset ($_REQUEST["clientaddr"]) ? $clientaddr =
$_REQUEST["clientaddr"]: $clientaddr="";
  isset ($_REQUEST["url"]) ? $url =
$_REQUEST["url"]: $url="";

  if ($REQUEST_METHOD == "POST")
  {
    $nom = strip_tags($nom);
    $clientaddr = strip_tags($clientaddr);
    $url = strip_tags($url);
    $sendto = "admin@delmasexport.com";
    $subject = "Squid proxy - Demande d'accés à un site Internet";
    $message = "$nom,$clientaddr\n$url\n\n$message";

    mail($sendto, $subject, $message);
  }

  $str = strpos($url,"pdf995");
  if ($str === FALSE)
  {
        print <<<EOF
    <html>
      <head>
        <title>Accés au site Internet non autorisé</title>
        <div align="center"><img src="images/logojad.jpg" width="450"
height="68"></div>
        <div align="center"><h1><img src="images/stop02.gif">
            Accés non autorisé
            <img src="images/stop02.gif">
        </h1></div>
          </head>
           <body bgcolor="#FFFFFF">
        <p><hr size=1 noshade></p>
        <p>Vous n'êtes pas autorisé à accéder au site
          <a href=$url>$url</a>.
          Pour toute demande d'accés, veuillez remplir le formulaire
ci-dessous et cliquer sur "Envoyer".</p>
        <p><hr size=1 noshade></p>
EOF;

                if ($REQUEST_METHOD=="POST")
        {
            echo("<P><b>Message envoyé</b></p>\n");
            echo("<blockquote><pre>\n");
            echo("$message");
            echo("</pre></blockquote>");
        }

                else
                {
                        print <<<EOF
                <form action="$script_name" METHOD="POST">
                  <table cellpadding=4 cellspacing=0 border=0>
                    <tr><td><b>Nom: </b></td><td><input type="text"
name="nom" size=30></td></tr>
                    <tr><td colspan=2><b>Message:</b><br>
                      <textarea name="message" rows=6 cols=50
wrap=physical></textarea>
                    </td></tr>
                    <tr><td colspan=2 align=right><input type="submit"
value="Envoyer"></td></tr>
                  </table>
                </form>
EOF;
        }

        print <<<EOF
            <p><hr size=1 noshade></p>
          </body>
          <p>Service Infomatique J.A. Delmas Export</p>
        </html>
EOF;

  }
  else
  {
        print <<<EOF
    <html>
      <head>
        <title>Impression à partir de PDF995</title>
        <div align="center"><img src="images/logojad.jpg" width="450"
height="68"></div>
      </head>
      <body>
        <p><hr size=1 noshade></p>
        <div align="center">
          <p>Création du fichier PDF terminée.</p>
          <p>Vous pouvez fermer cette fenêtre.</p>
        </div>
        <p><hr size=1 noshade></p>
      </body>
      <p>Service Informatique J.A. Delmas Export</p>
    </html>
EOF;

  }

?>

trainier@kalsec.com
13/01/2003 15:53

 
        Pour : squid-users@squid-cache.org
        cc :
        Objet : Re: [squid-users] squid and custom error page

Any way to show us the page? page source? etc?
Prolly be much easier with diagnosing things. : )

Tim Rainier
UNIX/Linux Systems Administrator, Kalsec INC.
Web: http://www.kalsec.com
Email: trainier@kalsec.com

"Yannick MASSE/INFO/FR/DELMAS" <masse@delmasexport.com>
01/13/2003 08:20 AM

 
        To: squid-users@squid-cache.org
        cc:
        Subject: [squid-users] squid and custom error page

Hi

I made a nice error page for my network user when they got an access
denied. It is a PHP page.
The problem is when the page is opened by squid it doesn't display
pictures and doesn't execute PHP code.
I'm running squid 2.5 on Linux Mandrake 9

any idea?

thanks and regards

Yannick
Received on Mon Jan 13 2003 - 09:09:36 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 17:12:39 MST