Welcome Guest, Not a member yet? Register   Sign In
Can you help me? I'm having problems with sessions with an iframe facebook app.
#1

[eluser]NM[/eluser]
Hi, I'm hoping someone can tell me why my PHP sessions seem to change for some of my users but not others.

I've made a facebook connect iframe app based around a flash game where the users play the game a submit a score at the end.

English Pub Pool - Facebook App

It seems to work fine for most of my users (over 200 users a day at the moment), but for a few it fails.

How it works is:
- the game swf is played in facebook as an iframe app (this can cause cookie problems)
- the game page loads and passes a token and user info to the game swf as flash vars.
- the user id info, token and a security code is saved in the PHP session.
- at the end of the game a score is submitted passing the information to my server from from the swf.
- the server runs some checks on the info sent from the swf and compares it to the info saved in the PHP session.
- if the the info is fine, then the score is submitted otherwise an error message is sent back to the game swf.

So, it seems 99% of the time this works great, but sometimes when the swf submits a score the PHP session is different - a totally new session and the score submit fails. Why is the session changing sometimes?

I'm using the native PHP Sessions, but I had similar issues with the codeigniter sessions too.

I've run some checks and it doesn't seem to be any particular browser or OS that is causing the bug. I've seen the same error on Macs, Windows, FF, IE, etc...

It's very frustrating as I want to release the application, but I'd like to get all of the bugs fixed first.

I'm out of ideas, so can anyone help me?

Cheers

EDIT: Oh yeah, one strange thing to note. When the game page loads, the game swf seems to cause the game page to be called up to three times! If I add a log to the game page for each call, I see about 3 or 4 entries with a few seconds between each load in the log! I think it's something to do with the mochi ads in the game - this might be the reason for the sessions changing???
#2

[eluser]InsiteFX[/eluser]
The problem lies with a W3C standard called Platform for Privacy Preferences or P3P for short. You can read all about the boring stuff via the link or else just install the P3P Compact Policy header below. This will allow Internet Explorer to accept your third-party cookie. You will need to send the header on every page that sets a cookie.

Code:
header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');

InsiteFX
#3

[eluser]NM[/eluser]
Thanks, but I've already got that line at the top of all of my pages.

But, I've just realized it's not in my AJAX calls from my page or from the SWF.

Do I need it in the AJAX calls too?

It could be that.

But, I'd be surprised if that is the issue as it works about 99% of the time. Before I added that line to the top of all of my pages, I think the submissions always failed in IE.
#4

[eluser]InsiteFX[/eluser]
You need it in all iframe pages.
So if your Ajax calls are in the iframe yes you will need it thre also.

InsiteFX
#5

[eluser]NM[/eluser]
@InsiteFX, I added the header code to the AJAX calls and so far I haven't had any errors - but it's still too early to be sure it's stopped the bug. I'll report back later...

Meanwhile, I've found one more bug that I don't understand. It doesn't happen very often, about once a day, and I don't have a clue why it happens. Here it is, sometimes when the game POSTs the scores from the swf in an HTTP request, the $_POST array is empty - and the score submission fails. I'm pretty sure it is a real submission as the referer is the SWF file, but there is no data - this should be impossible as the SWF always posts the scores with some information.

Does anyone know why or how the $_POST data is lost?

Cheers
#6

[eluser]NM[/eluser]
OK, it's back. I had about few hours with no bugs, but now I'm still seeing a few errors because of the PHP session changing again. It happened with the following browsers:

- Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7;
- Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.1.249.1064 Safari/532.5
- Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6 (.NET CLR 3.5.30729) FBSMTWB

But I'm still seeing about 99% of the submissions being successful, and I'm not able to recreate the error on my PC.

Can anybody explain why a few scores aren't being submitted due to PHP sessions changing?

Cheers
#7

[eluser]Unknown[/eluser]
hello friends i am having similar problem in CI with Facebook Canvas Application.
i am creating Facebook Canvas Application like http://apps.facebook.com/englishpubpoolgames/ .when user come on application page he is checked if he is logged in or not.if user is logged in user are able to see next page of my Facebook apps which will be displayed in I frame but on next controller when i check code igniter session it always blank and i am not able to see my set session variable so can any one knows whats the problem with Code igniter session library if we use it in I frame?




Theme © iAndrew 2016 - Forum software by © MyBB