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

Posted by rithish on 12/27/05 19:36

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.

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 ();
}
?>
<HTML>
<HEAD>
<SCRIPT TYPE="TEXT/JAVASCRIPT">
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
var request =
"http://saraswati.tallysolutions.com/tallyweb/test/TestRithishGeneric.php?action=setvar&window="+window.name;
xmlhttp.open("POST", request, false);
xmlhttp.send();
response = xmlhttp.responseText;
</SCRIPT>
</HEAD>
<BODY>
<?php
if ($_SERVER["WindowName"] == "x") { ... do this ... }
else { ... do that ... }
?>
</BODY>
</HTML>

[/snippet]

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.

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

Suggestions / comments / even flamings solicited.

Regards,
Rithish.

 

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

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