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 4375
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: Rina0 |
last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
|
by: erikbower65 |
last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps:
1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal.
2. Connect to...
|
by: erikbower65 |
last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA:
1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
|
by: kcodez |
last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
|
by: Taofi |
last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same
This are my field names
ID, Budgeted, Actual, Status and Differences
...
|
by: DJRhino1175 |
last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this -
If...
|
by: DJRhino |
last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer)
If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _
310030356 Or 310030359 Or 310030362 Or...
|
by: lllomh |
last post by:
How does React native implement an English player?
|
by: Mushico |
last post by:
How to calculate date of retirement from date of birth
| |