FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » & - form and session problem!
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
& - form and session problem! [message #173521] Sun, 17 April 2011 20:39 Go to next message
lamb is currently offline  lamb
Messages: 5
Registered: April 2011
Karma: 0
Junior Member
Hello.

I'm running an ecommerce site using php.

I have problem with customers that doesn't accept cookies.

In these cases PHP uses the GET params to transfer session in (osCid im
my case) from a page to another.

But I have problems with forms!

When I have a form the link:

http://mysite.com/index.php?language=fr&osCid=xxxxx

is automatically transformed in

http://mysite.com/index.php?language=fr&osCid=xxxxx

where & becomes &

So in the arrival page $_GET[osCid] is empty!

There is a way to avoid this substitution?

Or there is a way, using mod_rewrite, to transform
http://mysite.com/index.php?language=fr&osCid=xxxxx in
http://mysite.com/index.php?language=fr&osCid=xxxxx.


Thanks!
Re: & - form and session problem! [message #173522 is a reply to message #173521] Sun, 17 April 2011 21:48 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 4/17/2011 4:39 PM, lamb wrote:
> Hello.
>
> I'm running an ecommerce site using php.
>
> I have problem with customers that doesn't accept cookies.
>
> In these cases PHP uses the GET params to transfer session in (osCid im
> my case) from a page to another.
>
> But I have problems with forms!
>
> When I have a form the link:
>
> http://mysite.com/index.php?language=fr&osCid=xxxxx
>
> is automatically transformed in
>
> http://mysite.com/index.php?language=fr&osCid=xxxxx
>
> where & becomes &
>
> So in the arrival page $_GET[osCid] is empty!
>
> There is a way to avoid this substitution?
>

Why do you have

arg_separator.output=&

in your php.ini file?

> Or there is a way, using mod_rewrite, to transform
> http://mysite.com/index.php?language=fr&osCid=xxxxx in
> http://mysite.com/index.php?language=fr&osCid=xxxxx.
>
>
> Thanks!

You do NOT want to do this. What happens if you get a parameter like:
http://www.example.com/albums?artist=sonny+&+cher

You would NOT want to convert that one.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: & - form and session problem! [message #173523 is a reply to message #173521] Mon, 18 April 2011 01:54 Go to previous messageGo to next message
Mr. B-o-B is currently offline  Mr. B-o-B
Messages: 42
Registered: April 2011
Karma: 0
Member
cried from the depths of the abyss:

> Hello.
>
> I'm running an ecommerce site using php.
>
> I have problem with customers that doesn't accept cookies.
>
> In these cases PHP uses the GET params to transfer session in (osCid im
> my case) from a page to another.
>
> But I have problems with forms!
>
> When I have a form the link:
>
> http://mysite.com/index.php?language=fr&osCid=xxxxx
>
> is automatically transformed in
>
> http://mysite.com/index.php?language=fr&osCid=xxxxx
>
> where & becomes &
>
> So in the arrival page $_GET[osCid] is empty!
>
> There is a way to avoid this substitution?

Take a look at urlencode

http://php.net/manual/en/function.urlencode.php

and urldecode on the other side.

Mr. B-o-B
Re: & - form and session problem! [message #173524 is a reply to message #173522] Mon, 18 April 2011 06:10 Go to previous messageGo to next message
lamb is currently offline  lamb
Messages: 5
Registered: April 2011
Karma: 0
Junior Member
> Why do you have
>
> arg_separator.output=&
>
> in your php.ini file?

no... I have arg_separator.output=&

but in forms I get autmatically & in side of &

>
> You do NOT want to do this. What happens if you get a parameter like:
> http://www.example.com/albums?artist=sonny+&+cher
>
> You would NOT want to convert that one.

I need thi! many external links to my site uses & in uri
Re: & - form and session problem! [message #173525 is a reply to message #173523] Mon, 18 April 2011 06:11 Go to previous messageGo to next message
lamb is currently offline  lamb
Messages: 5
Registered: April 2011
Karma: 0
Junior Member
Il 18/04/2011 03:54, Mr. B-o-B ha scritto:
> cried from the depths of the abyss:
>
>> Hello.
>>
>> I'm running an ecommerce site using php.
>>
>> I have problem with customers that doesn't accept cookies.
>>
>> In these cases PHP uses the GET params to transfer session in (osCid im
>> my case) from a page to another.
>>
>> But I have problems with forms!
>>
>> When I have a form the link:
>>
>> http://mysite.com/index.php?language=fr&osCid=xxxxx
>>
>> is automatically transformed in
>>
>> http://mysite.com/index.php?language=fr&osCid=xxxxx
>>
>> where& becomes&
>>
>> So in the arrival page $_GET[osCid] is empty!
>>
>> There is a way to avoid this substitution?
>
> Take a look at urlencode
>
> http://php.net/manual/en/function.urlencode.php
>
> and urldecode on the other side.
>
> Mr. B-o-B
>
>

I tried... but didn't work!
Re: & - form and session problem! [message #173526 is a reply to message #173521] Mon, 18 April 2011 07:46 Go to previous messageGo to next message
alvaro.NOSPAMTHANX is currently offline  alvaro.NOSPAMTHANX
Messages: 277
Registered: September 2010
Karma: 0
Senior Member
El 17/04/2011 22:39, lamb escribió/wrote:
> I'm running an ecommerce site using php.
>
> I have problem with customers that doesn't accept cookies.
>
> In these cases PHP uses the GET params to transfer session in (osCid im
> my case) from a page to another.
>
> But I have problems with forms!
>
> When I have a form the link:
>
> http://mysite.com/index.php?language=fr&osCid=xxxxx
>
> is automatically transformed in
>
> http://mysite.com/index.php?language=fr&osCid=xxxxx
>
> where & becomes &

You give little detail, but it seems that your software is encoding HTML
entities twice. But that looks like a too serious bug to remain
unnoticed until now.

> So in the arrival page $_GET[osCid] is empty!
>
> There is a way to avoid this substitution?

As I said, you need to actively encode HTML entities twice in order to
get this:

$url = 'http://mysite.com/index.php?language=fr&osCid=xxxxx';
$url = htmlspecialchars($url);
echo '<a href="' . htmlspecialchars($url) . '">Home</a>';

Check the code.


> Or there is a way, using mod_rewrite, to transform
> http://mysite.com/index.php?language=fr&amp;osCid=xxxxx in
> http://mysite.com/index.php?language=fr&osCid=xxxxx.

I would not play with that, it can only lead to even more obscure bugs.


--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--
Re: &amp; - form and session problem! [message #173529 is a reply to message #173523] Mon, 18 April 2011 09:31 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 4/17/2011 9:54 PM, Mr. B-o-B wrote:
> cried from the depths of the abyss:
>
>> Hello.
>>
>> I'm running an ecommerce site using php.
>>
>> I have problem with customers that doesn't accept cookies.
>>
>> In these cases PHP uses the GET params to transfer session in (osCid im
>> my case) from a page to another.
>>
>> But I have problems with forms!
>>
>> When I have a form the link:
>>
>> http://mysite.com/index.php?language=fr&osCid=xxxxx
>>
>> is automatically transformed in
>>
>> http://mysite.com/index.php?language=fr&amp;osCid=xxxxx
>>
>> where& becomes&amp;
>>
>> So in the arrival page $_GET[osCid] is empty!
>>
>> There is a way to avoid this substitution?
>
> Take a look at urlencode
>
> http://php.net/manual/en/function.urlencode.php
>
> and urldecode on the other side.
>
> Mr. B-o-B
>
>

Which has absolutely nothing to do with his problem and will not solve it...

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: &amp; - form and session problem! [message #173530 is a reply to message #173524] Mon, 18 April 2011 09:42 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 4/18/2011 2:10 AM, lamb wrote:
>> Why do you have
>>
>> arg_separator.output=&amp;
>>
>> in your php.ini file?
>
> no... I have arg_separator.output=&
>

Are you sure? Are you looking at the correct php.ini file?


> but in forms I get autmatically &amp; in side of &
>

You should have &amp; in the forums; when clicked on, the browser
automatically converts it to a single & for the URL. But to get &amp;
in the URL, you have to have &amp;amp; in your html. You can get it by
having the wrong arg_separator.output in your php.ini file, or, as
Álvaro said, you are encoding the data twice. That shouldn't be the
case for your session id, but without the code it's impossible to tell.

>>
>> You do NOT want to do this. What happens if you get a parameter like:
>> http://www.example.com/albums?artist=sonny+&amp;+cher
>>
>> You would NOT want to convert that one.
>
> I need thi! many external links to my site uses & in uri

As they should. However, remember, an external link which includes the
session id will be incorrect after the session times out (unless someone
else gets the same session id, which would be quite rare).

The big question is - why even worry about people who don't use cookies?
The vast majority of sites nowadays require cookies for many reasons,
and people who have them disabled won't be able to do much on the internet.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: &amp; - form and session problem! [message #173532 is a reply to message #173526] Mon, 18 April 2011 12:09 Go to previous messageGo to next message
lamb is currently offline  lamb
Messages: 5
Registered: April 2011
Karma: 0
Junior Member
>
>> Or there is a way, using mod_rewrite, to transform
>> http://mysite.com/index.php?language=fr&amp;osCid=xxxxx in
>> http://mysite.com/index.php?language=fr&osCid=xxxxx.
>
> I would not play with that, it can only lead to even more obscure bugs.
>
>

I tried but my host did'nt resolve a so configured url!
[SOLVED] Re: &amp; - form and session problem! [message #173533 is a reply to message #173521] Mon, 18 April 2011 12:29 Go to previous message
lamb is currently offline  lamb
Messages: 5
Registered: April 2011
Karma: 0
Junior Member
Il 17/04/2011 22:39, lamb ha scritto:
> Hello.
>
> I'm running an ecommerce site using php.
>
> I have problem with customers that doesn't accept cookies.
>
> In these cases PHP uses the GET params to transfer session in (osCid im
> my case) from a page to another.
>
> But I have problems with forms!
>
> When I have a form the link:
>
> http://mysite.com/index.php?language=fr&osCid=xxxxx
>
> is automatically transformed in
>
> http://mysite.com/index.php?language=fr&amp;osCid=xxxxx
>
> where & becomes &amp;
>
> So in the arrival page $_GET[osCid] is empty!
>
> There is a way to avoid this substitution?
>
> Or there is a way, using mod_rewrite, to transform
> http://mysite.com/index.php?language=fr&amp;osCid=xxxxx in
> http://mysite.com/index.php?language=fr&osCid=xxxxx.
>

solved!! my arg_separator.input was = '&'

now my hoseter has stated arg_separator.input = '&amp;' so all link
versions are recognized!

Thanks everybody!
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: mysqli - can I bind wildcard params, and just get a result back to make a hash?
Next Topic: Parameter passing question
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Sep 27 11:30:28 GMT 2024

Total time taken to generate the page: 0.09344 seconds