-
PHP not working?
During spring, there was a major change in php's way to handle variables received from flash or html forms. This change was made to address some security concerns
Before that time, variables from the form where simply available as php variables. The new php versions (4.1 or later) usually require you to pick up the vars from the form.
Now, there are many scripts around that have not been adapted to the new servers. On the other side, there are also quite a few hosting companies still running php versions from two years ago.
If your scripts fail to receive variables from your movies, please check
a) what is the php version on the server: simply upload a file phpinfo.php with that one line
<?php phpinfo(); ?>
in it and open it in the browser. The output will reveal the php version. If the version is 4.1 or later OR if the register_globals is off (somewhere down the page), then check
b) is the script suitable for new servers. If it was last modified before spring, probably not
Otherwise check whether at least one of $HTTP_GET_VARS, $HTTP_POST_VARS,
$_GET, $_POST or $_REQUEST occurs anywhere in your script. If not, your script has to be fixed.
Note: if you are testing on your own server, you can change the register_globals just to get the script working. This is not recommended: since it is a security thing, your hosting company will set it differently so your script fails if you upload to the web.
Musicman
-
Actually if you isert the following:
foreach($HTTP_GET_VARS as $name => $value) { $$name = $value;}
foreach($HTTP_POST_VARS as $name => $value) { $$name = $value;}
foreach($HTTP_COOKIE_VARS as $name => $value) { $$name = $value;}
Your variables will all be imported into your PHP script from Flash.
Jim Almeida
http://www.atechcommunications.com
http://www.nunrg-records.com
-
Hi,
the change was made for, let's say, security reasons. It ensures that only vars get into your scripts that you expect, and not vars that anyone adds to the http request for malicious reasons.
Those script of yours just gets the unsafe state back.
May I suggest something like that instead:
Code:
$postvars = array("abc", "def", "ghi");
foreach ($postvars as $var)
if(isset($_POST[$var]))
$$var = $_POST[$var];
Musicman
-
Thanks for starting this thread. I am new to php and I was screwing around for hours trying to figure out why my variables were not working.
So all I would have to do is substitute your "abc", "def", "ghi", etc. for my variables that are coming from flash and the rest of the code will allow them to be useable in my php script?
$_REQUEST['myvar'] works for my variables yet $_POST['myvar'] does not. I assume I can substitute $_POST['myvar'] for $_REQUEST['myvar']?
Why does $_REQUEST work for me and $_POST not?
-
Hi,
you are probably passing vars with the GET method (or tacking them onto the url)
Musicman
-
Senior Member
Is there a place I can see the result of <?php phpinfo(); ?>
-
Thanks
Great info musicman
It helped me a lot with my work and I wish I has read it earlyer this day before I post my question )
Keep up the great work.
Stratos
Lightform - Evolution One
http://lightform.onar.gr
Ex - Reactor 5.0
-
The new php versions (4.1 or later) usually require you to pick up the vars from the form.
May i have an simple example how am i going to do so? My script work with php 4.0.5. How do i get about in going to edit my script for it to work with newer php?
Some sample of my currently script:
Code:
$query = "INSERT INTO $tablename (date, firstName) VALUES (now(), '$jFirstName2')";
In this case, the jFirstName2 in Flash is being send to php as $jFirstName2. But now it seem not be the case, what else sld i do to solve this issue?
Thanks
chup
-
Senior Member
The most easy way will be if the server-administrater change
"register_globals" to "on" in the php.ini file,
followed by a restart of the webserver.
Then nothing has to be changed.
However the server may become easier vulnerable in future bugs.
-
What happen if i have totally no control over the server?
-
Senior Member
ask the one who does, tell him your problem, and that the cure is easy.
-
No, i mean, if i dunwanna do anything to the server, is the any other solution i can work with? Like what is the new "correct" way to make this work?
-
i don't know if i kept track of this conversation, but here is some help.. (Someone mentioned the fact that they needed help knowing how to correct their code...)
Code:
$_GET['name']; //this would get a variable called "name" that was in the query string (address bar) or from a method="get"
// for example user_setup.php?name=rob "rob" would be returned..
$_POST['name']; //this would get a variable called "name" that was posted from a form with method="post" in the <form> tag.
Hope this helps a bit...
(the code above has no Flash functions.. only php, so i don't know if it helps at all :P)
there are two things that make true happiness!
Love and Actionscript!
-
help!
Hello, I've tried pasting in this code:
$postvars = array("abc", "def", "ghi");
foreach ($postvars as $var)
if(isset($_POST[$var]))
$$var = $_POST[$var];
...into my formmail script, replacing "abc", "def", "ghi" with "recipient", "subject", "content"
Unfortunately this does'nt seem to have worked. Have I implemented it right? I just put it into the scriptunder the header. The script still works for the html forms on my site, but not for the flash.
The script I'm using is the one available from http://www.dtheatre.com/scripts/
Any help would be much appreciated. I know nothing about php by the way.
-
Hi,
if it works with html but not with flash, maybe your movie is not really sending...
Could you post url to the movie?
Musicman
-
ok, I've put up a test version so you can see the response I'm getting:
http://www.planetkoala.com/atest5.html
It looks like it's calling the script but I've got some kind of security issue?
Here's the script working in html:
http://www.planetkoala.com/community.htm
Cheers
-
Hi,
your movie is not sending any data back to the server, but only requesting the php ... at least if you use FP6. It works fine with FP5, however.
According to info I got from Macromedia when I reorted a similar problem, your movie should work if you use an absolute url rather than a relative one.
The change was made sometime around 6.0.59 or 6.0.60, for no obvious reason. From the point of view of a normal user, I would consider it an outright bug: there is nothing in the documentation about it; it prevents reusing the same movie on similar systems; it breaks compatibility with existing movies created with older flash versions
Musicman
-
Ah yeah crap bug. thankyou very much anyway, you're a lifesaver!
-
gah, I spoke too soon there, I've tried the full http:// address and just prefixing it with a "/" neither of these work
(www.planetkoala.com/atest6.html and www.planetkoala.com/atest7.html respectively).
any other ideas?
-
Hi,
#6 works for me on both fp5 and fp6, #7 again only works on fp5
Musicman
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|