What's the PHP equivalent for the following?
if(window.location == "http:/site.com/page1.html")
{
}
else
{
}
Thanks,
Don
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =---- 12 4416
Don <no@adr.com> wrote: What's the PHP equivalent for the following? if(window.location == "http:/site.com/page1.html") {
} else {
}
$my_page = "http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
if ($my_page == "http:/site.com/page1.html") {
} else {
}
if your page location is : http:/site.com/test/my_first/page1.php
$_SERVER['HTTP_HOST'] return : site.com
$_SERVER['PHP_SELF'] return : /test/my_first/page1.php
--
@@@@@
E -00 comme on est very beaux dis !
' `) /
|\_ =="
On 04 Mar 2005 23:16:42 GMT, Daniel Tryba <sp**@tryba.invalid> wrote: Don <no@adr.com> wrote: What's the PHP equivalent for the following?
if(window.location == "http:/site.com/page1.html")
see: http://www.php.net/manual/en/reserve...riables.server and construct the requested URI from the available elements.
Thanks Daniel.
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
On Sat, 5 Mar 2005 00:18:38 +0100, ne***@no-log.org (denisb) wrote: Don <no@adr.com> wrote: What's the PHP equivalent for the following? if(window.location == "http:/site.com/page1.html") {
} else {
}
$my_page = "http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']; if ($my_page == "http:/site.com/page1.html") {
} else {
}
if your page location is : http:/site.com/test/my_first/page1.php $_SERVER['HTTP_HOST'] return : site.com $_SERVER['PHP_SELF'] return : /test/my_first/page1.php
Thanks much. That works just great.
Don
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
.oO(denisb) Don <no@adr.com> wrote:
What's the PHP equivalent for the following? if(window.location == "http:/site.com/page1.html") {
} else {
}
$my_page = "http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
$_SERVER['PHP_SELF'] contains the name of the currently running script,
but that doesn't necessarily have to be the requested URI as seen in the
browser's address bar. $_SERVER['REQUEST_URI'] will be more accurate.
Micha
if("{$_SERVER['HTTP_HOST']}{$_SERVER['PHP_SELF']}" ===
'mysite.com/pageWhatever.php')
{
echo "We're here with pageWhatever.php at mysite.com, reporting live!
Now it's time for a commercial break";
}
else
{
echo "Standby for signal...";
}
Untested, I'm not actually sure if you need a slash between the two
variables. Try it yourself and see what you get.
-jb
"Don" <no@adr.com> wrote in message
news:s2********************************@4ax.com... What's the PHP equivalent for the following?
if(window.location == "http:/site.com/page1.html") {
} else {
}
Thanks, Don
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups ----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Michael Fesser <ne*****@gmx.net> wrote: .oO(denisb)Don <no@adr.com> wrote: What's the PHP equivalent for the following? if(window.location == "http:/site.com/page1.html") { } else { } $my_page = "http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']; $_SERVER['PHP_SELF'] contains the name of the currently running script, but that doesn't necessarily have to be the requested URI as seen in the browser's address bar. $_SERVER['REQUEST_URI'] will be more accurate.
yes, it's true.
you are right.
--
@@@@@
E -00 comme on est very beaux dis !
' `) /
|\_ =="
Michael Fesser wrote: $_SERVER['PHP_SELF'] contains the name of the currently running script,
Please, no! Words like 'name' and 'script' only keep the
confusion alive. PHP_SELF is simply the path part of the
current resource's URI. There can be all sorts of rewriting
going on backstage which lead to an address bearing no
resemblance to the name of the script it identifies.
but that doesn't necessarily have to be the requested URI as seen in the browser's address bar.
True, since an address bar normally shows a URI, the one the
browser parsed to make the request.
$_SERVER['REQUEST_URI'] will be more accurate.
Accuracy doesn't come in to it. You can build the current
URI with REQUEST_URI or PHP_SELF, but they are not the same.
Typically, Request-URI is an absolute-path reference,* that
is, it begins with a single slash. Then, if there is no
query part, REQUEST_URI and PHP_SELF are identical; they are
both the path part of the current resource's URI. If there
is a query part, however, then
PHP_SELF + '?' + QUERY_STRING = REQUEST_URI
The Manual happens to be wrong. It says, without a
semblance of uncertainty, that PHP_SELF is 'the filename of
the currently executing script', which is inexcusable coming
from an authority of its stature. http://www.php.net/manual/en/reserved.variables.php
Have a good weekend, Micha!
* But it can also be, among other things, a URI, which
REQUEST_URI should mirror. For example, a Request-line:
GET http://host.invalid/path?query HTTP/1.1
should give a REQUEST_URI of
<http://host.invalid/path?query>.
--
Jock
On Fri, 04 Mar 2005 15:45:23 -0700, Don <no@adr.com> wrote: What's the PHP equivalent for the following?
if(window.location == "http:/site.com/page1.html") {
} else {
}
Thanks, Don
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups ----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Thanks much for all of your help.
Don
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
.oO(John Dunlop) Michael Fesser wrote:
$_SERVER['PHP_SELF'] contains the name of the currently running script, Please, no! Words like 'name' and 'script' only keep the confusion alive. PHP_SELF is simply the path part of the current resource's URI.
Not necessarily.
True, since an address bar normally shows a URI, the one the browser parsed to make the request.
And the one the OP asked for.
Typically, Request-URI is an absolute-path reference,* that is, it begins with a single slash. Then, if there is no query part, REQUEST_URI and PHP_SELF are identical;
If the browser requested '/', PHP_SELF with contain '/index.php'. I
don't consider that identical.
And it gets even more complicated with server-side URI rewriting. In my
current testing scripts PHP_SELF will always contain the same value,
regardless of the requested URI.
Typically, Request-URI is an absolute-path reference,* that is, it begins with a single slash.
Yep.
Then, if there is no query part, REQUEST_URI and PHP_SELF are identical; they are both the path part of the current resource's URI.
Again: Not necessarily.
The Manual happens to be wrong. It says, without a semblance of uncertainty, that PHP_SELF is 'the filename of the currently executing script', which is inexcusable coming from an authority of its stature.
But that's exactly what PHP_SELF is.
Micha
Michael Fesser wrote: .oO(John Dunlop)
Please, no! Words like 'name' and 'script' only keep the confusion alive. PHP_SELF is simply the path part of the current resource's URI.
Not necessarily.
Aha! I was wrong. Thank you for putting me right. May I
repay you now? Typically, Request-URI is an absolute-path reference,* that is, it begins with a single slash. Then, if there is no query part, REQUEST_URI and PHP_SELF are identical;
If the browser requested '/', PHP_SELF with contain '/index.php'.
Mine shows '/index', without '.php', even though '.php' is
part of the filename. The filename is 'index.php', not
'/index' or 'index'. So in this case PHP_SELF isn't the
filename. In fact, filenames here cannot contain slashes,
and backslashes, not slashes, show directory structure, so
PHP_SELF can't be a filesystem path either.
I don't consider that identical.
Nor do I. You're right.
And it gets even more complicated with server-side URI rewriting. In my current testing scripts PHP_SELF will always contain the same value, regardless of the requested URI.
Fascinating. Here, if I request <http://127.0.0.1/php/foo>,
PHP_SELF is '/php/foo' -- not the filename of the script.
If I request <http://127.0.0.1/php/foo.php>, PHP_SELF is
'/php/foo.php' -- again, not the filename. Both URIs
identify the same resource, by the way. The Manual happens to be wrong. It says, without a semblance of uncertainty, that PHP_SELF is 'the filename of the currently executing script', which is inexcusable coming from an authority of its stature.
But that's exactly what PHP_SELF is.
I've shown that to be untrue, haven't I?
--
Jock
.oO(John Dunlop) Fascinating. Here, if I request <http://127.0.0.1/php/foo>, PHP_SELF is '/php/foo' -- not the filename of the script. If I request <http://127.0.0.1/php/foo.php>, PHP_SELF is '/php/foo.php' [...]
This happens with content negotiation (MultiViews) enabled on the
server. >The Manual happens to be wrong. It says, without a >semblance of uncertainty, that PHP_SELF is 'the filename of >the currently executing script', which is inexcusable coming >from an authority of its stature.
But that's exactly what PHP_SELF is.
I've shown that to be untrue, haven't I?
OK, it's "the path and filename of the currently executing script".
At least in most cases ... ;)
Micha This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: John |
last post by:
Is there an equivalent of COM on Linux that I can get through Python.
My need is to have some sort of language independent component
framework. I can think of CORBA but I have to have a server...
|
by: Michael Foord |
last post by:
Please pardon my ignorance on this one - but I'm not certain how the
sign bt is treated in python bitwise operators. I've trying to convert
a javascript DES encryption routine into python.
...
|
by: Robert Dodier |
last post by:
Hello,
Here's a thought that I'm sure has already occurred to
someone else, I just can't find any record of it yet.
An XML document is just a more verbose and clumsy representation
of an...
|
by: Vannela |
last post by:
Is there any equivalent control in .NET for the Power
builder DataWindow control?
I am explaining the Datawindow architecture to some extent.
Power Builder DataWindow Control has got different...
|
by: Frank Rachel |
last post by:
So I can focus on the correct areas of research, I was wondering if someone
could give me the .NET equivelents for this J2EE architecture:
JSP's make calls to local JavaBean Controls. The...
|
by: Marty |
last post by:
Hi,
What is the VB.NET equivalent of the VB6 ADODB.Connector and
ADODB.Recordset?
Thanks
Marty
|
by: Tim Conner |
last post by:
Hi,
I am an ex-delphi programmer, and I having a real hard time with the
following simple code (example ):
Which is the equivalent to the following code ?
var
chars : PChar;
sBack, s :...
|
by: karch |
last post by:
How would this C# contruct be represented in C++/CLI? Or is it even
possible?
PolicyLevel level = (enumerator->Current) as PolicyLevel;
Thanks,
Karch
|
by: Alan Silver |
last post by:
Hello,
I'm converting some old VB6 code to use with ASP.NET and have come
unstuck with the Asc() function. This was used in the old VB6 code to
convert a character to its ASCII numeric...
|
by: grid |
last post by:
Hi,
I have a certain situation where a particular piece of code works on a
particular compiler but fails on another proprietary compiler.It seems
to have been fixed but I just want to confirm if...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |