Php photo gallery TWG | JFUploader | TWG Flash upload | WFU | Forum
https://www.tinywebgallery.com/forum/

tfu_upload.php wont read cookies
https://www.tinywebgallery.com/forum/viewtopic.php?f=12&t=1608
Page 1 of 1

Author:  o2pb [ 21. Jul 2008, 04:50 ]
Post subject:  tfu_upload.php wont read cookies

Im including a file at the top of the tfu_upload.php that sets up the mysql connection and gets my site settings, and also checks to see if a user is logged in via the means of a cookie.

If the user is logged in, this said file sets $user_id to the id of the logged in user. tfu_upload.php runs a mysql query at the end of the upload to insert the item into the DB, and it needs to insert the user_id along with it, except that it wont read the cookie, and simply inserts nothing into the table column.

I tried to have it read the cookie directly in the tfu_upload.php and Im still getting nothing.

Author:  o2pb [ 21. Jul 2008, 05:40 ]
Post subject: 

it also wont read session variables.

Author:  TinyWebGallery [ 21. Jul 2008, 09:42 ]
Post subject: 

Hi,

Right - blame the browser vendors and adobe for this.
the flash upload is almost treated like a new connection.

This is why I have a lot of workarounds to enable at least proper session handling.

But the upload is working? Then the session works too because the upload directory is passed by the session.

When do you set the session variables?
And you are not using Joomla?

/Michael

Author:  o2pb [ 21. Jul 2008, 17:17 ]
Post subject: 

Im setting the session variable before upload even takes place, on a different page. Get it doesn't insert anything into the column where the user_id should be.

It uploads just fine.

Im not using joomla

Author:  TinyWebGallery [ 21. Jul 2008, 17:24 ]
Post subject: 

if the upload works then the session works fine to.

compare the session id's.

in tfu_upload.php is a section on the top you can uncomment and the the session id is written to the tfu.log.
compare it with the one you use.
make sure to pass the session id to the flash!

/Michael

Author:  o2pb [ 21. Jul 2008, 22:02 ]
Post subject: 

Session ID and everything else is set on the page that has the uploaded embedded on.

I also have $_SESSION['logged_user_id'] set which contains the ID of the logged in user.

tfu_upload has the folowing line:
$loggedin_user_id = $_SESSION['logged_user_id'];
when I try to insert into the DB, it inserts $loggedin_user_id as 0. No matter what the actual ID is.

Author:  TinyWebGallery [ 21. Jul 2008, 22:05 ]
Post subject: 

have you done what I wrote before?

/Michael

Author:  o2pb [ 22. Jul 2008, 08:33 ]
Post subject: 

Code:
07.22.2008 8:42:57 - session id : aef03c0dded10671230abedac290d94e

07.22.2008 8:42:57 - ERROR 8 in ome/users/2waffles/public/tfu_upload.php, line 7: Undefined index:  TFUSESSID

07.22.2008 8:42:57 - session TFU:

07.22.2008 8:42:57 - ERROR 8 in ome/users/2waffles/public/tfu_upload.php, line 8: Undefined index:  TFU_LOGIN

07.22.2008 8:42:57 - login:

07.22.2008 8:42:57 - ERROR 8 in ome/users/2waffles/public/tfu_upload.php, line 9: Undefined index:  TFU_DIR

07.22.2008 8:42:57 - dir:

07.22.2008 8:42:57 - ERROR 8 in ome/users/2waffles/public/tfu_upload.php, line 36: Undefined index:  logged_user_id


And session ids do not match if I echo it out on a regular php page.

Author:  TinyWebGallery [ 22. Jul 2008, 09:04 ]
Post subject: 

o.k. - how do you get an output at line 7 and 8?

the session_start is at line 28!

Do you have the output at the very top?

it has to be where I placed it - afte the restore_temp_session();

Because you say the upload works but you don't have TFU_LOGIN set - this is impossible.

and TFUSESSID is a parameter I send from the flash! Make sure you have NOT set session_name in the flash as parameter. If you do this you have of course to change TFUSESSID to this value.

/Michael

Author:  o2pb [ 22. Jul 2008, 15:22 ]
Post subject: 

Im running a modified version of an older script. session_start() is right at the top of the file, because I include global.php at the very top, which makes the mysql connection, and gets user data.

Author:  TinyWebGallery [ 22. Jul 2008, 15:31 ]
Post subject: 

which version are you using?

Because I have added several session workarounds in the last year...

But if the upload works then the session works from the flash to tfu_upload.php - otherwise authentification fails!

- have you set session_id at the flash?
your main goal should be that the session id's inside tfu_upload.php and your page are the same!

/Michael

Author:  o2pb [ 23. Jul 2008, 08:53 ]
Post subject: 

I have session_start() at the top of the file, but Im still getting a different session id.

Im using 2.5.1

I just tested the script in IE, and it works just fine. Both sessions match.

In FF, they do not.

Author:  TinyWebGallery [ 23. Jul 2008, 19:12 ]
Post subject: 

I added this session stuff in 2.6.

Do you start the flash with the session variable?
Because if the upload works the session inside tfu works too.

And I know only ff handles the flash like a new session if you don't use one of my workarounds.

/Michael

Page 1 of 1 All times are UTC + 1 hour [ DST ]
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/