Page 1 of 1
**** removing slashes
Posted: Mon May 17, 2004 7:48 pm
by igbw
I have a form in Flash that I'm sending to a PHP script that is sending an e-mail. My problem is the I keep getting / before all ' I've tried stripslashes($mailMessage); but that doesn't seem to do the trick. Here's my code any help would be appreciated.
-Thanks
note: commented out code of things i've tried
<?
$siteName = "mySite.com";
$siteURL = "
http://www.myURL.net";
$siteContact = "
my@email.com";
$recipientEmail = "
my@email.com";
$mailMessage = "Name: ".$senderName;
$mailMessage .= "\nCompany: ".$company;
$mailMessage .= "\nPhone: ".$phone;
$mailMessage .= "\nE-Mail: ".$eMail;
$mailMessage .= "\nAddress: ".$address;
$mailMessage .= "\nCity: ".$city;
$mailMessage .= "\nState: ".$state;
$mailMessage .= "\nZip: ".$zip;
$mailMessage .= "\nCountry: ".$country;
//stripslashes($mailMessage);
//htmlspecialchars($mailMessage);
//htmlentities($mailMessage);
//echo $mailMessage;
// Build up email header fields
$mailFrom = "From: $siteName <$siteContact>";
$mailTo = "$recipientEmail";
$mailSubject = "Message from $senderName";
// Send email
mail($mailTo, $mailSubject, $mailMessage, $mailFrom);
$response = "Message Sent";
// Respond to Flash movie!
print "&statusDisplay=$response&";
?>
Posted: Mon May 17, 2004 7:51 pm
by dull1554
why do you have it commented out?
that might help....?!?!?!?!?!
there is no reason that
won't work.
Posted: Mon May 17, 2004 7:52 pm
by tim
is it possible that:
http://us4.php.net/manual/en/function.g ... es-gpc.php is off? its on by default but it can be off, that will screw up the stripslashes function. (not looking at your code, just giving my .02)
Posted: Mon May 17, 2004 7:52 pm
by jason
Use
http://ca.php.net/stripslashes
Remember, it RETURNS the string without the slashes. You don't capture that output in your script.
Posted: Mon May 17, 2004 7:56 pm
by jason
For those offering help: Please, take the time to read the code and to read the post. It doesn't do anybody any good if you don't take the time to actually test what you are suggesting.
dull1554: Uncommenting stripslashes() won't do anything. I am also sure he had it uncommented before, and was only commented here. Heck, he even says so:
note: commented out code of things i've tried
Finally, igbw: Use the PHP bbCode tags. They will highlight the code for you, and more importantly, for the people trying to help you. By using the bbCode tags, you may spot an error, and it just makes reading the post much easier.
Code: Select all
<?
$siteName = "mySite.com";
$siteURL = "http://www.myURL.net";
$siteContact = "my@email.com";
$recipientEmail = "my@email.com";
$mailMessage = "Name: ".$senderName;
$mailMessage .= "\nCompany: ".$company;
$mailMessage .= "\nPhone: ".$phone;
$mailMessage .= "\nE-Mail: ".$eMail;
$mailMessage .= "\nAddress: ".$address;
$mailMessage .= "\nCity: ".$city;
$mailMessage .= "\nState: ".$state;
$mailMessage .= "\nZip: ".$zip;
$mailMessage .= "\nCountry: ".$country;
//stripslashes($mailMessage);
//htmlspecialchars($mailMessage);
//htmlentities($mailMessage);
//echo $mailMessage;
// Build up email header fields
$mailFrom = "From: $siteName <$siteContact>";
$mailTo = "$recipientEmail";
$mailSubject = "Message from $senderName";
// Send email
mail($mailTo, $mailSubject, $mailMessage, $mailFrom);
$response = "Message Sent";
// Respond to Flash movie!
print "&statusDisplay=$response&";
?>
See, much nicer. =)
Posted: Mon May 17, 2004 7:57 pm
by tim
Sorry jason.
I was just trying to think why stripslashes wouldnt work (as its a pretty straight forward function) and i just thought the magic_quotes need to be on n said what I thought.
Posted: Mon May 17, 2004 7:58 pm
by dull1554
boy o' boy, i suppose i should look a bit closer before i try to give a answer...........
Posted: Mon May 17, 2004 8:01 pm
by jason
No, no need to apologize guys. I didn't mean to sound like I was <span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span>. It's just my job to be anal. =)
The point was to say: Read, write, edit, reread, edit, post. In other words, make sure you read everything, then write your response. Then go back and edit your response for spelling and grammar (yes, spelling and grammar make a big difference), reread what the person wrote, and then what you wrote, edit if you need to, then post.
No harm, no worries.
Posted: Mon May 17, 2004 8:05 pm
by dull1554
true true...
i'll leave it at that
*its just that sometimes people get careless*
Posted: Mon May 17, 2004 8:08 pm
by igbw
i tried adding get_magic_quotes_gpc(1); at the top of my code and it didn't work. is that what you all were talking about?
thanks for the help.
Posted: Mon May 17, 2004 8:11 pm
by jason
igbw: No, try looking at [php_man]stripslashes[/php_man]($mailMessage); again.
You see, you are just calling the function. But if you look at the manual, [php_man]stripslashes[/php_man] returns something (the cleaned string).
So what you really want is this:
Code: Select all
$mailMessage = stripslashes($mailMessage);
Posted: Mon May 17, 2004 8:18 pm
by igbw
thanks jason that fixed it.
peace
igbw