A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: PHP/flash issue

  1. #1
    Senior Member
    Join Date
    Feb 2002
    Posts
    166

    PHP/flash issue

    I have built a form in flash which points at a php file and places the info in an mysql database on my site. When testing on my server it all works nicely.

    However when the swf collecting the info was placed on the clients server it no longer fed the info into the database....

    The code on the submit button in the swf is pointing at the php script on my server (which is php enabled) but sitting on the clients server(which is not PHP enabled).

    What I'm trying to find out is if it makes any diference in this instance that they are not enabled for php - since the php script is actually on my server?

    All that is happening is the client server is firing off data collected by the swf at a PHP file - not actually processing it
    Or if there is any way round this. The client server does have some server side processing capacity... just not php!!!

    Apologies if I'm being naive - but have had to go to pop up HTML forms to collect the data and they don't look anywhere near as good as my flash form did!

    Any help appreciated
    Thanks
    m

    ps here is the code on the submit button


    on (release){
    if (checkboxfemale.selected == true) {
    Gender = "Female";
    }

    if (checkboxmale.selected == true) {
    Gender = "Male";
    }

    if ((!Email.length || Email.indexOf("@") == -1) || Email.indexOf(".") == -1) {
    EmailStatus = "Please enter a valid E-mail address";
    } else if (!FirstName.length) {
    EmailStatus = "Please enter your first name before sending";
    } else if (!SurName.length) {
    EmailStatus = "Please enter your surname before sending";
    } else {
    loadVariablesNum("http://www.markwaterfield.com/MailPHP10c.php", "0","Get");
    EmailStatus = "Sending... ";
    }
    }

  2. #2
    Senior Member jweeks123's Avatar
    Join Date
    Mar 2006
    Posts
    1,124
    Usually, the PHP code will reference to a local database, you may be able to bypass it by contacting your client server administrator and asking for a direct link to their mySQL database.

  3. #3
    Senior Member
    Join Date
    Feb 2002
    Posts
    166
    Thanks for getting back so quickly.

    The client hasn't got the mysql database - I was going to collect their data for them in my mysql database. However, as I say, with the swf sitting on their server and the PHP script on mine, the info doesn't get their - even though I have an absolute link to the php file on my server...

  4. #4
    Senior Member jweeks123's Avatar
    Join Date
    Mar 2006
    Posts
    1,124
    Well, in that instance you could try to trick the file, by which I mean put the .swf file on your server, and reference it in an absolute link from their server.

    See if that helps out.

  5. #5
    Senior Member
    Join Date
    Feb 2002
    Posts
    166
    Nice idea - I like your style!

  6. #6
    Senior Member jweeks123's Avatar
    Join Date
    Mar 2006
    Posts
    1,124
    Flash can be tricky, so one much trick it back, LOL.

  7. #7
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,876
    to reference a php file on another server you need to put a cross-domain file policy (named crossdomain.xml) in place on your php server for e.g place the corssdomain.xml file in the root of your server and it should have the following:

    Code:
    <?xml version="1.0"?>
    <cross-domain-policy>
    <allow-access-from domain="www.domainwithyourflashfile.com" />
    </cross-domain-policy>
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

  8. #8
    Senior Member
    Join Date
    Feb 2002
    Posts
    166
    So in order to to reference the php file on my server they would have to place the cross domain xml file in the root of their server, right? And it doesn't matter that their server isn't PHP enabled?

    btw thanks for the help

  9. #9
    Senior Member jweeks123's Avatar
    Join Date
    Mar 2006
    Posts
    1,124
    I"m not sure about that stuff, but I think it would need to go on your server with the PHP file, and then the swf could sit on your client's server.

  10. #10
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,876
    yep!! you need to place it on the server where the php file sits..not where the flash file sits...
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

  11. #11
    Senior Member
    Join Date
    Feb 2002
    Posts
    166
    Thanks I will give it a go...
    BTW
    can you list multiple domains in the file?
    m

  12. #12
    Senior Member
    Join Date
    Feb 2002
    Posts
    166

    seems to work

    seems to work
    thanks for all the help
    m

  13. #13
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,876
    no problem!! yes u can specify mutilple domains:

    Code:
    <?xml version="1.0"?>
    <cross-domain-policy>
    <allow-access-from domain="www.domainwithyourflashfile.com" />
    <allow-access-from domain="www.anotherdomain.com" />
    </cross-domain-policy>
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center