Session handling ok- but no browser being used??
Moderator: General Moderators
Session handling ok- but no browser being used??
Hi,
I have two scenarios and one php page as a test.
The php page just calls session_start() and returns back the session id created/retrieved in the response, very simple.
The first is to make a request to this one php page via a browser and hit refresh, as I would expect the same session id on each refresh, close the browser ( all windows that may be open ), do the same again and I get another session id, which is consistant between refreshes. As you would expect.
The second scenario is to call the same url through flash running as a projector ( no browser need be running ), or from any language tool capable of socket communication. When this approach is taken, the php page still returns a consistent session id throughout each request made.
The problem is, I can get my head around the first scenario, as i know that there is cookie information embedded in the response header that the user agent uses and php will use that in turn to retrieve the proper session from the information in the cookie.
How does php know to retrieve the session when scenario 2 is in place. I am assuming here that because im not using a browser, no cookie information can be used in this context, but still manages to get at the same session. I was also assuming that cookies are only associated with browsers.
Can anyone help, TIA
Rob
I have two scenarios and one php page as a test.
The php page just calls session_start() and returns back the session id created/retrieved in the response, very simple.
The first is to make a request to this one php page via a browser and hit refresh, as I would expect the same session id on each refresh, close the browser ( all windows that may be open ), do the same again and I get another session id, which is consistant between refreshes. As you would expect.
The second scenario is to call the same url through flash running as a projector ( no browser need be running ), or from any language tool capable of socket communication. When this approach is taken, the php page still returns a consistent session id throughout each request made.
The problem is, I can get my head around the first scenario, as i know that there is cookie information embedded in the response header that the user agent uses and php will use that in turn to retrieve the proper session from the information in the cookie.
How does php know to retrieve the session when scenario 2 is in place. I am assuming here that because im not using a browser, no cookie information can be used in this context, but still manages to get at the same session. I was also assuming that cookies are only associated with browsers.
Can anyone help, TIA
Rob
i made something like this a while back, it was a feed back form in flash, it would pass its values to php and thenphp would send the email...
you may wanna start here http://www.flashkit.com/tutorials/Dynamic_Content/
you may wanna start here http://www.flashkit.com/tutorials/Dynamic_Content/
- AVATAr
- Forum Regular
- Posts: 524
- Joined: Tue Jul 16, 2002 4:19 pm
- Location: Uruguay -- Montevideo
- Contact:
yes, but, make interaction with php is not so tuff...
what i was trying to do is a client side application, login, db access and stuff.. but for that i need the user "signed in".
Whit php, html frontend,.. its no problem, because i can use sessions or cookies.. but it i dont have a browser???... 100% flash..
how can i do that? how do flash and php mantain a session without the browser?
By the way.. i im not very skilled in flash...
what i was trying to do is a client side application, login, db access and stuff.. but for that i need the user "signed in".
Whit php, html frontend,.. its no problem, because i can use sessions or cookies.. but it i dont have a browser???... 100% flash..
how can i do that? how do flash and php mantain a session without the browser?
By the way.. i im not very skilled in flash...
hmm..you want to run php code on client side?...ur quite adv, so i am not gona say php is a server side lang..oh wait..i just did
anyways, you could make a flash movie to access a remote file with vars e.g. access
http://www.somesite.com/flashinfo.php?u ... ass=blabla
if username and pass is correct you return some sort of ID which is also placed in a db table, then pass it back to flash like
then every time you need to get new content from the site, you just send the ID back, if it is still in the DB then its a vaild user otherwise...its not 
flash can read information from page with above example..but i think you know that.
am i off track? not really sure what you have in mind...maybe you can show a example?
anyways, you could make a flash movie to access a remote file with vars e.g. access
http://www.somesite.com/flashinfo.php?u ... ass=blabla
if username and pass is correct you return some sort of ID which is also placed in a db table, then pass it back to flash like
Code: Select all
&ID=sdkf4534
&otherstuff=bla bla bla bla bla bla blaflash can read information from page with above example..but i think you know that.
am i off track? not really sure what you have in mind...maybe you can show a example?
- AVATAr
- Forum Regular
- Posts: 524
- Joined: Tue Jul 16, 2002 4:19 pm
- Location: Uruguay -- Montevideo
- Contact:
jeje
i dont want to run php on client side...
i algo know how to read a page... (post get stuff)..
let me explain a bit.
supose, i have for example, a Content Management system... but i want that the users can add contect with FLASH a client (could be JAVA, VB, Delphi..).
In this scenario i need user authentication... in html + php y make it with sessions and cookies... but in flash... (swf file).
i can make a form in flash and submit the data to a php file and then to a mysql DB... but how can i handle autentication if i dont have a browser??
PS: sorry kraiklyn i stole your post!

i algo know how to read a page... (post get stuff)..
let me explain a bit.
supose, i have for example, a Content Management system... but i want that the users can add contect with FLASH a client (could be JAVA, VB, Delphi..).
In this scenario i need user authentication... in html + php y make it with sessions and cookies... but in flash... (swf file).
i can make a form in flash and submit the data to a php file and then to a mysql DB... but how can i handle autentication if i dont have a browser??
PS: sorry kraiklyn i stole your post!
how about this then:
you have 3 boxs in your swf movie,
right?..ok, all the user does is enter his username, password and the content he wants to submit, on submit, call a page with post or get function in flash and send these values, when it gets there, first check to see if the user has account with your system, if he does then allow the content field data into db,
and output
&msg=Data has been accepted.....
if the user does't have account then return
&msg=YOu dont have a account with us...
make sense?
u can have any number of boxs in the movie, this i sjust a example
you have 3 boxs in your swf movie,
Code: Select all
Username : ї ]
password: ї ]
Content: ї ]and output
&msg=Data has been accepted.....
if the user does't have account then return
&msg=YOu dont have a account with us...
make sense?
u can have any number of boxs in the movie, this i sjust a example
- AVATAr
- Forum Regular
- Posts: 524
- Joined: Tue Jul 16, 2002 4:19 pm
- Location: Uruguay -- Montevideo
- Contact:
it make sense... but its not the main issue here...
ok yout have the login procedure done...
how do you proceed.. in html+php.. you set a cooki or a session variable that you can check to know if the user is authenticated...
but.. how do you do that in flash??? without any browser??? only with the swf???
the interaction of flash with php is not the main problem here...
the interesting thing is how can i create a sesion (socks???..) between a swf (or any other client) and my backend application. ITs like a webservice, but with a full aplication.
ok yout have the login procedure done...
how do you proceed.. in html+php.. you set a cooki or a session variable that you can check to know if the user is authenticated...
but.. how do you do that in flash??? without any browser??? only with the swf???
the interaction of flash with php is not the main problem here...
the interesting thing is how can i create a sesion (socks???..) between a swf (or any other client) and my backend application. ITs like a webservice, but with a full aplication.
would't this work...cos you have a var in the flash movie acting out as a session cookie. all you have to do is to make sure you don't lose this var somewhere in you movie....i think it would work, if i get some free time i am gona build it just to see if it worksqads wrote: if username and pass is correct you return some sort of ID which is also placed in a db table, then pass it back to flash likethen every time you need to get new content from the site, you just send the ID back, if it is still in the DB then its a vaild user otherwise...its notCode: Select all
&ID=sdkf4534 &otherstuff=bla bla bla bla bla bla bla![]()
(lol..post hijacking is not allowed here you know