Page 1 of 1
$_SESSION NOT TRANSFERED INTO IFRAME
Posted: Wed May 26, 2004 9:49 am
by amer
Could anyone find solution and help me to understand the sitaution ?
Code: Select all
<?
session_start();
$_SESSION['x']="x";
session_register("register");
$register="y";
?>
<iframe src=x.php></iframe>
<? X.PHP
session_start();
$id=session_id();
print<<<end
$register $_SESSION['x'] $id
end;
?>
the result of this code is:
y cb05f6258e0fcdcbdde750ab3af85845
so the registred variable $y and the session_id appears in iframe but not the variable $_SESSION['x']...
???
ps. aha in php.ini i got
session.use_trans_sid = 1
url_rewriter.tags=
"a=href,area=href,frame=src,input=src,form=fakeentry,iframe=src"
and register_globals = on
(if it may help...)
Posted: Wed May 26, 2004 10:08 am
by kettle_drum
Try to refresh the page after you have set the session data and see if it makes a difference.
Posted: Wed May 26, 2004 10:09 am
by wwwapu
There is some information in php manual
http://fi.php.net/manual/en/function.se ... gister.php on session_register. There is caution not to use session_register if $_SESSION is being used. Don't know exactly why, but this misfunction you experienced might have something to do with this.
Posted: Wed May 26, 2004 10:11 am
by amer
completely not; any difference made
Posted: Wed May 26, 2004 10:12 am
by amer
no it is not about "caution not to use session_register if $_SESSION is being used"; i have use the session_register just to show that if it is used some variable come into iframe; without it there is the asme result;
Posted: Wed May 26, 2004 10:26 am
by wwwapu
you have "register_globals = on" does $x print? I believe it should.
Posted: Wed May 26, 2004 10:33 am
by amer
yes, thanks very much - it is printing $x !!!
Posted: Wed May 26, 2004 4:59 pm
by jason
You didn't have {} around your $_SESSION call. This would have worked:
Code: Select all
<?
session_start();
$id=session_id();
print<<<end
$register {$_SESSION['x']} $id
end;
?>
Posted: Thu May 27, 2004 11:48 am
by wwwapu
Some information can be found at
http://www.php.net/types.string The heredoc syntax you are using produces a string. And inside a string you should use $_SESSION[x] or for any array variable $arr[something] wihout quotation marks. But outside a string quotation marks has to be used unless you don't mind Notices of undefined constants. Or you could use braces as jason pointed.
Code: Select all
<?php
print $arr["something"];
print "$arr[something]";
print <<<end
$arr[something] or {$arr['something']}
end;
?>
But the mystery is not solved yet. Syntax $_SESSION['x'] should lead to parse error and in your case it does not?
Posted: Thu May 27, 2004 1:15 pm
by feyd
display_errors may be off... if it didn't show...