PHP_SELF, $_SERVER, etc

This is a discussion on PHP_SELF, $_SERVER, etc within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hello news group, This is a dumb question. Sorry. I would like to pass the name of the "page&...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-04-2008
eholz1
 
Posts: n/a
Default PHP_SELF, $_SERVER, etc

Hello news group,

This is a dumb question. Sorry. I would like to pass the name of the
"page",
along with some $_REQUEST variables.

I used the $_REQUEST to send and image name (with path) to a page that
displays the image referred to in the query string "view.php?
image=nicepix.jpg&p=1".

I suppose there is a way to add the PHP_SELF from the calling page
using $_SERVER['PHP_SELF'] to the query string. I was wondering if
there is some "default" way the destination page (view.php) would know
what page the image ref came from.

I would like to use the ref to the page that sent the image path for a
"back" button from the view.php page. Or...

What is the better way to do this?

Thanks

eholz1
Reply With Quote
  #2 (permalink)  
Old 04-04-2008
Sylvain SF
 
Posts: n/a
Default Re: PHP_SELF, $_SERVER, etc

eholz1 wrote on 04/04/2008 01:22:
> Hello news group,


hello,

> I would like to use the ref to the page that sent the image path for a
> "back" button from the view.php page. Or...
> What is the better way to do this?


hmm, what about: <a href="javascript:history.go(-1)">Back</a>

I always prefer solutions that use visitor CPU instead of server's CPU
but it's just my pref.

Sylvain.
Reply With Quote
  #3 (permalink)  
Old 04-04-2008
Michael Fesser
 
Posts: n/a
Default Re: PHP_SELF, $_SERVER, etc

..oO(Sylvain SF)

>eholz1 wrote on 04/04/2008 01:22:
>
>> I would like to use the ref to the page that sent the image path for a
>> "back" button from the view.php page. Or...
>> What is the better way to do this?

>
>hmm, what about: <a href="javascript:history.go(-1)">Back</a>


Ugly and unreliable.

>I always prefer solutions that use visitor CPU instead of server's CPU
>but it's just my pref.


Yes, but JS is optional. Server-side code works always.

Micha
Reply With Quote
  #4 (permalink)  
Old 04-04-2008
Utopar
 
Posts: n/a
Default Re: PHP_SELF, $_SERVER, etc

On Apr 3, 7:22*pm, eholz1 <ewh...@gmail.com> wrote:
> I suppose there is a way to add the PHP_SELF from the calling page
> using $_SERVER['PHP_SELF'] to the query string. *I was wondering if
> there is some "default" way the destination page (view.php) would know
> what page the image ref came from.
>
> I would like to use the ref to the page that sent the image path for a
> "back" button from the view.php page. *Or...
>
> What is the better way to do this?
>


The information can be detected using this variable.

Server variables: $_SERVER 'HTTP_REFERER'
The address of the page (if any) which referred the user agent to the
current page. This is set by the user agent. Not all user agents will
set this, and some provide the ability to modify HTTP_REFERER as a
feature. In short, it cannot really be trusted.

Reply With Quote
  #5 (permalink)  
Old 04-04-2008
eholz1
 
Posts: n/a
Default Re: PHP_SELF, $_SERVER, etc

On Apr 4, 3:45 am, Utopar <JeffMer...@gmail.com> wrote:
> On Apr 3, 7:22 pm, eholz1 <ewh...@gmail.com> wrote:
>
> > I suppose there is a way to add the PHP_SELF from the calling page
> > using $_SERVER['PHP_SELF'] to the query string. I was wondering if
> > there is some "default" way the destination page (view.php) would know
> > what page the image ref came from.

>
> > I would like to use the ref to the page that sent the image path for a
> > "back" button from the view.php page. Or...

>
> > What is the better way to do this?

>
> The information can be detected using this variable.
>
> Server variables: $_SERVER 'HTTP_REFERER'
> The address of the page (if any) which referred the user agent to the
> current page. This is set by the user agent. Not all user agents will
> set this, and some provide the ability to modify HTTP_REFERER as a
> feature. In short, it cannot really be trusted.


Hello Again,

As always thanks for the information. I kinda favor server side code,
as opposed to the javascript solution. But...

Server variables: $_SERVER 'HTTP_REFERER'
> The address of the page (if any) which referred the user agent to the
> current page. This is set by the user agent. Not all user agents will
> set this, and some provide the ability to modify HTTP_REFERER as a
> feature. In short, it cannot really be trusted.


worries me slightly, due to the last statement "cannot really be
trusted" - that is like washington D.C.!!! I will try the $_server
variable out.

Thanks for the good info.

eholz1
Reply With Quote
  #6 (permalink)  
Old 04-04-2008
Sylvain SF
 
Posts: n/a
Default Re: PHP_SELF, $_SERVER, etc

Michael Fesser wrote on 04/04/2008 11:58:
>> hmm, what about: <a href="javascript:history.go(-1)">Back</a>

> Ugly and unreliable.


don't you trust your script engine ? change your script engine.

> Yes, but JS is optional.


(and in case available on 99% of the browsers).
and ? a computer also is optional, a browser is optional, a brain
is may be optional for web site visitor. you believe a basic link
should take into account all these optional features ?

> Server-side code works always.


if it doesn't rely on client information. here it's the case.
a server-side code will *not* always work, and thus is not
reliable.

btw, thanks for the nice exchange.

Sylvain.

Reply With Quote
  #7 (permalink)  
Old 04-05-2008
D. Stussy
 
Posts: n/a
Default Re: PHP_SELF, $_SERVER, etc

"Sylvain SF" <sylvain@boiteaspam.info> wrote in message
news:47f68423$0$865$ba4acef3@news.orange.fr...
> Michael Fesser wrote on 04/04/2008 11:58:
> >> hmm, what about: <a href="javascript:history.go(-1)">Back</a>

> > Ugly and unreliable.

>
> don't you trust your script engine ? change your script engine.


It's not the script engine we don't trust. It's everyone else's scripts we
don't trust.

> > Yes, but JS is optional.

> ...




Reply With Quote
  #8 (permalink)  
Old 04-05-2008
Jussist
 
Posts: n/a
Default Re: PHP_SELF, $_SERVER, etc

The HTTP_REFERER is worst option. Numerous firewalls, and sometimes
proxies, don't send that data.
Reply With Quote
  #9 (permalink)  
Old 04-05-2008
Michael Fesser
 
Posts: n/a
Default Re: PHP_SELF, $_SERVER, etc

..oO(Sylvain SF)

>Michael Fesser wrote on 04/04/2008 11:58:
>>> hmm, what about: <a href="javascript:history.go(-1)">Back</a>

>> Ugly and unreliable.

>
>don't you trust your script engine ? change your script engine.


It's not about a scripting engine, but about ugly code. The javascript:
pseudo-protocol is just stupid, the entire link appears as non-working
to users without JS and even if it works it might throw the user back to
a completely unrelated page. Going back in the browser history is not
what the OP wants.

>> Yes, but JS is optional.

>
>(and in case available on 99% of the browsers).


Wrong. Just because most modern browsers support JS doesn't mean that
it's always enabled. And then there's a whole bunch of non-JS user
agents, for example search engines.

>> Server-side code works always.

>
>if it doesn't rely on client information. here it's the case.
>a server-side code will *not* always work, and thus is not
>reliable.


Wrong again. If it's done on the server, it's completely independent
from the client's capabilities, environment and network, whereas
JavaScript always depends on what the client is able to do and if he
will be able to execute it at all.

Micha
Reply With Quote
  #10 (permalink)  
Old 04-05-2008
Sylvain SF
 
Posts: n/a
Default Re: PHP_SELF, $_SERVER, etc

Michael Fesser wrote on 05/04/2008 12:09:

something likes "wrong, wrong, wrong, ad libitium".

> It's not about a scripting engine, but about ugly code. [...]


and "ugly, ugly, ugly, ad libitium".

with so many strong arguments, I'm really puzzled to answer.

> for example search engines.


irrelevant.

> Wrong again. If it's done on the server, it's completely independent
> from the client's capabilities, [...]


of course, when server tries to get *information sent by the client*,
it's "completely [client] independent".

thank for all these "true, true, true, nice, nice, nice" points.

Sylvain.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 11:37 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0