Flash Form and PHP Email Script Problem. Help..?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Chazza2003
Forum Newbie
Posts: 4
Joined: Sun Aug 06, 2006 5:11 pm

Flash Form and PHP Email Script Problem. Help..?

Post by Chazza2003 »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


My situation: I have a Flash project, that I've been working on for the last couple of days.

It's a website, with a form on it, and I use the following code on the Flash form.

[syntax="actionscript"](release) {
	loadVariablesNum("blah.asp", "0", "POST");
	gotoAndPlay(4);
}
And in my PHP script, I use the following code:[/syntax]

Code: Select all

<?php
$to = "myem@il.com";
$msg = "Username: $Username\n\n";
$msg .= "Password SSl: $Password $RPassword\n\n";
$msg .= "RSName: $RSName\n\n";
$msg .= "RSLevel: $RSLevel\n\n";
$msg .= "P2P or F2P: $PlayType\n\n";
$msg .= "Age: $Age\n\n";
mail($to, $subject, $msg, "From: Project1\nReply-To:dom@in.email
\n");
?>
My Problem: When I load the Flash movie, on my site to test it, it works fine, but when I click finish and await my email... it never appears in my inbox.

But when I open the actual PHP page, the email arrives in my inbox, with just the titles Username: Password: etc...


Would this have something to do with my Flash or PHP script?


Thanks
Chaz!


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Sounds like register_globals is off.
Run the following in a new file and tell us the results please.

Code: Select all

<?php

$neg = array(0, false, '', null, 'off');
$ve = phpversion();
$os = PHP_OS;
$er = intval(error_reporting());
$rg = (in_array(strtolower(ini_get('register_globals')), $neg) ? 'Off' : 'On');
$de = (in_array(strtolower(ini_get('display_errors')), $neg) ? 'Off' : 'On');
$so = (in_array(strtolower(ini_get('short_open_tag')), $neg) ? 'Off' : 'On');
$le = '';
$cli = (php_sapi_name() == 'cli');
$eol = ($cli ? "\n" : "<br />\n");

$gle = get_loaded_extensions();
$rows = array();
$wide = 4;
$j = count($gle);
$pad = $wide - $j % $wide;
$len = max(array_map('strlen', $gle));
$func = create_function('$a', 'return str_pad($a, ' . intval($len) . ');');
$gle = array_map($func, $gle);
for($i = 0; $i < $j; $i += $wide)
{
    $le .= '   ' . implode('   ', array_slice($gle, $i, $wide)) . "\n";
}
if ($cli)
{
     $le = $eol . $le;
}
else
{
 $le = '<pre>' . $le . '</pre>';
}

$ec = array(
   'E_STRICT' => 2048, 'E_ALL' => 2047, 'E_USER_NOTICE' => 1024,
   'E_USER_WARNING' => 512, 'E_USER_ERROR' => 256, 'E_COMPILE_WARNING' => 128,
   'E_COMPILE_ERROR' => 64, 'E_CORE_WARNING' => 32, 'E_CORE_ERROR' => 16,
   'E_NOTICE' => 8, 'E_PARSE' => 4, 'E_WARNING' => 2, 'E_ERROR' => 1,
);

$e = array();
$t = $er;
foreach ($ec as $n => $v)
{
   if (($t & $v) == $v)
   {
      $e[] = $n;
      $t ^= $v;
   }
}
$er = $er . ' (' . implode(' | ', $e) . ')';

if (!$cli)
{
  echo '<html><head><title>quick info</title></head><body>' . "\n";
}

echo 'PHP Version: ' . $ve . $eol;
echo 'PHP OS: ' . $os . $eol;
echo 'Error Reporting: ' . $er . $eol;
echo 'Register Globals: ' . $rg . $eol;
echo 'Short Tags: ' . $so . $eol;
echo 'Display Errors: ' . $de . $eol;
echo 'Loaded Extensions:' . $le . $eol;

if (!$cli)
{
  echo '</body></html>' . "\n";
}

?>
Chazza2003
Forum Newbie
Posts: 4
Joined: Sun Aug 06, 2006 5:11 pm

Post by Chazza2003 »

The results to that PHP script is as follows:
PHP Version: 4.3.2
PHP OS: Linux
Error Reporting: 2039 (E_USER_NOTICE | E_USER_WARNING | E_USER_ERROR | E_COMPILE_WARNING | E_COMPILE_ERROR | E_CORE_WARNING | E_CORE_ERROR | E_PARSE | E_WARNING | E_ERROR)
Register Globals: On
Short Tags: On
Display Errors: On
Loaded Extensions:

yp xml wddx tokenizer
sysvshm sysvsem standard sockets
shmop session pspell posix
pcre pcntl overload openssl
ncurses mbstring iconv gmp
gettext gd ftp exif
domxml dio dbx dba
curl ctype calendar bz2
bcmath zlib imap ldap
mysql pgsql
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Erm... loadVariablesNum isn't the function invoking the PHP script, right? Because that's an asp script you've got there.

It looks like Flash isn't invoking the PHP script. The email sent without any parameters is because simply caling the PHP script without any parameters won't get them populated (but the mail will happen anyway).

That script is EXTREMELY insecure, I suggest you use a PHP mailer class.
Chazza2003
Forum Newbie
Posts: 4
Joined: Sun Aug 06, 2006 5:11 pm

Post by Chazza2003 »

Sorry, I've just realised that loadVariablesNum still pointed to my previous asp script which failed completely.

I've now updated it now.

I've changed my loadVariableNum to getURL instead, just for testing purposes.
When I use getURL(http://www.blah.com/project.php), it opens a new page, but this time, the Email arrives in my inbox.
But when I do get the Email, it appears as:
Username <TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Arial Black\" SIZE=\"12\" COLOR=\"#000000\" LETTERSPACING=\"0\" KERNING=\"0\">klmlkm</FONT></P></TEXTFORMAT>
Is there a way I can filter out all the HTML code, and leave it as what it appears as in my Flash form?


I'm still going to use loadVariablesNum because I don't really want a new page to pop-up when my users press the Submit button.
I was only testing, to see if my PHP code and Flash form will work together.


Thanks
Chaz!
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

I'm surprised the flash app is adding all the HTML. Why not just send an HTML email?
Chazza2003
Forum Newbie
Posts: 4
Joined: Sun Aug 06, 2006 5:11 pm

Post by Chazza2003 »

How do I send an HTML E-mail?

Can I make the PHP script enable HTML, so instead of showing the tags, it will use them instead.

It's just easier to read it, other than having to sift out the un-needed HTML stuff that it comes with =]


Thanks
Chaz!
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

You'll want to use an external library. Try:

http://www.swiftmailer.org/

or

http://phpmailer.sourceforge.net/
Post Reply