You are here: Re: custom server variables « All PHP « IT news, forums, messages
Re: custom server variables

Posted by J.O. Aho on 12/27/05 20:32

rithish@gmail.com wrote:
> Is it possible to set a custom server variable so that it may be used
> in the latter part of a script? Say something like $_SERVER["myvar"] =
> "myvalue", and then be able to use 'myvar' later.

You could, but I would advice you against to do a such thing, as you will most
likely get trouble to see from where the value comes when you are to debug
your code a long time later or it can be someone else who does the debugging.

Use a normal global value instead, like

$myvalue = "myvalue";


> The reason being that I want some client-side information to flow to
> PHP, and the PHP script flow will be controlled depending on this
> information.
>
> [snippet]
>
> <?php
> if ($_REQUEST["action"] == "setvar")
> {
> $_SERVER["WindowName"] == $_REQUEST["window"];
> exit ();
> }

This don't make any sense, you assign a value to an array and then exit the
script and you loose the value at the same time.


> Basically, the execution flows depending on which window the file is
> being invoked in. I guess I could use sessions for this. However, I
> wanted to know if there were any alternative to sessions. Setting &
> Getting a server variable would be that much more simple.

The alternative to sessions are called cookies, but it's really not an
alternative as sessions usually are cookies.


> And before I am flamed, the app is being developed for our intranet,
> and hence you see the usage of ActiveXObject("Microsoft.XMLHTTP")

Your loss, not mine...

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация