D&C Lug - Home Page
Devon & Cornwall Linux Users' Group

[ Date Index ][ Thread Index ]
[ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Quick PHP question



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tuesday 03 December 2002 10:49 pm, Tom Salmon wrote:
David Johnson wrote:
This is driving me insane: -

I have a .htaccess file which calls a PHP error document if a file is
not found. What I need to do is grab the refering URL (i.e. the location
and name of the file that didn't exist) for use within the PHP script.

Everything I've tried from Google just doesn't work...

Try:
  $referer = $_SERVER["HTTP_REFERER"];

I use $file = $REQUEST_URI;
Probably the same variable. 

The easiest option is:
create a text file on the server (either using SCP or FTP) containing just:
<?php phpinfo(); ?>
(If that doesn't get through the filters, try this and swap the &lt; and &gt; 
for the normal tag angle brackets:
&lt;?php phpinfo(); ?&gt;
Now call the file phpinfo.php and load it into a browser from your local 
machine using the full http:// address.

That gives you an immense amount of information on PHP including ALL the 
environmental variables available so that you can get exactly the one you 
want - e.g. there are versions with or without the domain name or the http:// 
etc.

phpinfo() also reveals a LOT of sensitive info if you leave it on the server, 
so save the output as HTML on your local machine and delete the file from the 
server.

If you are in any doubt about the configuration of PHP on any server (to 
which you have FTP/SCP access) phpinfo() is always the quickest and best way 
to find out the info you need. Just always remember to delete it afterwards.


http://www.php.net
has served all my php needs pretty well.

- -- 

Neil Williams
=============
http://www.codehelp.co.uk
neil@xxxxxxxxxxxxxx
linux@xxxxxxxxxxxxxx
neil@xxxxxxxxxxxx

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE97TsoiAEJSii8s+MRAuBvAKCe9MJyiFlC0NfF+YsgfbRauopBqACgt+hf
9Oe39rNOFhoZRpUlr75jAVY=
=D2KS
-----END PGP SIGNATURE-----

--
The Mailing List for the Devon & Cornwall LUG
Mail majordomo@xxxxxxxxxxxx with "unsubscribe list" in the
message body to unsubscribe.


Lynx friendly