Re: [PHP] Location in php's source for ini-values
On Sat, February 2, 2008 5:09 am, ehl lhe wrote: hello, I'd like to know where PHP finally sets the php.ini-values in it's sourcecode, e.g. max_execution_time, open_basedir, etc... What I need is to set several static values which must not be editable using php.ini, .htaccess, ini_set, or whatever - so I simply need to set final values for several php.ini-settings by modifying the php sourcecode... open_basedir can't be over-ridden in .htaccess or with ini_set. That would defeat its whole purpose. max_execution_time can be, but I *think* there might be something with php_admin_value that makes it not be over-ridable. I don't know where it is in the source, but I know you can try digging through the source here: http://lxr.php.net/ or here: http://cvs.php.net/ It's not going to be terribly tricky to find, as it's not in the extensions, and it's GOT to be in something pretty basic/fundamental, as well as in the first chunk of code that executes... -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Location in php's source for ini-values
hello, I'd like to know where PHP finally sets the php.ini-values in it's sourcecode, e.g. max_execution_time, open_basedir, etc... What I need is to set several static values which must not be editable using php.ini, .htaccess, ini_set, or whatever - so I simply need to set final values for several php.ini-settings by modifying the php sourcecode... regards, ehl22 _ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Location in php's source for ini-values
On Feb 2, 2008 6:09 AM, ehl lhe [EMAIL PROTECTED] wrote: hello, I'd like to know where PHP finally sets the php.ini-values in it's sourcecode, e.g. max_execution_time, open_basedir, etc... What I need is to set several static values which must not be editable using php.ini, .htaccess, ini_set, or whatever - so I simply need to set final values for several php.ini-settings by modifying the php sourcecode... That's a question that's better asked on the Internals list. Ask on there and you'll probably get the answer you're looking for much quicker. -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] location of the PHP executable
On Wednesday 11 April 2007 23:50, Jarrel Cobb wrote: Don't you have to run locate -u first to generate the database before using locate? You can't just assume a database exists already can you? not an updated one at least, updatedb can also be used to update. and if you're in a little bit of hurry you can also use find -name some part of filename here On 4/11/07, Jim Lucas [EMAIL PROTECTED] wrote: Mattias Thorslund wrote: Hi, I have looked in the documentation but can't find it: My PHP script (which is run from the command prompt - CLI) needs to know the file system location of the PHP executable. This is because it needs to run a second PHP script. I know about the which command but it's not available in all OSes, and that might not be the currently running executable anyway. I could prompt the user for this, but that seems kind of silly. Surely, there must be some way of looking it up automatically? Thanks, Mattias What OS are you working with Assuming you are on a *nix box this should work #locate /php | grep /php$ this should give you locations that have /php as the end of the line on windows you could do this cd \ dir /s php*.exe -- Enjoy, Jim Lucas Different eyes see different things. Different hearts beat on different strings. But there are times for you and me when all such things agree. - Rush -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- --- Børge http://www.arivene.net --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] location of the PHP executable
Børge Holen wrote: On Wednesday 11 April 2007 23:50, Jarrel Cobb wrote: Don't you have to run locate -u first to generate the database before using locate? You can't just assume a database exists already can you? not an updated one at least, updatedb can also be used to update. Probably can't because the database has to be created as root.. unless you get into using the switches which seems like a lot more hassle than it's worth but *shrug*. If this is for a cron command, try env php which should pick whichever is in the $PATH for the cron environment. Not 100% guaranteed but 90% should work. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] location of the PHP executable
Em Quarta 11 Abril 2007 19:38, Buesching, Logan J escreveu: IF db not exists THEN locate -u END-IF I'd hate to see the time it'd take to create a first-time database... this could take awhile to run. _maybe_ locate -u is faster than ls / -Rv... Need to test before said anything... =P # df -h Sist. Arq.Tam Usad Disp Uso% Montado em /dev/hda3 18G 16G 473M 98% / udev 506M 752K 506M 1% /dev cachedir 18G 16G 473M 98% /lib/splash/cache shm 506M 0 506M 0% /dev/shm /dev/sda1 112G 112G 249M 100% /mnt/win2 /dev/sdb1 150G 132G 18G 89% /mnt/win3 /dev/hdb1 75G 37G 39G 49% /mnt/win1 maybe I test both here... XD # time locate -u time locate combate.php real23m19.453s user0m6.600s sys 0m20.200s /mnt/win1/Documents and Settings/Davi/Desktop/stellar/codigo/php/combate.php /mnt/win1/Documents and Settings/Davi/Meus documentos/stellar/codigo/php/combate.php /mnt/win3/backup 021106/Desktop/jogos/combate.php /mnt/win3/backup 021106/Desktop/stellar/combate.php /mnt/win3/backup 021106/Desktop/stellar/stellar/combate.php /mnt/win3/backup 021106/Desktop/stellar/stellar/site/combate.php /home/davi/stellar/codigo/php/combate.php real0m1.680s user0m0.520s sys 0m0.060s I'm trying to find anything using ls... ls / -Rv | grep -iE combate.php$ But I can't retrieve the entire path yet... u.u' But time seen to be the same... Sorry poor english... []s -- Davi Vidal [EMAIL PROTECTED] [EMAIL PROTECTED] -- Agora com fortune: Never trust an operating system you don't have sources for. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] location of the PHP executable
Hi, I have looked in the documentation but can't find it: My PHP script (which is run from the command prompt - CLI) needs to know the file system location of the PHP executable. This is because it needs to run a second PHP script. I know about the which command but it's not available in all OSes, and that might not be the currently running executable anyway. I could prompt the user for this, but that seems kind of silly. Surely, there must be some way of looking it up automatically? Thanks, Mattias -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] location of the PHP executable
Mattias Thorslund wrote: Hi, I have looked in the documentation but can't find it: My PHP script (which is run from the command prompt - CLI) needs to know the file system location of the PHP executable. This is because it needs to run a second PHP script. I know about the which command but it's not available in all OSes, and that might not be the currently running executable anyway. I could prompt the user for this, but that seems kind of silly. Surely, there must be some way of looking it up automatically? Thanks, Mattias What OS are you working with Assuming you are on a *nix box this should work #locate /php | grep /php$ this should give you locations that have /php as the end of the line on windows you could do this cd \ dir /s php*.exe -- Enjoy, Jim Lucas Different eyes see different things. Different hearts beat on different strings. But there are times for you and me when all such things agree. - Rush -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] location of the PHP executable
Don't you have to run locate -u first to generate the database before using locate? You can't just assume a database exists already can you? On 4/11/07, Jim Lucas [EMAIL PROTECTED] wrote: Mattias Thorslund wrote: Hi, I have looked in the documentation but can't find it: My PHP script (which is run from the command prompt - CLI) needs to know the file system location of the PHP executable. This is because it needs to run a second PHP script. I know about the which command but it's not available in all OSes, and that might not be the currently running executable anyway. I could prompt the user for this, but that seems kind of silly. Surely, there must be some way of looking it up automatically? Thanks, Mattias What OS are you working with Assuming you are on a *nix box this should work #locate /php | grep /php$ this should give you locations that have /php as the end of the line on windows you could do this cd \ dir /s php*.exe -- Enjoy, Jim Lucas Different eyes see different things. Different hearts beat on different strings. But there are times for you and me when all such things agree. - Rush -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] location of the PHP executable
Em Quarta 11 Abril 2007 18:50, Jarrel Cobb escreveu: Don't you have to run locate -u first to generate the database before using locate? You can't just assume a database exists already can you? If you can use locate, you can use which... =P BTW, do something to check OS then: IF OS == *nix THEN IF exists /usr/bin/which THEN which php ELSE IF exists /usr/bin/locate THEN IF db not exists THEN locate -u END-IF locate php | grep -iE php$ ELSE IF exists /usr/bin/find THEN find / -name php | grep -iE php$ ELSE cd / ls php -Rv END-IF END-IF END-IF ELSE cd \ dir php*.exe /s END-IF Check if I don't miss any END-IF... =P []s -- Davi Vidal [EMAIL PROTECTED] [EMAIL PROTECTED] -- Agora com fortune: rugged, adj.: Too heavy to lift. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] location of the PHP executable
Jim Lucas wrote: Mattias Thorslund wrote: Hi, I have looked in the documentation but can't find it: My PHP script (which is run from the command prompt - CLI) needs to know the file system location of the PHP executable. This is because it needs to run a second PHP script. I know about the which command but it's not available in all OSes, and that might not be the currently running executable anyway. I could prompt the user for this, but that seems kind of silly. Surely, there must be some way of looking it up automatically? Thanks, Mattias What OS are you working with Assuming you are on a *nix box this should work #locate /php | grep /php$ this should give you locations that have /php as the end of the line on windows you could do this cd \ dir /s php*.exe Thanks Jim (and others) for the suggestions. I think they will be helpful if there isn't a way to do what I'm looking for: Ideally, I would like to get the location of the PHP executable that is actually executing the script. I'm thinking there would be some way to find out while the script is executing. Something like: ?php $executable_location = get_location_of_current_executable(); //fictitious function echo $executable_location .\n; ? Running it from the command line (again fiction): $ /my-location-of/php myscript.php /my-location-of/php $ I was hoping there's a function or $_SERVER property that would contain this? Thanks again, Mattias -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] location of the PHP executable
IF db not exists THEN locate -u END-IF I'd hate to see the time it'd take to create a first-time database... this could take awhile to run. -Original Message- From: Davi [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 11, 2007 6:10 PM To: php-general@lists.php.net Subject: Re: [PHP] location of the PHP executable Em Quarta 11 Abril 2007 18:50, Jarrel Cobb escreveu: Don't you have to run locate -u first to generate the database before using locate? You can't just assume a database exists already can you? If you can use locate, you can use which... =P BTW, do something to check OS then: IF OS == *nix THEN IF exists /usr/bin/which THEN which php ELSE IF exists /usr/bin/locate THEN locate php | grep -iE php$ ELSE IF exists /usr/bin/find THEN find / -name php | grep -iE php$ ELSE cd / ls php -Rv END-IF END-IF END-IF ELSE cd \ dir php*.exe /s END-IF Check if I don't miss any END-IF... =P []s -- Davi Vidal [EMAIL PROTECTED] [EMAIL PROTECTED] -- Agora com fortune: rugged, adj.: Too heavy to lift. -- 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] location of the PHP executable
Mattias Thorslund wrote: Jim Lucas wrote: ... $ /my-location-of/php myscript.php /my-location-of/php $ I was hoping there's a function or $_SERVER property that would contain this? have you tried looking for this info you want? I can't say for sure if it always exists but on the few boxes I tried I found and entry in both $_SERVER and $_ENV: _ = '/usr/bin/php' but that was only on linux. on windows (where my php cli install is a bit borked), I didn't find it but I did find PHPRC which points to the directory that the php executable lives in. these maybe of some use. then again what ever it is your trying to do with the php script you seem to need to run inside another instance of php could probably be run within the context of the calling script - if you run it inside a function you can stop any kind of variable scope clashes (assuming there are no symbol name clashes [e.g. duplicate functions/classes]): function runit() { include 'myscript.php'; } it's just a thought. Thanks again, Mattias -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] location of the PHP executable
On Wed, April 11, 2007 2:49 pm, Mattias Thorslund wrote: I have looked in the documentation but can't find it: My PHP script (which is run from the command prompt - CLI) needs to know the file system location of the PHP executable. This is because it needs to run a second PHP script. I know about the which command but it's not available in all OSes, and that might not be the currently running executable anyway. I could prompt the user for this, but that seems kind of silly. Surely, there must be some way of looking it up automatically? The generalized answer to any question of this nature is: If the answer you want isn't in ?php phpinfo();? output, then the answer you want probably isn't available. In *my* installation: which php yields: /usr/bin/php Then: php -i | grep /usr/bin/php yields $_SERVER[_] and $_ENV[_] No promise this works for any/all platforms, however. PS For the 'locate' sub-thread -- You can't even guarantee that 'locate' will be available, much less initialized... I don't think it's a good solution, in general. YMMV NAIAA IANAL -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] location of the PHP executable
Jochem Maas wrote: have you tried looking for this info you want? Yup, but the manual seems kind of light on the subject. I can't say for sure if it always exists but on the few boxes I tried I found and entry in both $_SERVER and $_ENV: _ = '/usr/bin/php' I found these in $_ENV and $_SERVER, on Linux. I don't have handy access to a working Windows installation, yet it needs to work on Windows as well. If it really does exist on Windows, this might be the ticket, otherwise a partial solution for Linux only. but that was only on linux. on windows (where my php cli install is a bit borked), I didn't find it but I did find PHPRC which points to the directory that the php executable lives in. That's at least something. If someone could confirm, that would be great. I used the following command (at the command-line) to check the contents of $_SERVER: php -r 'print_r($_SERVER);' Obviously, $_ENV can be checked similarly. these maybe of some use. Yes very useful, thanks. then again what ever it is your trying to do with the php script you seem to need to run inside another instance of php could probably be run within the context of the calling script - if you run it inside a function you can stop any kind of variable scope clashes (assuming there are no symbol name clashes [e.g. duplicate functions/classes]): function runit() { include 'myscript.php'; } it's just a thought. Unfortunately, I think it's not an option in my case. The sub-process I run this way are way, way too big to include in the main process. As long as I was just running it on my own systems, it was easy to hard-code the location of the PHP executable but now that it's being distributed, it needs to just work... Thanks again, Mattias -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] location of the PHP executable
your script should try it's best to find the executable, on failure you might consider having it mail an error to you so at least you can pre-empt the client with regard to getting things working. most windows machines will probably have there php binary at: $_ENV['PHPRC'].'php.exe' variations on the exe name can be (IIRC): 'php-win.exe' 'php-cli.exe' I think you can be pretty sure about $_ENV['_'] on *nix systems. another to consider is a simple installer which tries to find the exe and on failure offers the user a prompt to say where it is .. that info can then be stored for use at a later date. Mattias Thorslund wrote: Jochem Maas wrote: have you tried looking for this info you want? Yup, but the manual seems kind of light on the subject. I can't say for sure if it always exists but on the few boxes I tried I found and entry in both $_SERVER and $_ENV: _ = '/usr/bin/php' I found these in $_ENV and $_SERVER, on Linux. I don't have handy access to a working Windows installation, yet it needs to work on Windows as well. If it really does exist on Windows, this might be the ticket, otherwise a partial solution for Linux only. but that was only on linux. on windows (where my php cli install is a bit borked), I didn't find it but I did find PHPRC which points to the directory that the php executable lives in. That's at least something. If someone could confirm, that would be great. I used the following command (at the command-line) to check the contents of $_SERVER: php -r 'print_r($_SERVER);' Obviously, $_ENV can be checked similarly. these maybe of some use. Yes very useful, thanks. then again what ever it is your trying to do with the php script you seem to need to run inside another instance of php could probably be run within the context of the calling script - if you run it inside a function you can stop any kind of variable scope clashes (assuming there are no symbol name clashes [e.g. duplicate functions/classes]): function runit() { include 'myscript.php'; } it's just a thought. Unfortunately, I think it's not an option in my case. The sub-process I run this way are way, way too big to include in the main process. As long as I was just running it on my own systems, it was easy to hard-code the location of the PHP executable but now that it's being distributed, it needs to just work... Thanks again, Mattias -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Location of .so files on Linux box
This probably belongs in php-install, but here goes. Where should extension files be located? In php.ini the default entry for extension_dir is: extension_dir= ./ That's fine, but relative to which directory (locations in parentheses)? Where php.ini is located? (/usr/share/lib) Where apache2 loads it modules? (/usr/lib/apache2/modules) I'm puzzled and could not find any clues in the documents. Apache2 is not complaining on a restart. If I run PHP from the command line, it complains that it cannot find the extensions, but I understand that. Regards - Miles Thompson
Re: [PHP] Location of .so files on Linux box
On Tuesday 10 April 2007 15:24, Miles Thompson wrote: This probably belongs in php-install, but here goes. Where should extension files be located? In php.ini the default entry for extension_dir is: extension_dir= ./ That's fine, but relative to which directory (locations in parentheses)? Where php.ini is located? (/usr/share/lib) Where apache2 loads it modules? (/usr/lib/apache2/modules) I'm puzzled and could not find any clues in the documents. Apache2 is not complaining on a restart. If I run PHP from the command line, it complains that it cannot find the extensions, but I understand that. Regards - Miles Thompson it probably defaults to the path configured at make time. this also probably varies due to different opinions of both the dist and the makers camp. but /usr/lib/ rather than /usr/share/ this is specific -- --- Børge http://www.arivene.net --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Location of .so files on Linux box
On Tue, April 10, 2007 8:24 am, Miles Thompson wrote: This probably belongs in php-install, but here goes. Where should extension files be located? Yes. :-) They should go wherever it makes sense on your setup. In php.ini the default entry for extension_dir is: extension_dir= ./ That's fine, but relative to which directory (locations in parentheses)? Where php.ini is located? (/usr/share/lib) Where apache2 loads it modules? (/usr/lib/apache2/modules) I'm puzzled and could not find any clues in the documents. Apache2 is not complaining on a restart. If I run PHP from the command line, it complains that it cannot find the extensions, but I understand that. I don't claim to know what ./ is in this regard, but I've never left it at that setting... -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Location ....
On Wed, December 28, 2005 8:15 am, Christian Ista wrote: PHP? I tried this code : header(Location: mypage.php); But in some case, I have error message headers already sent. Then I You know the old saying, You can't step in the same stream twice? Think about it. Really think about it. Now... The data being sent to the browser from Apache/PHP is a stream. Its raw output looks something like this: --- HTTP/1.1 200 OK Date: Fri, 30 Dec 2005 19:52:44 GMT Server: Apache/1.3.34 (Unix) DAV/1.0.3 PHP/4.4.1 mod_ssl/2.8.25 OpenSSL/0.9.7d-p1 X-Powered-By: PHP/4.4.1 Connection: close Content-Type: text/html HTML HEAD TITLELynch Interplanetary Enterprises/TITLE /HEAD . . . /HTML --- Now, pay VERY close attention to that blank line right after the Content-type: text/html line. That BLANK line marks the end of the headers Everything above the blank line is in the headers Everything below is the body of the HTTP, which is what the browser shows you with View Source Now, imagine all that output, headers and blank line and body, streaming out from your server, like water from a garden hose. There's a lot you can do to it before the water gets shot out the end of the nozzle. You could add a water heater and treat your lawn to a warm shower instead of cold. You could add a filtration system and give your lawn distilled water. You could add a plant food system to give it yummy chemicals. Buut Once that water leaves the host, you don't have a lot of control over it. It's gone. Beyond re-calling. In the same way, once PHP sends the BLANK LINE to denote the end of headers, you can't send more headers. This works: --- HTTP/1.1 200 OK Date: Fri, 30 Dec 2005 19:52:44 GMT Server: Apache/1.3.34 (Unix) DAV/1.0.3 PHP/4.4.1 mod_ssl/2.8.25 OpenSSL/0.9.7d-p1 X-Powered-By: PHP/4.4.1 Connection: close Content-Type: text/html Location: mypage.php HTML HEAD TITLELynch Interplanetary Enterprises/TITLE /HEAD . . . /HTML --- This can NOT work: --- HTTP/1.1 200 OK Date: Fri, 30 Dec 2005 19:52:44 GMT Server: Apache/1.3.34 (Unix) DAV/1.0.3 PHP/4.4.1 mod_ssl/2.8.25 OpenSSL/0.9.7d-p1 X-Powered-By: PHP/4.4.1 Connection: close Content-Type: text/html HTML Location: mypage.php HEAD TITLELynch Interplanetary Enterprises/TITLE /HEAD . . . /HTML --- Look carefully for the position of the line Location: mypage.php See the difference? If you try to call the header() function AFTER some content has been sent, then you get the error message. Move the header() line earlier in your PHP code, and it will work fine. PS Blank lines and spaces COUNT as output. So this: ?php $x = 1; ? ?php header(Location: mypage.php);? will NOT work because that space counts This will work: ?php $x = 1; ??php header(Location: mypage.php);? Similarly, watch out for BLANK LINES after the last ? in your files. They will trip you up for header() -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Location ....
On Fri, 2005-12-30 at 15:04, Richard Lynch wrote: On Wed, December 28, 2005 8:15 am, Christian Ista wrote: PHP? I tried this code : header(Location: mypage.php); *LOL* That was one of the best write-ups I've ever read concerning the headers already sent error message. Similarly, watch out for BLANK LINES after the last ? in your files. They will trip you up for header() Regarding that last ? in scripts, the PHP engine intentionally supports it's omission so that you don't have to think about whether there's an invisible trailing space after it. Cheers, Rob. -- .. | 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] Location ....
On Fri, December 30, 2005 2:16 pm, Robert Cummings wrote: Similarly, watch out for BLANK LINES after the last ? in your files. They will trip you up for header() Regarding that last ? in scripts, the PHP engine intentionally supports it's omission so that you don't have to think about whether there's an invisible trailing space after it. I'm old. In PHP 3.0, it would mess you up. Particularly fun was the EMACS setting that automagically added a newline for any text file you edited that didn't have one at the end... *THAT* sure caused a lot of fun on this list back in the day. :-) Old habits die hard. Plus, somewhere, I probably have a PHP 3.0 install still running on some old box... Not tied directly to the 'net nor in production, but still... :-) -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Location ....
Christian Ista wrote: From: Jay Blanchard [mailto:[EMAIL PROTECTED] Header is a good solution, and is the only one available in PHP for redirects. It requires that you do not send anything else out to the browsers before sending the redirect, which is what is causing your error. You can always use the output buffer functions to assist with that. Ok but there is something more strange. I use header location in a switch/case. An header location by case. I don't understand at the end of the case, the header location don't work and I go through the others cases. I would do a simple thing, use exit() after header. Though this should not happen.. Regards, -- Sameer N. Ingole /*/ Better to light one candle than to curse the darkness. /*/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Location ....
Hello, Could you tell me a efficient solution for change page (new location) in PHP? I tried this code : header(Location: mypage.php); But in some case, I have error message heade already send. Then I use a javascript solution : window.location.href=mypage.php; Is there a good solution in php ? Thanks, C. ___ Christian Ista http://www.cista.be -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Location ....
[snip] Could you tell me a efficient solution for change page (new location) in PHP? I tried this code : header(Location: mypage.php); But in some case, I have error message heade already send. Then I use a javascript solution : window.location.href=mypage.php; Is there a good solution in php ? [/snip] Header is a good solution, and is the only one available in PHP for redirects. It requires that you do not send anything else out to the browsers before sending the redirect, which is what is causing your error. You can always use the output buffer functions to assist with that. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Location ....
Christian Ista wrote: Hello, Could you tell me a efficient solution for change page (new location) in PHP? I tried this code : header(Location: mypage.php); note: HTTP/1.1 requires an absolute URI http://php.net/header But in some case, I have error message heade already send. Then I use a javascript solution : window.location.href=mypage.php; Is there a good solution in php ? Check out 'headers_sent', you can choose how to redirect ('header' or JavaScript) depending on whether you have sent the headers or not. http://php.net/headers_sent HTH, cheers Silvio -- tradeOver | http://www.tradeover.net ...ready to become the King of the World? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Location ....
From: Jay Blanchard [mailto:[EMAIL PROTECTED] Header is a good solution, and is the only one available in PHP for redirects. It requires that you do not send anything else out to the browsers before sending the redirect, which is what is causing your error. You can always use the output buffer functions to assist with that. Ok but there is something more strange. I use header location in a switch/case. An header location by case. I don't understand at the end of the case, the header location don't work and I go through the others cases. Any idea why ? Thanks, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Location ....
[snip] Ok but there is something more strange. I use header location in a switch/case. An header location by case. I don't understand at the end of the case, the header location don't work and I go through the others cases. Any idea why ? [/snip] Not without seeing code. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Location ....
On Wed, Dec 28, 2005 at 03:15:09PM +0100, Christian Ista wrote: Hello, Could you tell me a efficient solution for change page (new location) in PHP? I tried this code : header(Location: mypage.php); But in some case, I have error message heade already send. Then I use a javascript solution : window.location.href=mypage.php; If you look at the error message it tells you exactly what line the headers were sent at. I'm to tired to explain what do do once you find that hopefully you'll see the problem. Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Location header does not work?
I really appreciate everyone who responded taking your valuable time looking into my problem. Now back to my problem. Changing the condition to if($_SERVER['HTTPS'] != 'on') did not make any difference unfortunately. So the result was still the URL in the Address box of the browser changed to https://computing.eng.iastate.edu/mambo/index.php?option=contenttask=viewid=159Itemid=162 fine. But instead of showing the page that https address should point to, 'You are in HTTPS mode' was displayed as the else clause specified. Bing On Wed, 4 Aug 2004 17:02:30 -0500 (CDT), Bing Du [EMAIL PROTECTED] wrote: Ok, now I'm confused and cannot understand the result of the following code snippet. After click the link that I want to redirect, the URL in the Address box of the browser changed from http to https fine (that's what I expected). But 'hello my friend' was also displayed. How come? if ($option == 'content' and $task == 'view' and $id == 159 and $Itemid = 162) { session_write_close(); if (!isset($_SERVER['HTTPS'])) { header(Location: https://computing.eng.iastate.edu/mambo/index.php?option=contenttask=viewid=159Itemid=162;); } else { echo 'hello my friend'; } =if ($option == 'content' and $task == 'view' and $id == 159 and $Itemid == 162) { if($_SERVER['HTTPS'] != 'on') { header('Location: https://computing.eng.iastate.edu/mambo/index.php'. '?option=contenttask=viewid=159Itemid=162'); } else { echo 'You are in HTTPS mode.'; //do stuff } } Bing On Tue, 3 Aug 2004 15:34:27 -0500 (CDT), Bing Du [EMAIL PROTECTED] wrote: The latest message I got was 'Redirection limit for this URL exceeded. Unable to load the requested page.This may be caused by cookies that are blocked.'. Your page is redirecting you over and over again. Your problem is that you're not checking for https before you redirect! If the user comes in with the https URL, you're still redirecting them. Try checking the value of $_SERVER['HTTPS']. Bing On Tuesday 03 August 2004 15:41, Bing Du offered up the following tid-bit of information : I've been struggling with this redirect thing for a while but still cannot get it work. I'm desperately needing help, please. What I want to do is redirect http://computing.eng.iastate.edu/mambo/index.php?option=contenttask=view id=159Itemid=162 to https://computing.eng.iastate.edu/mambo/index.php?option=contenttask=vie wid=159Itemid=162. The only difference between the above two URLs is one is http and the other is https. = if ($option == 'content' and $task == 'view' and $id = 159 and $Itemid == 162) { session_write_close(); header(Location: https://computing.eng.iastate.edu/mambo/index.php?option=contenttask=vie wid=159Itemid=162); exit; } = Am I doing anything wrong with the Location header? What's the error? Is it just not forwarding? Headers already sent? -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php !DSPAM:41115ae5170651561813149! -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Location header does not work?
On 05 August 2004 16:36, Bing Du wrote: I really appreciate everyone who responded taking your valuable time looking into my problem. Now back to my problem. Changing the condition to if($_SERVER['HTTPS'] != 'on') did not make any difference unfortunately. So the result was still the URL in the Address box of the browser changed to https://computing.eng.iastate.edu/mambo/index.php?option=conte nttask=viewid=159Itemid=162 fine. But instead of showing the page that https address should point to, 'You are in HTTPS mode' was displayed as the else clause specified. Right, you're obviously not getting this, so let's take it step by step. (1) Your browser requests https://computing.eng.iastate.edu/mambo/index.php?option=contenttask=viewi d=159Itemid=162 (2) This fires the script /mambo/index.php on your server. (3) Script finds all conditions in the first if() are met, so tests $_SERVER['HTTPS']. (4) ... finding it is not set, it issues a Location: redirect to https://computing.eng.iastate.edu/mambo/index.php?option=contenttask=viewi d=159Itemid=162 (5) Browser sees the redirect, and issues a new request for https://computing.eng.iastate.edu/mambo/index.php?option=contenttask=viewi d=159Itemid=162; at this point, it also changes the URL displayed in its address bar. (6) This seems to be where you are confused -- WHICH PAGE DO YOU THINK THIS IS GOING TO LOAD? (6a) Server sees new request, this time via https, to exactly the same script as before, so fires the script /mambo/index.php again. (7) See (3). (8) This time it finds $_SERVER['HTTPS'] is set (or =='on', depending), and echos 'You are in HTTPS mode'. (9) QED Which step isn't what you were expecting? Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Location header does not work?
On 05 August 2004 17:12, Ford, Mike [LSS] wrote: (1) Your browser requests https://computing.eng.iastate.edu/mambo/index.php?option=conte nttask=viewi d=159Itemid=162 Bother! Sorry, that should, of course, be http:// in step (1)! Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Location header does not work?
I sent Bing specific code that will work: If (!IsSet($_SERVER[HTTPS])) Header(Location: https://; . $_SERVER[HTTP_HOST] . $_SERVER[REQUEST_URI]); Manually go to the URL specified. https://computing.eng.iastate.edu/mambo/index.php?option=contenttask=viewi d=159Itemid=162 It doesn't work. It will work if you remove all of the parameters and it will work if you specify only a few of the parameters. Basically, there is a problem with the mambo application handling input. Bing persists in troubleshooting the redirect when the focus should be on mambo. -Original Message- Right, you're obviously not getting this, so let's take it step by step. (1) Your browser requests https://computing.eng.iastate.edu/mambo/index.php?option=contenttask=view i d=159Itemid=162 (2) This fires the script /mambo/index.php on your server. (3) Script finds all conditions in the first if() are met, so tests $_SERVER['HTTPS']. (4) ... finding it is not set, it issues a Location: redirect to https://computing.eng.iastate.edu/mambo/index.php?option=contenttask=view i d=159Itemid=162 (5) Browser sees the redirect, and issues a new request for https://computing.eng.iastate.edu/mambo/index.php?option=contenttask=view i d=159Itemid=162; at this point, it also changes the URL displayed in its address bar. (6) This seems to be where you are confused -- WHICH PAGE DO YOU THINK THIS IS GOING TO LOAD? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Location header does not work?
On Thu, 5 Aug 2004 10:35:47 -0500 (CDT), Bing Du [EMAIL PROTECTED] wrote: I really appreciate everyone who responded taking your valuable time looking into my problem. Now back to my problem. Changing the condition to if($_SERVER['HTTPS'] != 'on') did not make any difference unfortunately. So the result was still the URL in the Address box of the browser changed to https://computing.eng.iastate.edu/mambo/index.php?option=contenttask=viewid=159Itemid=162 fine. But instead of showing the page that https address should point to, 'You are in HTTPS mode' was displayed as the else clause specified. So what's the answer? REMOVE THE ELSE. If you want it to run the code following the redirect code in the same script if it's not using those request params or in https mode, do: if ($option == 'content' and $task == 'view' and $id == 159 and $Itemid == 162) { if(isset($_SERVER['HTTPS'])) { header('Location: https://computing.eng.iastate.edu/mambo/index.php'. '?option=contenttask=viewid=159Itemid=162'); } } As simple as that. If that's not the answer, you're asking the wrong question. Bing On Wed, 4 Aug 2004 17:02:30 -0500 (CDT), Bing Du [EMAIL PROTECTED] wrote: Ok, now I'm confused and cannot understand the result of the following code snippet. After click the link that I want to redirect, the URL in the Address box of the browser changed from http to https fine (that's what I expected). But 'hello my friend' was also displayed. How come? if ($option == 'content' and $task == 'view' and $id == 159 and $Itemid = 162) { session_write_close(); if (!isset($_SERVER['HTTPS'])) { header(Location: https://computing.eng.iastate.edu/mambo/index.php?option=contenttask=viewid=159Itemid=162;); } else { echo 'hello my friend'; } =if ($option == 'content' and $task == 'view' and $id == 159 and $Itemid == 162) { if($_SERVER['HTTPS'] != 'on') { header('Location: https://computing.eng.iastate.edu/mambo/index.php'. '?option=contenttask=viewid=159Itemid=162'); } else { echo 'You are in HTTPS mode.'; //do stuff } } Bing On Tue, 3 Aug 2004 15:34:27 -0500 (CDT), Bing Du [EMAIL PROTECTED] wrote: The latest message I got was 'Redirection limit for this URL exceeded. Unable to load the requested page.This may be caused by cookies that are blocked.'. Your page is redirecting you over and over again. Your problem is that you're not checking for https before you redirect! If the user comes in with the https URL, you're still redirecting them. Try checking the value of $_SERVER['HTTPS']. Bing On Tuesday 03 August 2004 15:41, Bing Du offered up the following tid-bit of information : I've been struggling with this redirect thing for a while but still cannot get it work. I'm desperately needing help, please. What I want to do is redirect http://computing.eng.iastate.edu/mambo/index.php?option=contenttask=view id=159Itemid=162 to https://computing.eng.iastate.edu/mambo/index.php?option=contenttask=vie wid=159Itemid=162. The only difference between the above two URLs is one is http and the other is https. = if ($option == 'content' and $task == 'view' and $id = 159 and $Itemid == 162) { session_write_close(); header(Location: https://computing.eng.iastate.edu/mambo/index.php?option=contenttask=vie wid=159Itemid=162); exit; } = Am I doing anything wrong with the Location header? What's the error? Is it just not forwarding? Headers already sent? -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Location header does not work?
Quoting Justin Patrin [EMAIL PROTECTED]: On Tue, 3 Aug 2004 15:34:27 -0500 (CDT), Bing Du [EMAIL PROTECTED] wrote: The latest message I got was 'Redirection limit for this URL exceeded. Unable to load the requested page.This may be caused by cookies that are blocked.'. Your page is redirecting you over and over again. Your problem is that you're not checking for https before you redirect! If the user comes in with the https URL, you're still redirecting them. Try checking the value of $_SERVER['HTTPS']. Also, FWIW, you're supposed to also change the HTTP response code to one that explains the reason for the redirect. Some server setups will throw a 500 Server Error if you use just Location. So add the following before any other header output: header($_SERVER['SERVER_PROTOCOL'].' 302 Found'); The HTTP RFC offers various 3xx response codes and you should make the effort of using the appropriate one. Other often useful responses are 301 Moved Permanently and 303 See Other. The actual text doesn't matter but the code does. -- Romanian Web Developers - http://ROWD.ORG -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Location header does not work?
Ok, now I'm confused and cannot understand the result of the following code snippet. After click the link that I want to redirect, the URL in the Address box of the browser changed from http to https fine (that's what I expected). But 'hello my friend' was also displayed. How come? = if ($option == 'content' and $task == 'view' and $id == 159 and $Itemid == 162) { session_write_close(); if (!isset($_SERVER['HTTPS'])) { header(Location: https://computing.eng.iastate.edu/mambo/index.php?option=contenttask=viewid=159Itemid=162;); } else { echo 'hello my friend'; } Bing On Tue, 3 Aug 2004 15:34:27 -0500 (CDT), Bing Du [EMAIL PROTECTED] wrote: The latest message I got was 'Redirection limit for this URL exceeded. Unable to load the requested page.This may be caused by cookies that are blocked.'. Your page is redirecting you over and over again. Your problem is that you're not checking for https before you redirect! If the user comes in with the https URL, you're still redirecting them. Try checking the value of $_SERVER['HTTPS']. Bing On Tuesday 03 August 2004 15:41, Bing Du offered up the following tid-bit of information : I've been struggling with this redirect thing for a while but still cannot get it work. I'm desperately needing help, please. What I want to do is redirect http://computing.eng.iastate.edu/mambo/index.php?option=contenttask=view id=159Itemid=162 to https://computing.eng.iastate.edu/mambo/index.php?option=contenttask=vie wid=159Itemid=162. The only difference between the above two URLs is one is http and the other is https. = if ($option == 'content' and $task == 'view' and $id == 159 and $Itemid == 162) { session_write_close(); header(Location: https://computing.eng.iastate.edu/mambo/index.php?option=contenttask=vie wid=159Itemid=162); exit; } = Am I doing anything wrong with the Location header? What's the error? Is it just not forwarding? Headers already sent? -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Location header does not work?
On Wed, 4 Aug 2004 17:02:30 -0500 (CDT), Bing Du [EMAIL PROTECTED] wrote: Ok, now I'm confused and cannot understand the result of the following code snippet. After click the link that I want to redirect, the URL in the Address box of the browser changed from http to https fine (that's what I expected). But 'hello my friend' was also displayed. How come? = if ($option == 'content' and $task == 'view' and $id == 159 and $Itemid == 162) { session_write_close(); if (!isset($_SERVER['HTTPS'])) { header(Location: https://computing.eng.iastate.edu/mambo/index.php?option=contenttask=viewid=159Itemid=162;); } else { echo 'hello my friend'; } if ($option == 'content' and $task == 'view' and $id == 159 and $Itemid == 162) { if($_SERVER['HTTPS'] != 'on') { header('Location: https://computing.eng.iastate.edu/mambo/index.php'. '?option=contenttask=viewid=159Itemid=162'); } else { echo 'You are in HTTPS mode.'; //do stuff } } Bing On Tue, 3 Aug 2004 15:34:27 -0500 (CDT), Bing Du [EMAIL PROTECTED] wrote: The latest message I got was 'Redirection limit for this URL exceeded. Unable to load the requested page.This may be caused by cookies that are blocked.'. Your page is redirecting you over and over again. Your problem is that you're not checking for https before you redirect! If the user comes in with the https URL, you're still redirecting them. Try checking the value of $_SERVER['HTTPS']. Bing On Tuesday 03 August 2004 15:41, Bing Du offered up the following tid-bit of information : I've been struggling with this redirect thing for a while but still cannot get it work. I'm desperately needing help, please. What I want to do is redirect http://computing.eng.iastate.edu/mambo/index.php?option=contenttask=view id=159Itemid=162 to https://computing.eng.iastate.edu/mambo/index.php?option=contenttask=vie wid=159Itemid=162. The only difference between the above two URLs is one is http and the other is https. = if ($option == 'content' and $task == 'view' and $id == 159 and $Itemid == 162) { session_write_close(); header(Location: https://computing.eng.iastate.edu/mambo/index.php?option=contenttask=vie wid=159Itemid=162); exit; } = Am I doing anything wrong with the Location header? What's the error? Is it just not forwarding? Headers already sent? -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php !DSPAM:41115ae5170651561813149! -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Location header does not work?
On Thursday 05 August 2004 06:18, Justin Patrin wrote: if($_SERVER['HTTPS'] != 'on') { Careful, IIRC the value of $_SERVER['HTTPS'] differs depending on websever. The original isset() is the better way. Bing, IIRC you're redirecting back to the same page weren't you? if ($option == 'content' and $task == 'view' and $id == 159 and $Itemid == 162) { session_write_close(); if (!isset($_SERVER['HTTPS'])) { header(Location: https://computing.eng.iastate.edu/mambo/index.php?option=contenttask=view; id=159Itemid=162); } else { echo 'hello my friend'; } Your logic states if not in HTTPS redirect to HTTPS, otherwise (if in HTTPS) echo. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Living in LA is like not having a date on Saturday night. -- Candice Bergen */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Location header does not work?
I've been struggling with this redirect thing for a while but still cannot get it work. I'm desperately needing help, please. What I want to do is redirect http://computing.eng.iastate.edu/mambo/index.php?option=contenttask=viewid=159Itemid=162 to https://computing.eng.iastate.edu/mambo/index.php?option=contenttask=viewid=159Itemid=162. The only difference between the above two URLs is one is http and the other is https. == if ($option == 'content' and $task == 'view' and $id == 159 and $Itemid == 162) { session_write_close(); header(Location: https://computing.eng.iastate.edu/mambo/index.php?option=contenttask=viewid=159Itemid=162;); exit; } == Am I doing anything wrong with the Location header? Any help would be greatly appreciated. Bing -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Location header does not work?
On Tuesday 03 August 2004 15:41, Bing Du offered up the following tid-bit of information : I've been struggling with this redirect thing for a while but still cannot get it work. I'm desperately needing help, please. What I want to do is redirect http://computing.eng.iastate.edu/mambo/index.php?option=contenttask=view id=159Itemid=162 to https://computing.eng.iastate.edu/mambo/index.php?option=contenttask=vie wid=159Itemid=162. The only difference between the above two URLs is one is http and the other is https. == if ($option == 'content' and $task == 'view' and $id == 159 and $Itemid == 162) { session_write_close(); header(Location: https://computing.eng.iastate.edu/mambo/index.php?option=contenttask=vie wid=159Itemid=162); exit; } == Am I doing anything wrong with the Location header? What's the error? Is it just not forwarding? Headers already sent? -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Location header does not work?
On Wednesday 04 August 2004 03:41, Bing Du wrote: == if ($option == 'content' and $task == 'view' and $id == 159 and $Itemid == 162) { session_write_close(); header(Location: https://computing.eng.iastate.edu/mambo/index.php?option=contenttask=view; id=159Itemid=162); exit; } == Am I doing anything wrong with the Location header? It looks OK. Any help would be greatly appreciated. Add an else cause: else { echo if clause failed; } -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* The reason why worry kills more people than work is that more people worry than work. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Location header does not work?
I've been struggling with this redirect thing for a while but still cannot get it work. I'm desperately needing help, please. What I want to do is redirect http://computing.eng.iastate.edu/mambo/index.php?option=contenttask=viewid=159Itemid=162 to https://computing.eng.iastate.edu/mambo/index.php?option=contenttask=viewid=159Itemid=162. The only difference between the above two URLs is one is http and the other is https. == if ($option == 'content' and $task == 'view' and $id == 159 and $Itemid == 162) { session_write_close(); header(Location: https://computing.eng.iastate.edu/mambo/index.php?option=contenttask=viewid=159Itemid=162;); exit; } == Am I doing anything wrong with the Location header? Any help would be greatly appreciated. Bing Looks correct to me. Are you meeting all the requirements for that if statement? You have a lot of and's there. For testing you could try: if ($option == 'content' and $task == 'view' and $id == 159 and $Itemid == 162) { echo It works! Yay me! Gimme a cookie, dammit!; } If you don't get that echo statement, then you should look into your if statement. -- --Matthew Sims --http://killermookie.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Location header does not work?
The latest message I got was 'Redirection limit for this URL exceeded. Unable to load the requested page.This may be caused by cookies that are blocked.'. Bing On Tuesday 03 August 2004 15:41, Bing Du offered up the following tid-bit of information : I've been struggling with this redirect thing for a while but still cannot get it work. I'm desperately needing help, please. What I want to do is redirect http://computing.eng.iastate.edu/mambo/index.php?option=contenttask=view id=159Itemid=162 to https://computing.eng.iastate.edu/mambo/index.php?option=contenttask=vie wid=159Itemid=162. The only difference between the above two URLs is one is http and the other is https. = if ($option == 'content' and $task == 'view' and $id == 159 and $Itemid == 162) { session_write_close(); header(Location: https://computing.eng.iastate.edu/mambo/index.php?option=contenttask=vie wid=159Itemid=162); exit; } = Am I doing anything wrong with the Location header? What's the error? Is it just not forwarding? Headers already sent? -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Location header does not work?
header(Location: . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); -Original Message- From: John Nichel [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 03, 2004 12:59 PM To: Bing Du; [EMAIL PROTECTED] Subject: Re: [PHP] Location header does not work? On Tuesday 03 August 2004 15:41, Bing Du offered up the following tid-bit of information : I've been struggling with this redirect thing for a while but still cannot get it work. I'm desperately needing help, please. What I want to do is redirect http://computing.eng.iastate.edu/mambo/index.php?option=contenttask=view id=159Itemid=162 to https://computing.eng.iastate.edu/mambo/index.php?option=contenttask=vie wid=159Itemid=162. The only difference between the above two URLs is one is http and the other is https. == if ($option == 'content' and $task == 'view' and $id == 159 and $Itemid == 162) { session_write_close(); header(Location: https://computing.eng.iastate.edu/mambo/index.php?option=contenttask=vie wid=159Itemid=162); exit; } == Am I doing anything wrong with the Location header? What's the error? Is it just not forwarding? Headers already sent? -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- 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] Location header does not work?
Oops... forgot to add https Header(Location: https://; . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); -Original Message- From: Ed Lazor [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 03, 2004 1:36 PM To: 'John Nichel'; 'Bing Du'; '[EMAIL PROTECTED]' Subject: RE: [PHP] Location header does not work? header(Location: . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); -Original Message- From: John Nichel [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 03, 2004 12:59 PM To: Bing Du; [EMAIL PROTECTED] Subject: Re: [PHP] Location header does not work? On Tuesday 03 August 2004 15:41, Bing Du offered up the following tid- bit of information : I've been struggling with this redirect thing for a while but still cannot get it work. I'm desperately needing help, please. What I want to do is redirect http://computing.eng.iastate.edu/mambo/index.php?option=contenttask=view id=159Itemid=162 to https://computing.eng.iastate.edu/mambo/index.php?option=contenttask=vie wid=159Itemid=162. The only difference between the above two URLs is one is http and the other is https. == if ($option == 'content' and $task == 'view' and $id == 159 and $Itemid == 162) { session_write_close(); header(Location: https://computing.eng.iastate.edu/mambo/index.php?option=contenttask=vie wid=159Itemid=162); exit; } == Am I doing anything wrong with the Location header? What's the error? Is it just not forwarding? Headers already sent? -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- 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] Location header does not work?
Do you have a valid and functioning SSL certificate on the IP that points to your iastate.edu domain? Have you tried deleting all sites cookies and auto-login passwords that your browser stores, then retrying? Are you using pop-up blocker software? Does this happen on ALL browsers, or just Netscape? Monty From: [EMAIL PROTECTED] (Bing Du) Newsgroups: php.general Date: Tue, 3 Aug 2004 15:34:27 -0500 (CDT) To: [EMAIL PROTECTED] Subject: Re: [PHP] Location header does not work? The latest message I got was 'Redirection limit for this URL exceeded. Unable to load the requested page.This may be caused by cookies that are blocked.'. Bing -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Location header does not work?
The latest message I got was 'Redirection limit for this URL exceeded. Unable to load the requested page.This may be caused by cookies that are blocked.'. Bing Correct me if I'm wrong but I think this is an Apache error. -- --Matthew Sims --http://killermookie.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Location header does not work?
On Tue, 3 Aug 2004 15:34:27 -0500 (CDT), Bing Du [EMAIL PROTECTED] wrote: The latest message I got was 'Redirection limit for this URL exceeded. Unable to load the requested page.This may be caused by cookies that are blocked.'. Your page is redirecting you over and over again. Your problem is that you're not checking for https before you redirect! If the user comes in with the https URL, you're still redirecting them. Try checking the value of $_SERVER['HTTPS']. Bing On Tuesday 03 August 2004 15:41, Bing Du offered up the following tid-bit of information : I've been struggling with this redirect thing for a while but still cannot get it work. I'm desperately needing help, please. What I want to do is redirect http://computing.eng.iastate.edu/mambo/index.php?option=contenttask=view id=159Itemid=162 to https://computing.eng.iastate.edu/mambo/index.php?option=contenttask=vie wid=159Itemid=162. The only difference between the above two URLs is one is http and the other is https. = if ($option == 'content' and $task == 'view' and $id == 159 and $Itemid == 162) { session_write_close(); header(Location: https://computing.eng.iastate.edu/mambo/index.php?option=contenttask=vie wid=159Itemid=162); exit; } = Am I doing anything wrong with the Location header? What's the error? Is it just not forwarding? Headers already sent? -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
FW: [PHP] Location header does not work?
-Original Message- From: Ed Lazor [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 03, 2004 2:33 PM To: 'Bing Du' Subject: RE: [PHP] Location header does not work? I tried the https address and it lagged badly on me as well. It did eventually display, so I looked at the source and found that you're mixing http and https references. That slows things down. There are also references to unavailable images. For example: http://computing.eng.iastate.edu/mambo/components/com_akocomment/images/co mment.png The redirection limit means you're creating a referal loop. If (!IsSet($_SERVER[HTTPS])) Header(Location: https://; . $_SERVER[HTTP_HOST] . $_SERVER[REQUEST_URI]); -Original Message- From: Bing Du [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 03, 2004 2:23 PM To: Ed Lazor Subject: RE: [PHP] Location header does not work? Hi Ed, I just put other things I was doing aside and tried what you suggested. But I did not see much difference. I tried both IE 6 and Netscape 7.1. In IE, it seemed to take forever to load. Finally it returned back with 'The page can not be displayed'. In Netscape, I still got the same message which is 'Redirection limit for this URL exceeded. Unable to load the requested page. This may be caused by cookies that are blocked.' Any other ideas? Thanks so much for taking time to help! Bing Bing, did you try the solution I sent? -Original Message- From: Bing Du [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 03, 2004 1:34 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Location header does not work? The latest message I got was 'Redirection limit for this URL exceeded. Unable to load the requested page.This may be caused by cookies that are blocked.'. Bing On Tuesday 03 August 2004 15:41, Bing Du offered up the following tid- bit of information : I've been struggling with this redirect thing for a while but still cannot get it work. I'm desperately needing help, please. What I want to do is redirect http://computing.eng.iastate.edu/mambo/index.php?option=contenttask=view id=159Itemid=162 to https://computing.eng.iastate.edu/mambo/index.php?option=contenttask=vie wid=159Itemid=162. The only difference between the above two URLs is one is http and the other is https. = if ($option == 'content' and $task == 'view' and $id == 159 and $Itemid == 162) { session_write_close(); header(Location: https://computing.eng.iastate.edu/mambo/index.php?option=contenttask=vie wid=159Itemid=162); exit; } = Am I doing anything wrong with the Location header? What's the error? Is it just not forwarding? Headers already sent? -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- 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] location= Construct Doc
--- Lee Stewart [EMAIL PROTECTED] wrote: It's version 4.0.3 Lee In v4.3.2, it throws a Parse error: parse error, unexpected '=' in /path/to/file/test.php on line 23. Chris Shiflett wrote: --- Lee Stewart [EMAIL PROTECTED] wrote: Here's a *working* section of code... Note the location = browse.php; on line 23 How does that not generate a parse error? I must be missing something. It seems to me that either a dollar sign is missing, or the line is intended to define a constant (although I prefer my constants to be uppercase), in which case the wrong syntax is being used. What version of PHP are you using that does not generate a parse error? Chris = My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php = Mark Weinstock [EMAIL PROTECTED] *** You can't demand something as a right unless you are willing to fight to death to defend everyone else's right to the same thing. *** __ Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard http://antispam.yahoo.com/whatsnewfree -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] location= Construct Doc
On Tue, Nov 11, 2003 at 01:46:33PM -0800, Mark wrote: : : --- Lee Stewart [EMAIL PROTECTED] wrote: : : Here's a *working* section of code... Note the :location = browse.php; : on line 23 : : In v4.3.2, it throws a Parse error: parse error, unexpected '=' in : /path/to/file/test.php on line 23. It'd be helpful to see the rest of the code snippet. But it kinda looks as if it should be: $location = browse.php; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] location= Construct Doc
Hi... I'm looking at an existing application that uses a number of statements like: location = page2.php; I thought I'd seen it somewhere in the PHP doc, but can't find it now.. Can anyone point me to where it's written up? Thanks, Lee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] location= Construct Doc
[snip] I'm looking at an existing application that uses a number of statements like: location = page2.php; I thought I'd seen it somewhere in the PHP doc, but can't find it now.. Can anyone point me to where it's written up? [/snip] http://www.php.net/header -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] location= Construct Doc
I see the Location: of the Header function there, but what I see in the code is just a location = and a page name... No header function... Is it the same thing? Lee Jay Blanchard wrote: [snip] I'm looking at an existing application that uses a number of statements like: location = page2.php; I thought I'd seen it somewhere in the PHP doc, but can't find it now.. Can anyone point me to where it's written up? [/snip] http://www.php.net/header -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] location= Construct Doc
--- Lee Stewart [EMAIL PROTECTED] wrote: I'm looking at an existing application that uses a number of statements like: location = page2.php; I thought I'd seen it somewhere in the PHP doc, but can't find it now.. Can anyone point me to where it's written up? The HTTP header itself is defined in RFC 2616 in section 14.30: -- 14.30 Location The Location response-header field is used to redirect the recipient to a location other than the Request-URI for completion of the request or identification of a new resource. For 201 (Created) responses, the Location is that of the new resource which was created by the request. For 3xx responses, the location SHOULD indicate the server's preferred URI for automatic redirection to the resource. The field value consists of a single absolute URI. Location = Location : absoluteURI An example is: Location: http://www.w3.org/pub/WWW/People.html Note: The Content-Location header field (section 14.14) differs from Location in that the Content-Location identifies the original location of the entity enclosed in the request. It is therefore possible for a response to contain header fields for both Location and Content-Location. Also see section 13.10 for cache requirements of some methods. -- PHP can send HTTP headers using the header() function: http://www.php.net/header Hope that helps. Chris = My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] location= Construct Doc
Lee Stewart mailto:[EMAIL PROTECTED] on Monday, November 10, 2003 12:18 PM said: I see the Location: of the Header function there, but what I see in the code is just a location = and a page name... No header function... Is it the same thing? $location = page.php; is nothing more than a value being assigned to a variable. that variable needs to be used somewhere (or else it'd just be a waste of resources). the most likely situation is what people have suggested so far. that is, the $location variable is being used in a redirect, i.e. header(Location: $location); but in answer to your question, no they are not the same thing. HTH, Chris. -- Don't like reformatting your Outlook replies? Now there's relief! http://home.in.tum.de/~jain/software/outlook-quotefix/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] location= Construct Doc
It's not $location = xxx, just location = page.php; And it seems to work as a redirect... But not part of the header fuction, and not just setting a variable... Lee Chris W. Parker wrote: Lee Stewart mailto:[EMAIL PROTECTED] on Monday, November 10, 2003 12:18 PM said: I see the Location: of the Header function there, but what I see in the code is just a location = and a page name... No header function... Is it the same thing? $location = page.php; is nothing more than a value being assigned to a variable. that variable needs to be used somewhere (or else it'd just be a waste of resources). the most likely situation is what people have suggested so far. that is, the $location variable is being used in a redirect, i.e. header(Location: $location); but in answer to your question, no they are not the same thing. HTH, Chris. -- Don't like reformatting your Outlook replies? Now there's relief! http://home.in.tum.de/~jain/software/outlook-quotefix/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] location= Construct Doc
--- Lee Stewart [EMAIL PROTECTED] wrote: It's not $location = xxx, just location = page.php; So the dollar sign is missing? Can you show us all of the code in question? (Or did I miss it?) And it seems to work as a redirect... But not part of the header fuction, and not just setting a variable... Location is an HTTP header. If that name is being used in any code for some other reason, then the name may be purely coincidental. However, if it is the header you are speaking of, then it is specified using: header('Location: http://example.org/path/to/script.php'); Of particular note is that the URL is an absolute URL, not a relative one. This is in the snippet of the specification that I quoted earlier. Hope that helps. Chris = My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] location= Construct Doc
Lee Stewart mailto:[EMAIL PROTECTED] on Monday, November 10, 2003 12:42 PM said: It's not $location = xxx, just location = page.php; And it seems to work as a redirect... But not part of the header fuction, and not just setting a variable... Hmm.. Never seen that before and the only time I've seen variables without a $ is for a constant, but then again I don't think you can set a constant dynamically, i.e. constant = value; (hence the name constant). If you're not already doing it, posting the code would be good. Chris. -- Don't like reformatting your Outlook replies? Now there's relief! http://home.in.tum.de/~jain/software/outlook-quotefix/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] location= Construct Doc
Here's a *working* section of code... Note the location = browse.php; on line 23 ? $errmsg = ''; if( isset($username) ) { require_once('Connections/mySql.php'); mysql_select_db($database_mySql, $mySql); $rs = mysql_query(select * from employee where initials = ' . strtoupper($username) . ', $mySql) or die(mysql_error($mySql)); if( !(mysql_num_rows($rs)) ) { // not a valid username mysql_free_result($rs); $errmsg = Invalid Userid; unset($username); } else { // valid user, now validate password and status $row = mysql_fetch_assoc($rs); mysql_free_result($rs); if( $row['pw'] == $password ) { // if correct password if( $row['status'] == 'a' || $row['status'] == 'm' ) { // if active user $username = strtoupper($username); session_register(username); $authlevel = $row['status']=='a'?1:2; session_register(authlevel); mysql_query(update employee set lastlogin = . (time()-10800) . where initials = '$username', $mySql) or die(mysql_error($mySql)); session_write_close(); location = browse.php; exit; } else { // not active user $errmsg = Invalid Userid; unset($username); } } else { // incorrect password $errmsg = Invalid Password; unset($password); } } } session_write_close(); ? Chris Shiflett wrote: --- Lee Stewart [EMAIL PROTECTED] wrote: It's not $location = xxx, just location = page.php; So the dollar sign is missing? Can you show us all of the code in question? (Or did I miss it?) And it seems to work as a redirect... But not part of the header fuction, and not just setting a variable... Location is an HTTP header. If that name is being used in any code for some other reason, then the name may be purely coincidental. However, if it is the header you are speaking of, then it is specified using: header('Location: http://example.org/path/to/script.php'); Of particular note is that the URL is an absolute URL, not a relative one. This is in the snippet of the specification that I quoted earlier. Hope that helps. Chris = My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] location= Construct Doc
--- Lee Stewart [EMAIL PROTECTED] wrote: Here's a *working* section of code... Note the location = browse.php; on line 23 How does that not generate a parse error? I must be missing something. It seems to me that either a dollar sign is missing, or the line is intended to define a constant (although I prefer my constants to be uppercase), in which case the wrong syntax is being used. What version of PHP are you using that does not generate a parse error? Chris = My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] location= Construct Doc
It's version 4.0.3 Lee Chris Shiflett wrote: --- Lee Stewart [EMAIL PROTECTED] wrote: Here's a *working* section of code... Note the location = browse.php; on line 23 How does that not generate a parse error? I must be missing something. It seems to me that either a dollar sign is missing, or the line is intended to define a constant (although I prefer my constants to be uppercase), in which case the wrong syntax is being used. What version of PHP are you using that does not generate a parse error? Chris = My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] location= Construct Doc
Lee Stewart wrote: Hi... I'm looking at an existing application that uses a number of statements like: location = page2.php; I thought I'd seen it somewhere in the PHP doc, but can't find it now.. Can anyone point me to where it's written up? This would generate parse error in php, but I guess it is javascript. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Location referer header
Hi, Anybody have any sugestion how to pass this data. My only idea is something like this. redir.php?url=www.somehost.comq=testpos=1 That way i can count click and also send referer with query data. Wednesday, August 13, 2003, 3:27:10 PM, you wrote: DO On Wed, 13 Aug 2003 15:22:42 +0200, you wrote: Is it possible to fake Referer header when redirecting to another URL. I need this because of some redirection script in our directory. Because I want that user ger referer from search query not that redirect script generate. DO No. Referer is set by the client, not the server. -- Best regards, Urosmailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Location referer header
Hello! Is it possible to fake Referer header when redirecting to another URL. I need this because of some redirection script in our directory. Because I want that user ger referer from search query not that redirect script generate. for example: redir.php?url=www.somehost.com and at www.somehost.com get referer this redir.php What I want is to send referer search.php?q=testpos=2 -- Best regards, Uros -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Location referer header
No way. Uros wrote: Hi, Anybody have any sugestion how to pass this data. My only idea is something like this. redir.php?url=www.somehost.comq=testpos=1 That way i can count click and also send referer with query data. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Location header - slow redirect
I'm using the following short script to redirect users to another page on my site (php 4.3.2, Apache 2.0.47). ?php $goLang='en'; header(Location: http://; . $_SERVER['HTTP_HOST'] . / . $goLang . /); exit; ? I'm having a problem where it takes up to 15 seconds for the redirect page to load, but for other redirects on the site programmed in a similar way using php and the location header the page loads straight away. I'm a bit perplexed and would appreciate some suggestions. Thanks Phil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Location header - slow redirect
try putting this after the header: echo HTML/HTML; It forces the redirect to take place immediately (in most cases!). HTH On Wednesday 30 Jul 2003 11:53 am, admin wrote: I'm using the following short script to redirect users to another page on my site (php 4.3.2, Apache 2.0.47). ?php $goLang='en'; header(Location: http://; . $_SERVER['HTTP_HOST'] . / . $goLang . /); exit; ? I'm having a problem where it takes up to 15 seconds for the redirect page to load, but for other redirects on the site programmed in a similar way using php and the location header the page loads straight away. I'm a bit perplexed and would appreciate some suggestions. Thanks Phil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Location header - slow redirect
Excellent, that does the trick. Thank you Phil On Mercoledì, lug 30, 2003, at 13:56 Europe/Rome, Nicholas Robinson wrote: try putting this after the header: echo HTML/HTML; It forces the redirect to take place immediately (in most cases!). HTH On Wednesday 30 Jul 2003 11:53 am, admin wrote: I'm using the following short script to redirect users to another page on my site (php 4.3.2, Apache 2.0.47). ?php $goLang='en'; header(Location: http://; . $_SERVER['HTTP_HOST'] . / . $goLang . /); exit; ? I'm having a problem where it takes up to 15 seconds for the redirect page to load, but for other redirects on the site programmed in a similar way using php and the location header the page loads straight away. I'm a bit perplexed and would appreciate some suggestions. Thanks Phil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] location headers are crisco to cookie headers?
I had some headers that were working on one server (4.0.6), but isn't working on my (nearly) fresh install of 4.2.2. Here's the conundrum: header(Set-Cookie: mid=$mid); header(Location: $location); exit; worked just fine. I moved it over, and now the cookie doesn't take effect. But here's the interesting part: when I interrupt it, then uninterrupt it, it works. Let me illustrate: header(Set-Cookie: mid=$mid); echo stop that location header!; header(Location: $location); exit; then edit the script to remove the echo and the subsequent error, and hit refresh, the cookie holds. This is both in IE and Moz. Does anyone have any clue what might be causing this? I assume it's something with my PHP.ini, but can't (seem to) find any significant differences in the two ini's. One other feasable difference is that the 4.0.6 was on a *nix box with apache and the 4.2.2 is on 2k's IIS, but I doubt that is the problem. Any help would be appreciated. Thanks, Scott
Re: [PHP] location headers are crisco to cookie headers?
On Tue, 13 Aug 2002 22:14:28 -0500, you wrote: I had some headers that were working on one server (4.0.6), but isn't working on my (nearly) fresh install of 4.2.2. Here's the conundrum: header(Set-Cookie: mid=$mid); header(Location: $location); exit; worked just fine. I moved it over, and now the cookie doesn't take effect. [...] One other feasable difference is that the 4.0.6 was on a *nix box with apache and the 4.2.2 is on 2k's IIS, but I doubt that is the problem. Actually, that *IS* the problem. This is a bug in the way that IIS handles CGI-generated headers, and is detailed in knowledgebase article Q176113. It seems that if a Location: header is sent from a CGI program, IIS will ignore any other headers that come with it. So you cannot by default set a cookie and redirect on the same page. The workaround is to rename the script so that it begins with nph-. (I'm serious). This stands for non-parsed headers mode and it tells IIS to leave the headers alone. Then you have to generate the headers manually rather than using the setcookie() function built into IIS. I had this exact same problem on a script that I was working on. In my script I was attempting to set a cookie and then redirect the browser upon successful authentication. When I discovered that this does not work with IIS + PHP (cgi mode) I moved the login and logout functionality to seperate files called nph-authenticate.php and nph-logout.php, and I generate the headers manually, like so: header(HTTP/1.0 302 Redirect); header(Location: $location); header(Set-Cookie: mid=$mid); HTH -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] location bar
At 06:14 PM 8/15/2001, Wolfgang Schneider wrote: oops - i forgot - I use functions similar tp the ones used on php.net. when i call the function i pass $title to it define $title and it should work. :-) ~kurth On Tue, 14 Aug 2001 11:39:55 -0400, Kurth Bemis wrote: just stick this in a function as I did and you'll be sailing.its easy to update, and Extremely flexible. look at my code.. (rest snipped) Hi Kurth, and others I adjusted your code for the purpose of my site (replacing he values in the array and the homepage address, etc) ... but when I plugged it into a page for testing; i got the following results: Location : Home / Warning: Undefined variable: link in visitheadnav-1.inc on line 70 Besucher / Warning: Undefined index: support.php3 in visitheadnav-1.inc on line 68 Warning: Undefined variable: title in visitheadnav-1.inc on line 73 The code is part of an include file named visitheadnav-1.inc ... and apparently there is some link there in the code which is an undefined variable ... but I have no idea what this error message is about :-(The results Home/ and Besucher/ are actually correct ... it's just the undefined link problem I need to get figured out ... Here's the code I inserted into my visitheadnav-1.inc: p class=fn8Location : a href=http://www.bibelcenter.de.;Home/a / ?php $patharray = explode (/,$SCRIPT_NAME); $scriptname = basename($SCRIPT_NAME); for ($dirsi = 1; $dirsi count($patharray); $dirsi++) { $dirs = array( 'visitor' = 'Besucher', 'info' = 'Information', 'bibel' = 'Bibelarbeit', 'bibliothek' = 'Bibliothek', 'gebet' = 'Gebetsraum', 'links' = 'Internet Links', 'kids' = 'Kinderecke', 'shop' = 'Bookshop' ); $linkdes = $dirs[$patharray[$dirsi]]; $link = $link . /$patharray[$dirsi]; if ($patharray[$dirsi] == $scriptname){ $linkdes = $title; $slash = ; $linkhtml = a href=\$link\$linkdes/a$slash; if ($patharray[$dirsi] == index.php){ $link = ; $linkdes = ; $slash = ; $linkhtml = ; } }else{ $slash = / ; $linkhtml = a href=\$link\$linkdes/a$slash; } echo $linkhtml; } ?/p Any ideas, what may be wrong and causing these error messages? God bless you with His grace and peace Wolfgang Looking for Biblical information? COME AND SEE! -- ONLINE Courses: http://classes.bibelcenter.de ... NEW! -- BibelCenter: http://www.bibelcenter.de -- Bookstore: http://www.worthy.net/BibelCenter/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] location bar
On Tue, 14 Aug 2001 11:39:55 -0400, Kurth Bemis wrote: just stick this in a function as I did and you'll be sailing.its easy to update, and Extremely flexible. look at my code.. (rest snipped) Hi Kurth, and others I adjusted your code for the purpose of my site (replacing he values in the array and the homepage address, etc) ... but when I plugged it into a page for testing; i got the following results: Location : Home / Warning: Undefined variable: link in visitheadnav-1.inc on line 70 Besucher / Warning: Undefined index: support.php3 in visitheadnav-1.inc on line 68 Warning: Undefined variable: title in visitheadnav-1.inc on line 73 The code is part of an include file named visitheadnav-1.inc ... and apparently there is some link there in the code which is an undefined variable ... but I have no idea what this error message is about :-(The results Home/ and Besucher/ are actually correct ... it's just the undefined link problem I need to get figured out ... Here's the code I inserted into my visitheadnav-1.inc: p class=fn8Location : a href=http://www.bibelcenter.de.;Home/a / ?php $patharray = explode (/,$SCRIPT_NAME); $scriptname = basename($SCRIPT_NAME); for ($dirsi = 1; $dirsi count($patharray); $dirsi++) { $dirs = array( 'visitor' = 'Besucher', 'info' = 'Information', 'bibel' = 'Bibelarbeit', 'bibliothek' = 'Bibliothek', 'gebet' = 'Gebetsraum', 'links' = 'Internet Links', 'kids' = 'Kinderecke', 'shop' = 'Bookshop' ); $linkdes = $dirs[$patharray[$dirsi]]; $link = $link . /$patharray[$dirsi]; if ($patharray[$dirsi] == $scriptname){ $linkdes = $title; $slash = ; $linkhtml = a href=\$link\$linkdes/a$slash; if ($patharray[$dirsi] == index.php){ $link = ; $linkdes = ; $slash = ; $linkhtml = ; } }else{ $slash = / ; $linkhtml = a href=\$link\$linkdes/a$slash; } echo $linkhtml; } ?/p Any ideas, what may be wrong and causing these error messages? God bless you with His grace and peace Wolfgang Looking for Biblical information? COME AND SEE! -- ONLINE Courses: http://classes.bibelcenter.de ... NEW! -- BibelCenter: http://www.bibelcenter.de -- Bookstore: http://www.worthy.net/BibelCenter/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] location bar
Hi everyone, I am somewhat new at the use of php and would appreciate if someone could help me with a question re location bar How can a location bar such as the sample below be generated in php to be displayed in web pages ... Location : home:/category:sub_1:/page title Is there a specific setup needed in terms of the directory structure on the server? Or will this only function with database type website? Thanks in advance for any input and helpful ideas ... God bless you with His grace and peace Wolfgang Looking for Biblical information? COME AND SEE! -- ONLINE Courses: http://classes.bibelcenter.de ... NEW! -- BibelCenter: http://www.bibelcenter.de -- Bookstore: http://www.worthy.net/BibelCenter/
RE: [PHP] location bar
The navigation system you are refering to is called breadcrumb navigation. You can find implementations of this all over the place. Try hotscripts.com or google.com. Kevin -Original Message- From: Wolfgang Schneider [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 14, 2001 12:35 AM To: php-general Subject: [PHP] location bar Hi everyone, I am somewhat new at the use of php and would appreciate if someone could help me with a question re location bar How can a location bar such as the sample below be generated in php to be displayed in web pages ... Location : home:/category:sub_1:/page title Is there a specific setup needed in terms of the directory structure on the server? Or will this only function with database type website? Thanks in advance for any input and helpful ideas ... God bless you with His grace and peace Wolfgang Looking for Biblical information? COME AND SEE! -- ONLINE Courses: http://classes.bibelcenter.de ... NEW! -- BibelCenter: http://www.bibelcenter.de -- Bookstore: http://www.worthy.net/BibelCenter/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] location bar
At 11:02 AM 8/14/2001, Kevin L wrote: I had a similar problem.jason murray gave me some ideas ;-) just stick this in a function as I did and you'll be sailing.its easy to update, and Extremely flexible. look at my code.. font face=Verdana, Arial, Helvetica, sans-serif size=-2Location : a href=http://www.usaexpress.net;Home/a / ?php $patharray = explode (/,$SCRIPT_NAME); $scriptname = basename($SCRIPT_NAME); for ($dirsi = 1; $dirsi count($patharray); $dirsi++){ $dirs = array( 'company' = 'Company', 'services' = 'Services', 'support' = 'Support', 'mac' = 'Mac', 'winnt' = 'Windows NT', 'win9x' = 'Windows 9X', 'unix' = 'Linux And Unix', 'customers' = 'Customers', 'noc' = 'NOC', 'help' = 'USAexpress.net Help' ); $linkdes = $dirs[$patharray[$dirsi]]; $link = $link . /$patharray[$dirsi]; if ($patharray[$dirsi] == $scriptname){ $linkdes = $title; $slash = ; $linkhtml = a href=\$link\$linkdes/a$slash; if ($patharray[$dirsi] == index.php){ $link = ; $linkdes = ; $slash = ; $linkhtml = ; } }else{ $slash = / ; $linkhtml = a href=\$link\$linkdes/a$slash; } echo $linkhtml; } ?/font you can see it in action at www.usaexpress.net. look at the location below our logo. ~kurth The navigation system you are refering to is called breadcrumb navigation. You can find implementations of this all over the place. Try hotscripts.com or google.com. Kevin -Original Message- From: Wolfgang Schneider [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 14, 2001 12:35 AM To: php-general Subject: [PHP] location bar Hi everyone, I am somewhat new at the use of php and would appreciate if someone could help me with a question re location bar How can a location bar such as the sample below be generated in php to be displayed in web pages ... Location : home:/category:sub_1:/page title Is there a specific setup needed in terms of the directory structure on the server? Or will this only function with database type website? Thanks in advance for any input and helpful ideas ... God bless you with His grace and peace Wolfgang Looking for Biblical information? COME AND SEE! -- ONLINE Courses: http://classes.bibelcenter.de ... NEW! -- BibelCenter: http://www.bibelcenter.de -- Bookstore: http://www.worthy.net/BibelCenter/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] location bar
if you're asking on how to show where you are, then this is what you could do: Create an array of page names: ie: $page_name = Array( '/' = 'Home', '/page1' = 'Page One' ); ... and so on Then just do echo $page_name[strtolower($PHP_SELF)]; This is only appropriate for small static sites, and is not really a solution. try to extend this idea, with maybe use of databases and go ahead. Also, look for such scripts. Tons of code was written already and some module like this, I think, you can easily find. Cheers, Maxim Maletsky www.PHPBeginner.com -Original Message- From: Wolfgang Schneider [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 14, 2001 3:35 PM To: php-general Subject: [PHP] location bar Hi everyone, I am somewhat new at the use of php and would appreciate if someone could help me with a question re location bar How can a location bar such as the sample below be generated in php to be displayed in web pages ... Location : home:/category:sub_1:/page title Is there a specific setup needed in terms of the directory structure on the server? Or will this only function with database type website? Thanks in advance for any input and helpful ideas ... God bless you with His grace and peace Wolfgang Looking for Biblical information? COME AND SEE! -- ONLINE Courses: http://classes.bibelcenter.de ... NEW! -- BibelCenter: http://www.bibelcenter.de -- Bookstore: http://www.worthy.net/BibelCenter/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Location Header
ok. I have this problem of mine which i dont know how to solve. therefor i use this great mailing list. Lets say i have a URL that looks something like this. http://adam:9000//usr/local/test/test.html and i want to change this with a PHP script to http://adam.artwork.com:9000//user/local/test/test.html Anyone got any tips for me on how to do this? Please help me with this. //Johan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Location
"Brandon Feldhahn" [EMAIL PROTECTED] wrote: Im making a website and i want the viewer to know were he of she is, what do i need to do to make a location bar (home serverices ect...) with the $PHP_SELF command, i wasent able to figure it out so i am asking assistance from another person. A simple solution for a site with a small number of pages would be to create an array like the following: $location['/index.php'] = "Home"; $location['/services.php'] = "Services"; $location['/products.php'] = "Products"; Then use $SCRIPT_URL or a similar environment variable to display the proper label in the "location bar". ?php echo $location[$SCRIPT_URL]; ? If you have a large number of pages (especially dynamically generated "virtual" pages) or sublevels to your site you'll probably want to use a more advanced solution. -- Steve Werby COO 24-7 Computer Services, LLC Tel: 804.817.2470 http://www.247computing.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Location
You need to have an array or db with file and description in ca you use array : $location = Array( '/index.php' = 'HOME', '/prod_info.php' = 'Product Information', ..etc ); and then if(isset($location[$PHP_SELF])) echo $location[$PHP_SELF]; and so on ... note: this is just a quick and dirty idea on how to do that, with a little bit of logic you can write a very sweet function with does what you need. Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) [EMAIL PROTECTED] www.phpbeginner.com -Original Message- From: Brandon Feldhahn [mailto:[EMAIL PROTECTED]] Sent: Friday, February 23, 2001 10:27 AM To: [EMAIL PROTECTED] Subject: [PHP] Location Im making a website and i want the viewer to know were he of she is, what do i need to do to make a location bar (home serverices ect...) with the $PHP_SELF command, i wasent able to figure it out so i am asking assistance from another person. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Location
Im making a website and i want the viewer to know were he of she is, what do i need to do to make a location bar (home serverices ect...) with the $PHP_SELF command, i wasent able to figure it out so i am asking assistance from another person. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] location
make a function which validates users. Then where ever you want to restrict access just call that function before other things .. and it will do the trick where ever you need .. no if statements needed. HTH Jaskirat At 11:47 PM 2/16/01 -0800, Brandon Feldhahn wrote: how would i make somthing in a IF statement that would take somone to the members page when they get the login correct -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] location
you could possibly store the name/password as cookies, so that they're available to the PHP script without the user having to type them in more than once per session (or even longer if you set the expire date properly) i know that cookies are horribly insecure, but for purposes of a very simple validation routine, cookies are sufficient) if ( !validate_user($ck_name,$ck_pw) ) { print "you are not logged in, please go log in"; } else { print "you are logged in"; } function validate_user($ck_name, $ck_pw) { //make whatever calls you need to the database //to see if this name/pw combination are valid. //return 1 if good, return 0 if bad } -Original Message- From: jaskirat [mailto:[EMAIL PROTECTED]] Sent: Saturday, February 17, 2001 00:30 To: Brandon Feldhahn; [EMAIL PROTECTED] Subject: Re: [PHP] location make a function which validates users. Then where ever you want to restrict access just call that function before other things .. and it will do the trick where ever you need .. no if statements needed. HTH Jaskirat At 11:47 PM 2/16/01 -0800, Brandon Feldhahn wrote: how would i make somthing in a IF statement that would take somone to the members page when they get the login correct -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] location
how would i make somthing in a IF statement that would take somone to the members page when they get the login correct -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]