Re: [PHP] Finding the? in $REQUEST_URI?page=blah
On Friday 16 February 2001 23:57, James, Yz wrote: > OK, I've an error handling page. Basically, I want to split (that > might even be one of the functions I'll have to use) this sort of url: > > error.php?/pages/login.php?username=name That will only cause trouble. URLs with parameters have the following format: scriptname?parameter1=value1[¶meter2=val2[&...]] Two '?' in an URL are strange at best. So change that to $ErrorURL = 'error.php?page=' . rawurlencode ('/pages/login.php&username=name'); > /pages/login.php $HTTP_GET_VARS['page'] -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) Drink wet cement. Get stoned. -- 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] Finding the? in $REQUEST_URI?page=blah
with slight modifications, yes... that will work. 1) PHP doesnt support built-in regexp's (which is a constant sore in the side of any perl programmer) so you'll have to ditch the /:/ for ':' 2) you have to declare lists as list(), unlike the assumed behaviour in perl when it sees () = ... this is how you'd do it in PHP $str = 'C:programs:this:that.exe'; list($one, $two) = split(':', $str); print $one ."\n"; print $two ."\n"; not very different, but different enough to be annoying :) > -Original Message- > From: John Monfort [mailto:[EMAIL PROTECTED]] > Sent: Friday, February 16, 2001 16:57 > To: ..s.c.o.t.t.. [gts] > Cc: php-general > Subject: Re: [PHP] Finding the? in $REQUEST_URI?page=blah > > > > >Is the PHP split command the same as that in Perl? > >ex. > > ($var_1, $var_2) = split(/:/,$string, 2); > >will something like that work? > > > > > > On Fri, 16 Feb 2001, ..s.c.o.t.t.. [gts] wrote: > > > i'd use split, to split the value up into an array: > > > > if this is your url > > $url = "/pages/error.php?/pages/login.php?user=scott"; > > > > and use this code: > > $thing = split('\?', $url); > > print $thing[0] ." \n "; > > print $thing[1] ." \n "; > > print $thing[2] ." \n "; > > > > output will be: > > /pages/error.php > > /pages/login.php > > user=scottx > > > > > > > > - Original Message - > > From: "James, Yz" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Friday, February 16, 2001 5:57 PM > > Subject: [PHP] Finding the? in $REQUEST_URI?page=blah > > > > > > > I really wouldn't ask this if I wasn't completely exausted, but the last > > > thing I feel like doing just now is reading up on this when someone can > > > probably answer it in a matter of seconds. > > > > > > OK, I've an error handling page. Basically, I want to split (that might > > > even be one of the functions I'll have to use) this sort of url: > > > > > > error.php?/pages/login.php?username=name > > > > > > into: > > > > > > /pages/login.php > > > > > > I'm using : > > > > > > header("location: error.php?page=$REQUEST_URI"); > > > > > > When echoing the request_uri back on the error page, it omits the error.php? > > > bit, so I get: > > > > > > login.php?username=name > > > > > > The reason I want to do this is so that I can use a re-login form that will > > > submit to the page the user has badly logged into, so if they logged in to > > > main.php, the request_uri would be something like: > > > > > > /pages/main.php?username=name > > > > > > Which I'd want to rebuild on the error page, into a form, like: > > > > > > > > page may include */ ?>"> > > > Username: > > > etc > > > > > > Can anyone help? > > > > > > Thankees :) > > > > > > James. > > > > > > > > > > > > > > > -- > > > 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 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] Finding the? in $REQUEST_URI?page=blah
Is the PHP split command the same as that in Perl? ex. ($var_1, $var_2) = split(/:/,$string, 2); will something like that work? On Fri, 16 Feb 2001, ..s.c.o.t.t.. [gts] wrote: > i'd use split, to split the value up into an array: > > if this is your url > $url = "/pages/error.php?/pages/login.php?user=scott"; > > and use this code: > $thing = split('\?', $url); > print $thing[0] ." \n "; > print $thing[1] ." \n "; > print $thing[2] ." \n "; > > output will be: > /pages/error.php > /pages/login.php > user=scottx > > > > - Original Message - > From: "James, Yz" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Friday, February 16, 2001 5:57 PM > Subject: [PHP] Finding the? in $REQUEST_URI?page=blah > > > > I really wouldn't ask this if I wasn't completely exausted, but the last > > thing I feel like doing just now is reading up on this when someone can > > probably answer it in a matter of seconds. > > > > OK, I've an error handling page. Basically, I want to split (that might > > even be one of the functions I'll have to use) this sort of url: > > > > error.php?/pages/login.php?username=name > > > > into: > > > > /pages/login.php > > > > I'm using : > > > > header("location: error.php?page=$REQUEST_URI"); > > > > When echoing the request_uri back on the error page, it omits the error.php? > > bit, so I get: > > > > login.php?username=name > > > > The reason I want to do this is so that I can use a re-login form that will > > submit to the page the user has badly logged into, so if they logged in to > > main.php, the request_uri would be something like: > > > > /pages/main.php?username=name > > > > Which I'd want to rebuild on the error page, into a form, like: > > > > > page may include */ ?>"> > > Username: > > etc > > > > Can anyone help? > > > > Thankees :) > > > > James. > > > > > > > > > > -- > > 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]
Re: [PHP] Finding the? in $REQUEST_URI?page=blah
i'd use split, to split the value up into an array: if this is your url $url = "/pages/error.php?/pages/login.php?user=scott"; and use this code: $thing = split('\?', $url); print $thing[0] ." \n "; print $thing[1] ." \n "; print $thing[2] ." \n "; output will be: /pages/error.php /pages/login.php user=scottx - Original Message - From: "James, Yz" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, February 16, 2001 5:57 PM Subject: [PHP] Finding the? in $REQUEST_URI?page=blah > I really wouldn't ask this if I wasn't completely exausted, but the last > thing I feel like doing just now is reading up on this when someone can > probably answer it in a matter of seconds. > > OK, I've an error handling page. Basically, I want to split (that might > even be one of the functions I'll have to use) this sort of url: > > error.php?/pages/login.php?username=name > > into: > > /pages/login.php > > I'm using : > > header("location: error.php?page=$REQUEST_URI"); > > When echoing the request_uri back on the error page, it omits the error.php? > bit, so I get: > > login.php?username=name > > The reason I want to do this is so that I can use a re-login form that will > submit to the page the user has badly logged into, so if they logged in to > main.php, the request_uri would be something like: > > /pages/main.php?username=name > > Which I'd want to rebuild on the error page, into a form, like: > > page may include */ ?>"> > Username: > etc > > Can anyone help? > > Thankees :) > > James. > > > > > -- > 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] Finding the? in $REQUEST_URI?page=blah
An exceptionally easy way to do this would be to pass both $PHP_SELF and $REQUEST_URI. Alternatively, you can use explode(): "> Username: etc -Original Message- From: James, Yz [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 2:57 PM To: [EMAIL PROTECTED] Subject: [PHP] Finding the? in $REQUEST_URI?page=blah I really wouldn't ask this if I wasn't completely exausted, but the last thing I feel like doing just now is reading up on this when someone can probably answer it in a matter of seconds. OK, I've an error handling page. Basically, I want to split (that might even be one of the functions I'll have to use) this sort of url: error.php?/pages/login.php?username=name into: /pages/login.php I'm using : header("location: error.php?page=$REQUEST_URI"); When echoing the request_uri back on the error page, it omits the error.php? bit, so I get: login.php?username=name The reason I want to do this is so that I can use a re-login form that will submit to the page the user has badly logged into, so if they logged in to main.php, the request_uri would be something like: /pages/main.php?username=name Which I'd want to rebuild on the error page, into a form, like: "> Username: etc Can anyone help? Thankees :) James. -- 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] Finding the? in $REQUEST_URI?page=blah
I really wouldn't ask this if I wasn't completely exausted, but the last thing I feel like doing just now is reading up on this when someone can probably answer it in a matter of seconds. OK, I've an error handling page. Basically, I want to split (that might even be one of the functions I'll have to use) this sort of url: error.php?/pages/login.php?username=name into: /pages/login.php I'm using : header("location: error.php?page=$REQUEST_URI"); When echoing the request_uri back on the error page, it omits the error.php? bit, so I get: login.php?username=name The reason I want to do this is so that I can use a re-login form that will submit to the page the user has badly logged into, so if they logged in to main.php, the request_uri would be something like: /pages/main.php?username=name Which I'd want to rebuild on the error page, into a form, like: "> Username: etc Can anyone help? Thankees :) James. -- 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]