[Phpwm] Simple? question

Peter Crouch pccrouch at bcs.org.uk
Tue Oct 27 16:35:35 UTC 2009


Hello again,

Thanks for all your suggestions.

I have done some tests using a snippet of code from the PHP online 
manual page for $_SERVER, provided by corrodedmonkee at gmail dot com at 
22-Sep-2009 04:16.

"Just an improved version of jeffwks table of $_SERVER variables, and 
will pick up future additions without modification."

<?php
echo '<table border="1">';

foreach($_SERVER as $k => $v) {
echo '<tr><td>'.$k.'</td><td>'.$v.'</td></tr>';
}
echo '</table>';
?>

I found the following variables contained the sort of information I am 
looking for:
SCRIPT_URL
SCRIPT_URI
HTTP_HOST
SERVER_NAME
SCRIPT_FILENAME
REQUEST_URI
SCRIPT_NAME
PHP_SELF

The first two don't appear when the host is localhost and the last three 
have contained the same string in each of my tests. Also in my tests 
HTTP_HOST and SERVER_NAME contained the same string. SCRIPT_URI looks to 
contain the information I need to build my bookmarks.

Interestingly HTTP_REFERER doesn't appear in the list and the PHP manual 
says "... In short, it cannot really be trusted." So it looks as if the 
other variables may be safer to use.

Thanks again for your suggestions and best wishes,

Peter Crouch
-------------------------------------------------
Tel: 0121 523 6756
Mobile: 0776 877 0475
Email: pccrouch at bcs.org.uk

**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
**********************************************************************



Stephen Orr wrote:
> And also, some antivirus software (Norton and McAfee used to do this)
> strip the referrer header as a way to protect their users. Nice theory
> I suppose.
>
> Steve
>
> 2009/10/27 Tom Graham <me at noginn.com>:
>   
>> Also remember that the HTTP_REFERER index may not always be set as not all
>> requests will contain the Referrer header.
>>
>> Tom
>>
>> 2009/10/27 Simon Ferre <simon.ferre at onetwodo.co.uk>
>>     
>>> Hi
>>>
>>> I believe what you are looking for is not a function, but a PHP variable:
>>>
>>> _SERVER["HTTP_REFERER"]
>>>
>>> Gives you the page that referred you to the current page.
>>>
>>> Do a phpinfo(); to find out more...
>>>
>>> Simon
>>>
>>> -----Original Message-----
>>> From: phpwm-bounces at mailman.lug.org.uk
>>> [mailto:phpwm-bounces at mailman.lug.org.uk] On Behalf Of Peter Crouch
>>> Sent: 27 October 2009 10:39
>>> To: West Midlands PHP User Group
>>> Subject: [Phpwm] Simple? question
>>>
>>> Hello to you all,
>>>
>>> I have spent some time looking through the online PHP reference manual
>>> searching for a function which will return the URL or URI of the web
>>> page from which it is invoked, without success.
>>>
>>> I want to write a PHP script which will construct bookmarks for the
>>> likes of Facebook and Twitter for any web page from which it is called.
>>> I suspect I am trying to reinvent the wheel!
>>>
>>> I am sure that some of you experts will be able to point me in the right
>>> direction very quickly!
>>>
>>> Thanks in advance for any help you can give me.
>>>
>>> Peter Crouch
>>> -------------------------------------------------
>>> Tel: 0121 523 6756
>>> Mobile: 0776 877 0475
>>> Email: pccrouch at bcs.org.uk
>>>
>>> **********************************************************************
>>> This email and any files transmitted with it are confidential and
>>> intended solely for the use of the individual or entity to whom they
>>> are addressed. If you have received this email in error please notify
>>> the system manager.
>>> **********************************************************************
>>>
>>>
>>> _______________________________________________
>>> Phpwm mailing list
>>> Website : http://www.phpwm.org
>>> Twitter : http://www.twitter.com/phpwm
>>> Facebook: http://www.facebook.com/group.php?gid=2361609907
>>>
>>> Post to list: Phpwm at mailman.lug.org.uk
>>> Archive etc : https://mailman.lug.org.uk/mailman/listinfo/phpwm
>>>
>>>
>>> _______________________________________________
>>> Phpwm mailing list
>>> Website : http://www.phpwm.org
>>> Twitter : http://www.twitter.com/phpwm
>>> Facebook: http://www.facebook.com/group.php?gid=2361609907
>>>
>>> Post to list: Phpwm at mailman.lug.org.uk
>>> Archive etc : https://mailman.lug.org.uk/mailman/listinfo/phpwm
>>>       
>> _______________________________________________
>> Phpwm mailing list
>> Website : http://www.phpwm.org
>> Twitter : http://www.twitter.com/phpwm
>> Facebook: http://www.facebook.com/group.php?gid=2361609907
>>
>> Post to list: Phpwm at mailman.lug.org.uk
>> Archive etc : https://mailman.lug.org.uk/mailman/listinfo/phpwm
>>
>>     
>
> _______________________________________________
> Phpwm mailing list
> Website : http://www.phpwm.org
> Twitter : http://www.twitter.com/phpwm
> Facebook: http://www.facebook.com/group.php?gid=2361609907
>
> Post to list: Phpwm at mailman.lug.org.uk
> Archive etc : https://mailman.lug.org.uk/mailman/listinfo/phpwm
>
>   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.lug.org.uk/pipermail/phpwm/attachments/20091027/c104bb82/attachment.htm 


More information about the Phpwm mailing list