FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Slashes =(





fromegame
Hello,

I have an e-mail script. If I want to send a message with this text:

I'm

Then it sends:

I\'m

What's very logical...
But how can I stop this, because I don't want this. It reads very annoying for the people who receive this e-mail...
Stripslashes doesn't work...

Code:

// emailer.php
include("config.php");

echo $readfrom;

$subject = stripslashes($_POST["subject"]);

$message = stripslashes($_POST["message"]);

$headers = "From: ".$_POST["yourmail"]."\r\n" .
   "Reply-To: ".$_POST["reply"] . "\r\n" .
   'X-Mailer: PHP/' . phpversion();

if($readfrom=="database"){

   if(!$_GET["end"]){
      $end=0;
   }

   $query=mysql_query("SELECT $column from $table LIMIT $end,100 ;");

   if(mysql_affected_rows()==0){
      echo "Operation Finished";
      exit();
   }


   while($data=mysql_fetch_array($query)){
      $email=$data[$column];
      mail($email, $subject, $message, $headers);
      echo $email."<br>";
   }

}



elseif($readfrom=="file"){
   $handle = @fopen($filepath, "r");
   if ($handle) {
         while (!feof($handle)) {
                $email = fgets($handle);
                mail($email, $subject, $message, $headers);
         echo $email."<br>";
         }
         fclose($handle);
   }
}

if($readfrom=="database"){
   $end+=$qty;
}
jabapyth
you could try a replace "\'","'"
fromegame
Pardon? Confused
Diablosblizz
I think what s/he means is that try to do a php code that replaces "\" with a space. Lol, I got your e-mail this moring, I saw your error, its weird.. don't ask for php codding cause I don't have any idea on how to do this..
fromegame
Diablosblizz wrote:
I think what s/he means is that try to do a php code that replaces "\" with a space. Lol, I got your e-mail this moring, I saw your error, its weird.. don't ask for php codding cause I don't have any idea on how to do this..


Oh you're the guy from my game, lol Laughing

Well, someone knows the code to do this Question
Diablosblizz
No offence but I don't get your game.. and when I try to "CHANGE" my IP it doesn't allow me, it does it automaticly, and the "CLICK HERE TO GO BACK" is in white and you cannot see it. I justed signed up for the fun of it! But I love your design.. its classic!
fromegame
Diablosblizz wrote:
No offence but I don't get your game.. and when I try to "CHANGE" my IP it doesn't allow me, it does it automaticly, and the "CLICK HERE TO GO BACK" is in white and you cannot see it. I justed signed up for the fun of it! But I love your design.. its classic!


1. No it's a random IP changer.
2. Yes it is in white, but the background is darkgray, so you should be able to see it Wink
3. Thanks for the compliment.
4. On-Topic!
Diablosblizz
Quote:
Yes it is in white, but the background is darkgray, so you should be able to see it


Not for IE7 its white.

and sorry I don't know how to fix this problem..
fromegame
Diablosblizz wrote:
Quote:
Yes it is in white, but the background is darkgray, so you should be able to see it


Not for IE7 its white.

and sorry I don't know how to fix this problem..

Changed it, now it's OK, thanks for the tip Wink

But now ON-TOPIC!!! Anyone knows a solution? Crying or Very sad
sonam
I am not sure what happend because normaly this two lines must remove slashes.

Code:
$subject = stripslashes($_POST["subject"]);
$message = stripslashes($_POST["message"]);


Maybe you can try longer method. Sometime I get positive result with this type of programing.

Code:
$sub = $_POST["subject"];
$mess = $_POST["message"];
$subject = stripslashes($sub);
$message = stripslashes($mess);


Sonam
dotapinoy3480
hey! is your account have SMTP? if your account is disable w. this, then you cant send email... Laughing Laughing
fromegame
dotapinoy3480 wrote:
hey! is your account have SMTP? if your account is disable w. this, then you cant send email... Laughing Laughing


I can send mail, read the first post please Confused

By the way: it works Razz
hexkid
How does the mail arrive when you do
Code:
<?php
$address = 'some@ddress';
$subject = 'some subject';
$body = "I am testing 'single' quotes\n";
$body .= 'and "double" quotes too.';
#headers = 'whatever';
mail($address, $subject, $body/*, $headers*/);
?>
fromegame
fromegame wrote:
dotapinoy3480 wrote:
hey! is your account have SMTP? if your account is disable w. this, then you cant send email... Laughing Laughing


I can send mail, read the first post please Confused

By the way: it works Razz
hexkid
fromegame wrote:
fromegame wrote:
By the way: it works Razz

What works?

The stripslashes() or the sending of mail?
I answered based on the assumption that sending mail "works", but if stripslashes() also "works" your first post no longer makes sense Confused
fromegame
hexkid wrote:
fromegame wrote:
fromegame wrote:
By the way: it works Razz

What works?

The stripslashes() or the sending of mail?
I answered based on the assumption that sending mail "works", but if stripslashes() also "works" your first post no longer makes sense Confused

No, Sonam helped me Rolling Eyes
Alie
Let's change filters in your code:
Instead of:
Code:
$subject = stripslashes($_POST["subject"]);

$message = stripslashes($_POST["message"]);

Enter:
Code:
$subject = strip_tags($_POST["subject"]);

$message = strip_tags($_POST["message"]);

$subject = filter($_POST["subject"], nohtml);

$message = filter($_POST["message"], nohtml);
Related topics
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.