Re: [PHP] Current URL?

2004-11-12 Thread John Holmes
Jason Paschal wrote:
Trying to get the current viewed page's URL (query string intact).
this works, but infrequently:
$url = $_SERVER['URI']; 
How about $_SERVER['REQUEST_URI']
and this ignores the query string:
$url = $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
or you could add/check for $_SERVER['QUERY_STRING'] here.
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Current URL

2004-06-04 Thread Stephen Craton
Also, on a Windows machiene, it returns something like c:\htdocs\subsite.
Already tried it, but thanks. :-)

I'll be going with your GLOBAL variable suggestion, it seems so obvious now.
Thanks for the help! :-)

 
Thanks,
Stephen Craton
http://www.melchior.us

-Original Message-
From: Robert Cummings [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 04, 2004 12:59 AM
To: Aidan Lister
Cc: PHP-General
Subject: Re: [PHP] Current URL

On Fri, 2004-06-04 at 01:38, Aidan Lister wrote:
 Hi,
 
 You could use $_SERVER['DOCUMENT_ROOT']
 

That doesn't work... as the OP mentioned, the URLs might need to refer
locally within a subsite built as a subdirectory within the document root.

Cheers,
Rob.


 
 Robert Cummings [EMAIL PROTECTED] wrote in message 
 news:[EMAIL PROTECTED]
  On Thu, 2004-06-03 at 23:15, Stephen Craton wrote:
   I've wondered for quite some time, and search just as long it 
   seems
 like,
   for a way to get the current URL directory. For example, let's say 
   you
 were
   at www.example.com/files. The script is executing in this 
   directory, and it's calling an include script from the base 
   (www.example.com or maybe
 even
   www.example.com/includes). In this included file are some links 
   and
 maybe
   some images. These images and links are set up to be called from 
   the
 base
   directory, so basically all the links inside the file say 
   something like images/bob.gif or something of that nature.
  
   How could you dynamicaly change this in relation to where the 
   included script is? If I were to include it in that files in 
   /files, it would
 look
   for the images in /files/images/bob.gif which would not be there. 
   One solution I have thought of is just putting the / at the 
   beginning
 (/images/)
   but that wouldn't be the safest solution if the script were 
   running in a subfolder to begind with (like the entire site is in
 www.example.com/site1).
  
   I hope you understand what I'm trying to say. Any ideas?
 
  In a configuration file shared by the project's scripts have a 
  constant or global variable like follows:
 
  $GLOBALS['imageBase'] = '/site1/';
 
  Now wherever in your site you use an image you can use this value to 
  prepend the image path.
 
  Cheers,
  Blobbie.
  --
  ..
  | InterJinn Application Framework - http://www.interjinn.com |
  ::
  | An application and templating framework for PHP. Boasting  | a 
  | powerful, scalable system for accessing system services  | such as 
  | forms, properties, sessions, and caches. InterJinn |
  | also provides an extremely flexible architecture for   |
  | creating re-usable components quickly and easily.  |
  `'
 
 --
 PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: 
 http://www.php.net/unsub.php
 
 
--
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  | a 
| powerful, scalable system for accessing system services  | such as 
| forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Current URL

2004-06-03 Thread Robert Cummings
On Thu, 2004-06-03 at 23:15, Stephen Craton wrote:
 I've wondered for quite some time, and search just as long it seems like,
 for a way to get the current URL directory. For example, let's say you were
 at www.example.com/files. The script is executing in this directory, and
 it's calling an include script from the base (www.example.com or maybe even
 www.example.com/includes). In this included file are some links and maybe
 some images. These images and links are set up to be called from the base
 directory, so basically all the links inside the file say something like
 images/bob.gif or something of that nature.
  
 How could you dynamicaly change this in relation to where the included
 script is? If I were to include it in that files in /files, it would look
 for the images in /files/images/bob.gif which would not be there. One
 solution I have thought of is just putting the / at the beginning (/images/)
 but that wouldn't be the safest solution if the script were running in a
 subfolder to begind with (like the entire site is in www.example.com/site1).
  
 I hope you understand what I'm trying to say. Any ideas?

In a configuration file shared by the project's scripts have a constant
or global variable like follows:

$GLOBALS['imageBase'] = '/site1/';

Now wherever in your site you use an image you can use this value to
prepend the image path.

Cheers,
Blobbie.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Current URL

2004-06-03 Thread Aidan Lister
Hi,

You could use $_SERVER['DOCUMENT_ROOT']


Robert Cummings [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On Thu, 2004-06-03 at 23:15, Stephen Craton wrote:
  I've wondered for quite some time, and search just as long it seems
like,
  for a way to get the current URL directory. For example, let's say you
were
  at www.example.com/files. The script is executing in this directory, and
  it's calling an include script from the base (www.example.com or maybe
even
  www.example.com/includes). In this included file are some links and
maybe
  some images. These images and links are set up to be called from the
base
  directory, so basically all the links inside the file say something like
  images/bob.gif or something of that nature.
 
  How could you dynamicaly change this in relation to where the included
  script is? If I were to include it in that files in /files, it would
look
  for the images in /files/images/bob.gif which would not be there. One
  solution I have thought of is just putting the / at the beginning
(/images/)
  but that wouldn't be the safest solution if the script were running in a
  subfolder to begind with (like the entire site is in
www.example.com/site1).
 
  I hope you understand what I'm trying to say. Any ideas?

 In a configuration file shared by the project's scripts have a constant
 or global variable like follows:

 $GLOBALS['imageBase'] = '/site1/';

 Now wherever in your site you use an image you can use this value to
 prepend the image path.

 Cheers,
 Blobbie.
 -- 
 ..
 | InterJinn Application Framework - http://www.interjinn.com |
 ::
 | An application and templating framework for PHP. Boasting  |
 | a powerful, scalable system for accessing system services  |
 | such as forms, properties, sessions, and caches. InterJinn |
 | also provides an extremely flexible architecture for   |
 | creating re-usable components quickly and easily.  |
 `'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Current URL

2004-06-03 Thread Robert Cummings
On Fri, 2004-06-04 at 01:38, Aidan Lister wrote:
 Hi,
 
 You could use $_SERVER['DOCUMENT_ROOT']
 

That doesn't work... as the OP mentioned, the URLs might need to refer
locally within a subsite built as a subdirectory within the document
root.

Cheers,
Rob.


 
 Robert Cummings [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  On Thu, 2004-06-03 at 23:15, Stephen Craton wrote:
   I've wondered for quite some time, and search just as long it seems
 like,
   for a way to get the current URL directory. For example, let's say you
 were
   at www.example.com/files. The script is executing in this directory, and
   it's calling an include script from the base (www.example.com or maybe
 even
   www.example.com/includes). In this included file are some links and
 maybe
   some images. These images and links are set up to be called from the
 base
   directory, so basically all the links inside the file say something like
   images/bob.gif or something of that nature.
  
   How could you dynamicaly change this in relation to where the included
   script is? If I were to include it in that files in /files, it would
 look
   for the images in /files/images/bob.gif which would not be there. One
   solution I have thought of is just putting the / at the beginning
 (/images/)
   but that wouldn't be the safest solution if the script were running in a
   subfolder to begind with (like the entire site is in
 www.example.com/site1).
  
   I hope you understand what I'm trying to say. Any ideas?
 
  In a configuration file shared by the project's scripts have a constant
  or global variable like follows:
 
  $GLOBALS['imageBase'] = '/site1/';
 
  Now wherever in your site you use an image you can use this value to
  prepend the image path.
 
  Cheers,
  Blobbie.
  -- 
  ..
  | InterJinn Application Framework - http://www.interjinn.com |
  ::
  | An application and templating framework for PHP. Boasting  |
  | a powerful, scalable system for accessing system services  |
  | such as forms, properties, sessions, and caches. InterJinn |
  | also provides an extremely flexible architecture for   |
  | creating re-usable components quickly and easily.  |
  `'
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] current url function

2004-03-16 Thread Marek Kilimajer
Luis Mirabal wrote:

i checked http://sk2.php.net/manual/en/features.http-auth.php, but it doesnt
shows how to see if i passed user:pass in the url. i try
http://user:[EMAIL PROTECTED]/ and dumped globals, and there is nothing... any
ideas?
variables $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW'], but it 
is not necessary anyways. the browser will remember credentials once 
they are set so it is useless to keep them in the url. and IE with the 
latest patch will ignore user:pass@ part.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] current url function

2004-03-15 Thread Marek Kilimajer
Luis Mirabal wrote:
hey! i am working in an open source development, and have done a function
that gives me the current url, but i need it to work always, everywhere, in
every server with all browsers, could you tell me if you think it will or if
you have any suggestions? here is the code:
  /*
Returns the current URL
TODO: The function can not manage nor return user and pass in the URL if
present because it seems that you can not fetch them from PHP (or at least I
dont't know how to do it :P)
False, check http://sk2.php.net/manual/en/features.http-auth.php

LIMITATIONS: fragment (after # sign) can not be fetched since it is a
client-side feature
True

  */
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] current url function

2004-03-15 Thread Luis Mirabal
i checked http://sk2.php.net/manual/en/features.http-auth.php, but it doesnt
shows how to see if i passed user:pass in the url. i try
http://user:[EMAIL PROTECTED]/ and dumped globals, and there is nothing... any
ideas?

Marek Kilimajer [EMAIL PROTECTED] escribió en el mensaje
news:[EMAIL PROTECTED]
 Luis Mirabal wrote:
  hey! i am working in an open source development, and have done a
function
  that gives me the current url, but i need it to work always, everywhere,
in
  every server with all browsers, could you tell me if you think it will
or if
  you have any suggestions? here is the code:
 
/*
  Returns the current URL
  TODO: The function can not manage nor return user and pass in the
URL if
  present because it seems that you can not fetch them from PHP (or at
least I
  dont't know how to do it :P)

 False, check http://sk2.php.net/manual/en/features.http-auth.php

  LIMITATIONS: fragment (after # sign) can not be fetched since it is
a
  client-side feature

 True

*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Current URL, Last URL, error handeling

2002-04-04 Thread Jason Wong

On Thursday 04 April 2002 21:56, Ben Edwards wrote:
 Is there a way I can get the whole URL of the current page for error
 handling/reporting.  Also is there a way of getting the previous/referrer
 URL for a similar purpose.

Have a look at the values inside $HTTP_SERVER_VARS:


print_r($HTTP_SERVER_VARS);



-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk

/*
Because he's a character who's looking for his own identity, [He-Man is] 
an interesting role for an actor.
-- Dolph Lundgren, actor
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Current URL, Last URL, error handling

2002-04-04 Thread Ben Edwards

Kind of but not quite.  Was wondering if PHP help the actual full url.

Ben

At 15:26 04/04/2002, you wrote:

On Thursday 04 April 2002 21:56, Ben Edwards wrote:
  Is there a way I can get the whole URL of the current page for error
  handling/reporting.  Also is there a way of getting the previous/referrer
  URL for a similar purpose.

Have a look at the values inside $HTTP_SERVER_VARS:


print_r($HTTP_SERVER_VARS);



--
Jason Wong - Gremlins Associates - www.gremlins.com.hk

/*
Because he's a character who's looking for his own identity, [He-Man is]
an interesting role for an actor.
-- Dolph Lundgren, actor
*/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


* Ben Edwards  +44 (0)117 9400 636 *
* Critical Site Builderhttp://www.criticaldistribution.com *
* online collaborative web authoring content management system *
* i-Contact Progressive Video  http://www.videonetwork.org *
* Smashing the Corporate image   http://www.subvertise.org *
* Bristol Indymedia   http://bristol.indymedia.org *
* Bristol's radical news http://www.bristle.org.uk *
* PGP : F0CA 42B8 D56F 28AD 169B  49F3 3056 C6DB 8538 EEF8 *




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Current URL, Last URL, error handling

2002-04-04 Thread Julio Nobrega Trabalhando

$REQUEST_URI?

  If it's not the full you can complement with $HTTP_HOST or similar.

--

Julio Nobrega.

Um dia eu chego lá:
http://sourceforge.net/projects/toca

Ajudei? Salvei? Que tal um presentinho?
http://www.submarino.com.br/wishlistclient.asp?wlid=664176742884


Ben Edwards [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Kind of but not quite.  Was wondering if PHP help the actual full url.

 Ben

 At 15:26 04/04/2002, you wrote:

 On Thursday 04 April 2002 21:56, Ben Edwards wrote:
   Is there a way I can get the whole URL of the current page for error
   handling/reporting.  Also is there a way of getting the
previous/referrer
   URL for a similar purpose.
 
 Have a look at the values inside $HTTP_SERVER_VARS:
 
 
 print_r($HTTP_SERVER_VARS);
 
 
 
 --
 Jason Wong - Gremlins Associates - www.gremlins.com.hk
 
 /*
 Because he's a character who's looking for his own identity, [He-Man is]
 an interesting role for an actor.
 -- Dolph Lundgren, actor
 */
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

 
 * Ben Edwards  +44 (0)117 9400 636 *
 * Critical Site Builderhttp://www.criticaldistribution.com *
 * online collaborative web authoring content management system *
 * i-Contact Progressive Video  http://www.videonetwork.org *
 * Smashing the Corporate image   http://www.subvertise.org *
 * Bristol Indymedia   http://bristol.indymedia.org *
 * Bristol's radical news http://www.bristle.org.uk *
 * PGP : F0CA 42B8 D56F 28AD 169B  49F3 3056 C6DB 8538 EEF8 *
 




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Current URL, Last URL, error handling

2002-04-04 Thread Jason Wong

On Thursday 04 April 2002 22:56, Ben Edwards wrote:
 Kind of but not quite.  Was wondering if PHP help the actual full url.

If you look closely you can concatenate two of those values together to get 
what you want.

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk

/*
The good life was so elusive
It really got me down
I had to regain some confidence
So I got into camouflage
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Current URL, Last URL, error handling

2002-04-04 Thread Ben Edwards

Don't seem to exist, neither douse REQUEST_URL?

At 16:13 04/04/2002, Julio Nobrega Trabalhando wrote:

$REQUEST_URI?

   If it's not the full you can complement with $HTTP_HOST or similar.

--

Julio Nobrega.

Um dia eu chego lá:
http://sourceforge.net/projects/toca

Ajudei? Salvei? Que tal um presentinho?
http://www.submarino.com.br/wishlistclient.asp?wlid=664176742884


Ben Edwards [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Kind of but not quite.  Was wondering if PHP help the actual full url.
 
  Ben
 
  At 15:26 04/04/2002, you wrote:
 
  On Thursday 04 April 2002 21:56, Ben Edwards wrote:
Is there a way I can get the whole URL of the current page for error
handling/reporting.  Also is there a way of getting the
previous/referrer
URL for a similar purpose.
  
  Have a look at the values inside $HTTP_SERVER_VARS:
  
  
  print_r($HTTP_SERVER_VARS);
  
  
  
  --
  Jason Wong - Gremlins Associates - www.gremlins.com.hk
  
  /*
  Because he's a character who's looking for his own identity, [He-Man is]
  an interesting role for an actor.
  -- Dolph Lundgren, actor
  */
  
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
  
  * Ben Edwards  +44 (0)117 9400 636 *
  * Critical Site Builderhttp://www.criticaldistribution.com *
  * online collaborative web authoring content management system *
  * i-Contact Progressive Video  http://www.videonetwork.org *
  * Smashing the Corporate image   http://www.subvertise.org *
  * Bristol Indymedia   http://bristol.indymedia.org *
  * Bristol's radical news http://www.bristle.org.uk *
  * PGP : F0CA 42B8 D56F 28AD 169B  49F3 3056 C6DB 8538 EEF8 *
  
 



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


* Ben Edwards  +44 (0)117 9400 636 *
* Critical Site Builderhttp://www.criticaldistribution.com *
* online collaborative web authoring content management system *
* i-Contact Progressive Video  http://www.videonetwork.org *
* Smashing the Corporate image   http://www.subvertise.org *
* Bristol Indymedia   http://bristol.indymedia.org *
* Bristol's radical news http://www.bristle.org.uk *
* PGP : F0CA 42B8 D56F 28AD 169B  49F3 3056 C6DB 8538 EEF8 *




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Current URL, Last URL, error handling

2002-04-04 Thread Julio Nobrega Trabalhando

  Okay, just phpinfo(); and use the variables. You can see whetever you will
need there for url script construction. If you need, setup two pages with
phpinfo() and a link between them so you can check for Referers (the Last
Url you need)

--

Julio Nobrega.

Um dia eu chego lá:
http://sourceforge.net/projects/toca




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php