Setting PHP SESSION parameters in a cross-domain iframe

Coles Notes Version:

index.php?map_id=foouploaded to iframe at www.not-my-domain.com. indexes SESSION['map_id']= foo. The flash file is trying to get SESSION['map_id']through Authenticate.php, but Authenticate.php does not have the values ​​set for any SESSIONvaraibles.

- Only the problem with the first load, the problem with the cross domain.

Verbose:

I have an index where I set: SESSION['map_id'] = foo

Then the index file loads the flash file. Upon initialization, the flash accesses the Authenticate.php file, which displays SESSION['map_id']and loads into flash through LoadVars. Flash then displays the relevant data. This step cannot be done in any other way.

All this works great on our main site. The problem occurs when we try to migrate to other sites by providing iframe embed codes:

<iframe src="http://www.mydomain.com/?map_id=foo&code=bar" ... ></iframe>

When loading the embed code from another site (www.anotherdomain.com) again, it seems that the variables SESSIONwere destroyed, since flash just says that they are empty. ( $map_iddisplays a space)

The index file will still correctly echo $map_idlike "foo", it just seems that the "Authenticate.php" file cannot access varaibles SESSION.

I guaranteed to be session_start()present in all relevant files.

+3
source share
1 answer

PHP cookie, cookie . URL.

php.

php URL-, .

  • URL- ( get):

    < iframe src= "http://www.mydomain.com/?&map_id=foo&code=bar" >

  • , , URL-:

    ini_set ( "session.use_cookies", "0" );

  • url_rewriter.tags, PHP, html- . iframe = src :

    ini_set ( "url_rewriter.tags", "a = href, area = href, frame = src, iframe = src, input = src, form = fakeentry" );

+4

Source: https://habr.com/ru/post/1707386/


All Articles