[PHP] slashes added before '

2002-09-25 Thread Khalid El-Kary

this code snippet:

function save($file)
{
   $my_file=fopen($file,wb);
   $my_status=fwrite($my_file,$text);
   fclose($my_file);
}

is intended to overwrite a file or create a file and write to it from a 
string that's already containing text.

the problem is the after the script writes the file i find \ before all 
single and double qoutes in the whole file

this problem occured on red hat linux but in windows it didn't happen.

can any one help?

khalid


_
Send and receive Hotmail on your mobile device: http://mobile.msn.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] slashes added before '

2002-09-25 Thread John Holmes

Use stripslashes() on the text before you write it to the file. Where is
this text coming from? The slashes are probably getting added by
magic_quotes.

---John Holmes...

 -Original Message-
 From: Khalid El-Kary [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, September 25, 2002 8:08 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] slashes added before '
 
 this code snippet:
 
 function save($file)
 {
$my_file=fopen($file,wb);
$my_status=fwrite($my_file,$text);
fclose($my_file);
 }
 
 is intended to overwrite a file or create a file and write to it from
a
 string that's already containing text.
 
 the problem is the after the script writes the file i find \ before
all
 single and double qoutes in the whole file
 
 this problem occured on red hat linux but in windows it didn't happen.
 
 can any one help?
 
 khalid
 
 
 _
 Send and receive Hotmail on your mobile device: http://mobile.msn.com
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] slashes added before '

2002-09-25 Thread debbie_dyer

You probably have magic_quotes_gpc in php.ini off on your Windows platform
and on on your Linux platform

Magic_quotes_gpc automatically applies addslashes to POST, GET and cookie
data if its on.

Use stripslashes to remove it or to write code thats portable - write a
function like:-

function stripData($data) {
  return ini_get('magic_quotes_gpc') ? stripslashes($data) : $data;
}

Debbie

- Original Message -
From: Khalid El-Kary [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, September 25, 2002 1:07 PM
Subject: [PHP] slashes added before '


 this code snippet:

 function save($file)
 {
$my_file=fopen($file,wb);
$my_status=fwrite($my_file,$text);
fclose($my_file);
 }

 is intended to overwrite a file or create a file and write to it from a
 string that's already containing text.

 the problem is the after the script writes the file i find \ before all
 single and double qoutes in the whole file

 this problem occured on red hat linux but in windows it didn't happen.

 can any one help?

 khalid


 _
 Send and receive Hotmail on your mobile device: http://mobile.msn.com


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php