473,386 Members | 1,821 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Flash & PHP Session

Hi,

I have an upload application written in PHP and Flash. The PHP page
gets the file information via $_POST. Moreover, the user never
actually visits the PHP page, rather Flash sends the information to the
PHP page and then loads the result, all in the background. Right now,
the php page cannot access the $_SESSION. Is there anyway that I can
conitnue the PHP session when doing this or does the user have to visit
the PHP page?

Thanks.

Steve

Aug 20 '06 #1
10 29855
Steve Cook wrote:
Hi,

I have an upload application written in PHP and Flash. The PHP page
gets the file information via $_POST. Moreover, the user never
actually visits the PHP page, rather Flash sends the information to the
PHP page and then loads the result, all in the background. Right now,
the php page cannot access the $_SESSION. Is there anyway that I can
conitnue the PHP session when doing this or does the user have to visit
the PHP page?

Thanks.

Steve
Looks like your flash isn't sending the session cookie along with the
rest of the request.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Aug 20 '06 #2

Jerry Stuckle wrote:
Steve Cook wrote:
Hi,

I have an upload application written in PHP and Flash. The PHP page
gets the file information via $_POST. Moreover, the user never
actually visits the PHP page, rather Flash sends the information to the
PHP page and then loads the result, all in the background. Right now,
the php page cannot access the $_SESSION. Is there anyway that I can
conitnue the PHP session when doing this or does the user have to visit
the PHP page?

Thanks.

Steve

Looks like your flash isn't sending the session cookie along with the
rest of the request.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Do you have an idea how I can get flash to send the session cookie?

Aug 20 '06 #3
Steve Cook wrote:
Jerry Stuckle wrote:
>>Steve Cook wrote:
>>>Hi,

I have an upload application written in PHP and Flash. The PHP page
gets the file information via $_POST. Moreover, the user never
actually visits the PHP page, rather Flash sends the information to the
PHP page and then loads the result, all in the background. Right now,
the php page cannot access the $_SESSION. Is there anyway that I can
conitnue the PHP session when doing this or does the user have to visit
the PHP page?

Thanks.

Steve

Looks like your flash isn't sending the session cookie along with the
rest of the request.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================


Do you have an idea how I can get flash to send the session cookie?
I think you're going to have to ask that in a Flash newsgroup. We're
PHP programmers here.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Aug 20 '06 #4

Jerry Stuckle wrote:
Steve Cook wrote:
Jerry Stuckle wrote:
>Steve Cook wrote:

Hi,

I have an upload application written in PHP and Flash. The PHP page
gets the file information via $_POST. Moreover, the user never
actually visits the PHP page, rather Flash sends the information to the
PHP page and then loads the result, all in the background. Right now,
the php page cannot access the $_SESSION. Is there anyway that I can
conitnue the PHP session when doing this or does the user have to visit
the PHP page?

Thanks.

Steve
Looks like your flash isn't sending the session cookie along with the
rest of the request.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Do you have an idea how I can get flash to send the session cookie?

I think you're going to have to ask that in a Flash newsgroup. We're
PHP programmers here.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
I definitely know how to pass the session_id via flash. I guess I
should have asked how do I manually set the session_id value in PHP?
In other words how do I populate the session_id variable?

Aug 21 '06 #5
Steve Cook wrote:
Jerry Stuckle wrote:
>>Steve Cook wrote:
>>>Jerry Stuckle wrote:
Steve Cook wrote:
>Hi,
>
>I have an upload application written in PHP and Flash. The PHP page
>gets the file information via $_POST. Moreover, the user never
>actually visits the PHP page, rather Flash sends the information to the
>PHP page and then loads the result, all in the background. Right now,
>the php page cannot access the $_SESSION. Is there anyway that I can
>conitnue the PHP session when doing this or does the user have to visit
>the PHP page?
>
>Thanks.
>
>Steve
>

Looks like your flash isn't sending the session cookie along with the
rest of the request.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Do you have an idea how I can get flash to send the session cookie?

I think you're going to have to ask that in a Flash newsgroup. We're
PHP programmers here.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================


I definitely know how to pass the session_id via flash. I guess I
should have asked how do I manually set the session_id value in PHP?
In other words how do I populate the session_id variable?
You don't. PHP does, based on the session id passed back by the browser
- which is stored in a cookie.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Aug 21 '06 #6

"Jerry Stuckle" <js*******@attglobal.netschreef in bericht
news:i8******************************@comcast.com. ..
Steve Cook wrote:
>Jerry Stuckle wrote:
>>>Steve Cook wrote:

Jerry Stuckle wrote:
>Steve Cook wrote:
>
>
>>Hi,
>>
>>I have an upload application written in PHP and Flash. The PHP page
>>gets the file information via $_POST. Moreover, the user never
>>actually visits the PHP page, rather Flash sends the information to
>>the
>>PHP page and then loads the result, all in the background. Right now,
>>the php page cannot access the $_SESSION. Is there anyway that I can
>>conitnue the PHP session when doing this or does the user have to
>>visit
>>the PHP page?
>>
>>Thanks.
>>
>>Steve
>>
>
>Looks like your flash isn't sending the session cookie along with the
>rest of the request.
>
>--
>==================
>Remove the "x" from my email address
>Jerry Stuckle
>JDS Computer Training Corp.
>js*******@attglobal.net
>==================
Do you have an idea how I can get flash to send the session cookie?
I think you're going to have to ask that in a Flash newsgroup. We're
PHP programmers here.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================


I definitely know how to pass the session_id via flash. I guess I
should have asked how do I manually set the session_id value in PHP?
In other words how do I populate the session_id variable?

You don't. PHP does, based on the session id passed back by the browser -
which is stored in a cookie.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
I beg to differ:

Do something like:

<?php
ini_set('session.use_cookies', '0');
session_start();
?>

Put your flash movie in the same page and echo the SID behind it (old school
style):

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"
width="32" height="32">
<param name="movie" value="whatever.swf?<?php echo SID ?>">
<param name="quality" value="high">
<embed src="whatever.swf?<?php echo SID ?>" width="32" height="32"
quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash" sid=""></embed></object>

This will give you access to the variable PHPSESSID in flash. Make sure you
append this to every GET request to php.

Notice though that appending session ID's to GET request are often
considered a security risk. But since you are using flash and thus requests
are made in the background (not through addressbar requests), it's somewhat
safer to use IMO.

Cheers
Aug 21 '06 #7

"amygdala" <no*****@noreply.comschreef in bericht
news:44**********************@news.kpnplanet.nl...
>
"Jerry Stuckle" <js*******@attglobal.netschreef in bericht
news:i8******************************@comcast.com. ..
>Steve Cook wrote:
>>Jerry Stuckle wrote:

Steve Cook wrote:

>Jerry Stuckle wrote:
>
>
>>Steve Cook wrote:
>>
>>
>>>Hi,
>>>
>>>I have an upload application written in PHP and Flash. The PHP page
>>>gets the file information via $_POST. Moreover, the user never
>>>actually visits the PHP page, rather Flash sends the information to
>>>the
>>>PHP page and then loads the result, all in the background. Right
>>>now,
>>>the php page cannot access the $_SESSION. Is there anyway that I can
>>>conitnue the PHP session when doing this or does the user have to
>>>visit
>>>the PHP page?
>>>
>>>Thanks.
>>>
>>>Steve
>>>
>>
>>Looks like your flash isn't sending the session cookie along with the
>>rest of the request.
>>
>>--
>>==================
>>Remove the "x" from my email address
>>Jerry Stuckle
>>JDS Computer Training Corp.
>>js*******@attglobal.net
>>==================
>
>
>Do you have an idea how I can get flash to send the session cookie?
>

I think you're going to have to ask that in a Flash newsgroup. We're
PHP programmers here.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
I definitely know how to pass the session_id via flash. I guess I
should have asked how do I manually set the session_id value in PHP?
In other words how do I populate the session_id variable?

You don't. PHP does, based on the session id passed back by the
browser - which is stored in a cookie.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

I beg to differ:

Do something like:

<?php
ini_set('session.use_cookies', '0');
session_start();
?>

Put your flash movie in the same page and echo the SID behind it (old
school style):

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"
width="32" height="32">
<param name="movie" value="whatever.swf?<?php echo SID ?>">
<param name="quality" value="high">
<embed src="whatever.swf?<?php echo SID ?>" width="32" height="32"
quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash" sid=""></embed></object>

This will give you access to the variable PHPSESSID in flash. Make sure
you append this to every GET request to php.

Notice though that appending session ID's to GET request are often
considered a security risk. But since you are using flash and thus
requests are made in the background (not through addressbar requests),
it's somewhat safer to use IMO.

Cheers
Ooops I didn't thoroughly read the whole thread. I didn't read that a
session was already started.

Forget about the ini_set('session.use_cookies', '0'); part.

And do (untested):

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"
width="32" height="32">
<param name="movie" value="whatever.swf?PHPSESSID=<?php echo session_id()
?>">
<param name="quality" value="high">
<embed src="whatever.swf?PHPSESSID=<?php echo session_id() ?>" width="32"
height="32" quality="high"
pluginspage="http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash" sid=""></embed></object>

Then in the php page that handles flash requests:

<?php
session_id($_GET['PHPSESSID']);
session_start();
?>

Should do the trick. But maybe I'm overlooking something here.
Aug 21 '06 #8

"amygdala" <no*****@noreply.comschreef in bericht
news:44**********************@news.kpnplanet.nl...
>
"amygdala" <no*****@noreply.comschreef in bericht
news:44**********************@news.kpnplanet.nl...
>>
"Jerry Stuckle" <js*******@attglobal.netschreef in bericht
news:i8******************************@comcast.com ...
>>Steve Cook wrote:
Jerry Stuckle wrote:

>Steve Cook wrote:
>
>>Jerry Stuckle wrote:
>>
>>
>>>Steve Cook wrote:
>>>
>>>
>>>>Hi,
>>>>
>>>>I have an upload application written in PHP and Flash. The PHP page
>>>>gets the file information via $_POST. Moreover, the user never
>>>>actually visits the PHP page, rather Flash sends the information to
>>>>the
>>>>PHP page and then loads the result, all in the background. Right
>>>>now,
>>>>the php page cannot access the $_SESSION. Is there anyway that I
>>>>can
>>>>conitnue the PHP session when doing this or does the user have to
>>>>visit
>>>>the PHP page?
>>>>
>>>>Thanks.
>>>>
>>>>Steve
>>>>
>>>
>>>Looks like your flash isn't sending the session cookie along with the
>>>rest of the request.
>>>
>>>--
>>>==================
>>>Remove the "x" from my email address
>>>Jerry Stuckle
>>>JDS Computer Training Corp.
>>>js*******@attglobal.net
>>>==================
>>
>>
>>Do you have an idea how I can get flash to send the session cookie?
>>
>
>I think you're going to have to ask that in a Flash newsgroup. We're
>PHP programmers here.
>
>--
>==================
>Remove the "x" from my email address
>Jerry Stuckle
>JDS Computer Training Corp.
>js*******@attglobal.net
>==================
I definitely know how to pass the session_id via flash. I guess I
should have asked how do I manually set the session_id value in PHP?
In other words how do I populate the session_id variable?
You don't. PHP does, based on the session id passed back by the
browser - which is stored in a cookie.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

I beg to differ:

Do something like:

<?php
ini_set('session.use_cookies', '0');
session_start();
?>

Put your flash movie in the same page and echo the SID behind it (old
school style):

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"
width="32" height="32">
<param name="movie" value="whatever.swf?<?php echo SID ?>">
<param name="quality" value="high">
<embed src="whatever.swf?<?php echo SID ?>" width="32" height="32"
quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash" sid=""></embed></object>

This will give you access to the variable PHPSESSID in flash. Make sure
you append this to every GET request to php.

Notice though that appending session ID's to GET request are often
considered a security risk. But since you are using flash and thus
requests are made in the background (not through addressbar requests),
it's somewhat safer to use IMO.

Cheers

Ooops I didn't thoroughly read the whole thread. I didn't read that a
session was already started.

Forget about the ini_set('session.use_cookies', '0'); part.

And do (untested):

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"
width="32" height="32">
<param name="movie" value="whatever.swf?PHPSESSID=<?php echo session_id()
?>">
<param name="quality" value="high">
<embed src="whatever.swf?PHPSESSID=<?php echo session_id() ?>" width="32"
height="32" quality="high"
pluginspage="http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash" sid=""></embed></object>

Then in the php page that handles flash requests:

<?php
session_id($_GET['PHPSESSID']);
session_start();
?>

Should do the trick. But maybe I'm overlooking something here.
And once again, I didn't read thoroughly anough:
>This will give you access to the variable PHPSESSID in flash. Make sure
you append this to every GET request to php.
Should of course be: POST variable to php

And then in the php page that handles flash requests:

<?php
session_id($_POST['PHPSESSID']); // instead of $_GET[...]
session_start();
?>

lol
Aug 21 '06 #9
<snip>
>>>>>Is there anyway that I can
>conitnue the PHP session when doing this or does the user have to visit
>the PHP page?
<snip>

So basically; what I'm trying to say here is: Yes, you need flash embedded
in _a_ (not _the_) php script (within the same domain of course) to read the
cookie, and Jerry was right. ;)

As a last resort to ommitting flash put in a php file, you could use
javascript to read the cookie and append the PHPSESSID var. But you would
have to rely on the user having javascript turned on. Which is a rather big
no no.

Also, I've been out of webdeveloping for a while, so I'm not sure whether
this is still allowed by the majority of browsers anyway.

HTH
Aug 21 '06 #10
amygdala wrote:
<snip>
>>>>Is there anyway that I can
conitnue the PHP session when doing this or does the user have to visit
the PHP page?

<snip>

So basically; what I'm trying to say here is: Yes, you need flash embedded
in _a_ (not _the_) php script (within the same domain of course) to read the
cookie, and Jerry was right. ;)

As a last resort to ommitting flash put in a php file, you could use
javascript to read the cookie and append the PHPSESSID var. But you would
have to rely on the user having javascript turned on. Which is a rather big
no no.

Also, I've been out of webdeveloping for a while, so I'm not sure whether
this is still allowed by the majority of browsers anyway.

HTH
Thanks for all of your help. I ended up adding the following to the
php page to continue the session and accept the session_id from Flash:

Expand|Select|Wrap|Line Numbers
  1.  
  2. <?
  3. if (!session_id()) {
  4. if (isset($_GET['session_id'])) {
  5. session_id($_GET['session_id]);
  6. }
  7. session_start();
  8. }
  9. ?>
  10.  
  11.  
Thanks again.

Steve

Aug 22 '06 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Astra | last post by:
Hi All I have a Javascript to detect whether a client's browser has flash installed, but as so many people are putting me off relying on Javascript, could you please let me know if you know how...
0
by: Bernie | last post by:
Hi All, I have a weird problem with using flash on aspx pages. It goes like this: I have some links with query string parameters in the page. The same links appear as regular "a href" and also...
5
by: ASP.NET explorer | last post by:
I have been asked to create some simple animation using Adobe Flash player in ASP.NET(C#) web application. While I am fairly well versed with ASP.NET C#, I absolutely have NO IDEA about how to...
3
by: vinceboy | last post by:
Hi..guys.I am newbie here and have a page which need to load two different flash element with session control.However something went wrong in the code and cause the first if clause is not working.I...
0
by: dolittle | last post by:
Hi, I'm embedding a last.fm flash widget. I want to be able to remove it from the page using javascript. I've tried to delete the html element that contains the code but it keeps playing in...
4
by: benjaminkang | last post by:
I'm very new to Coldfusion and action script, but due to job requirements, i got allocated the task of developing a cfm page where the user logs in using the embedded swf file and everything was...
0
by: benjaminkang | last post by:
I'm very new to Coldfusion and action script, but due to job requirements, i got allocated the task of developing a cfm page where the user logs in using the embedded swf file and everything was...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.