into it "/>

$_SESSION array goes blind when inserting into it

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hello to all people of good will,

On one page I insert into $_SESSION at 'mykey' a value:

<div onclick="parent.load_pic()" id="foto_0"><img alt="image" src=""/
Quoted text here. Click to load it

It comes from a form and is assigned as usual:

And on another page when I start the session and try to read the
$_SESSION array the $_SESSION['mykey'] is empty.

All the other values set elsewhere are right there in $_SESSION array.

I tried addslashes(), htmlentities() but nothing works. To my surprise
it doesn't work in FF, in IE it's ok.

I also discovered that SRC="" attribute is the problem, when I skip it
or misspell it, everything works fine.

Any idea? Thanks in advance,

Re: $_SESSION array goes blind when inserting into it

Quoted text here. Click to load it

it works in both, session stuff is independent of browser!!
however since its html you need to view source to see. try this:

$_SESSION['mykey']='<div onclick="parent.load_pic()" id="foto_0"><img
alt="image" src=""></div>';


then view the source. It does work in firefox, to see that highligh
right click and view selection source. (cant just use view source
because the view source window doesnt send the cookie header)

I can confident say that it works, IE cannot be different to FF
because the data is sent to the browser as html, the only thing that
is exchanged between the server and the browser is a 32 char long
string of letters and numbers.

Re: $_SESSION array goes blind when inserting into it


Yeah, you're right. It works as you presented.
I put the problem too simple. In fact, in my site it is as follows:

page 1

Iframe generated by JS with wysiwyg editor. Iframe dynamically
replaces a textarea. It allows inserting images (with all necessary
attributes of course). When submitted, JS recontsructs the body node
making it xhtml compliant and places the contents of the iframe into
the textarea. The form is sent to page 2

page 2

Again the same Iframe is generated this time however not editable.
Images have onClick event allowing uploading images to server. In FF
when the iframe has designMode=on they cannot be clicked. Anyway, the
contents of the textarea from page 1 is inserted into the iframe and
displayed. At the same time it is inserted into $_SESSION array. When
the user goes back to editing mode, THE key in $_SESSION is empty.

I agree that it should have nothing to do with browsers since it is a
matter of server serving parsed pages. But, believe me, it is like

When on page 1 I don't insert src attribute everything is fine. Maybe
the JS function regenerating the body node messes things up. I'm
trying to implement WYZZ wysiwwyg editor. If you feel like looking
into the code:

// WYZZ Copyright (c) 2007 The Mouse Whisperer
// Contains code Copyright (c) 2006
// This copyright notice MUST stay intact for use.
// An open source WYSIWYG editor for use in web based applications.
// For full source code and docs, visit
// This library is free software; you can redistribute it and/or
// it under the terms of the GNU Lesser General Public License as
// by the Free Software Foundation; either version 2.1 of the License,
// (at your option) any later version.

I went round this problem inserting src attribute at a later stage and
it works.

Thanks for your interest and help!

Re: $_SESSION array goes blind when inserting into it

Quoted text here. Click to load it

my advice is to use a proxy to watch the data being submitted, if you
were using XHR I woudl suggest you use firebug, but as you are using
iframes a proxy will be more help. You will as you have suggest
probably find its a javascript problem, you might find that posting
pure html is a problem for some spplication firewalls (post payload s
which contain tags might be seen as injection attempts), have you
considered using a javascript parser that takes the attribtues and
uses json notation - with not tags, you can then use php's inbuilt
jason parser the otherside to recreate the original code.

Re: $_SESSION array goes blind when inserting into it

Quoted text here. Click to load it

I think I'll give it a try when I find some spare time since now
I must work to the deadline and finish the project...ugh

Thanks for the hint, I'll report the results,

Site Timeline