Re: [PHP] fread question

2008-12-18 Thread MikeP
From my phpinfo:
  magic_quotes_runtime Off

Robert Cummings rob...@interjinn.com wrote in message 
news:1229567238.8302.35.ca...@localhost...
 On Wed, 2008-12-17 at 19:54 -0500, MikeP wrote:
 Hello,
 I have been trying to use fread to open a file, but it always escapes
 special characters.
 How do I open  afile without it modifying my original file:

 $_POST[$fname] = fread($fileHandle, $_POST[$fname.'_size']);
 I use this and get slashes everywhere.This kills my REGex that gets coded
 next.

 Check this magically shitty setting in your php.ini:

magic_quotes_runtime

 It should be off unless someone with less brains than a turd got a hold
 of your ini file.

 Cheers,
 Rob.
 -- 
 http://www.interjinn.com
 Application and Templating Framework for PHP
 



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



Re: [PHP] fread question

2008-12-18 Thread MikeP
But this one is ON
magic_quotes_gpc
Robert Cummings rob...@interjinn.com wrote in message 
news:1229567238.8302.35.ca...@localhost...
 On Wed, 2008-12-17 at 19:54 -0500, MikeP wrote:
 Hello,
 I have been trying to use fread to open a file, but it always escapes
 special characters.
 How do I open  afile without it modifying my original file:

 $_POST[$fname] = fread($fileHandle, $_POST[$fname.'_size']);
 I use this and get slashes everywhere.This kills my REGex that gets coded
 next.

 Check this magically shitty setting in your php.ini:

magic_quotes_runtime

 It should be off unless someone with less brains than a turd got a hold
 of your ini file.

 Cheers,
 Rob.
 -- 
 http://www.interjinn.com
 Application and Templating Framework for PHP
 



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



Re: [PHP] fread question

2008-12-18 Thread MikeP
Still having problems:
magic_quotes_runtime is off
BUT
magic_quotes_gpc is on
I cant change them myself so I tried
stripslashes
That doesnt work though:

$_POST[$fname] = fread($fileHandle, $_POST[$fname.'_size']);
$test=$_POST[$fname];
$test3=stripslashes($test);

$test3 and $test are the same.

Any other Ideas?

Thanks
mike



Robert Cummings rob...@interjinn.com wrote in message 
news:1229567238.8302.35.ca...@localhost...
 On Wed, 2008-12-17 at 19:54 -0500, MikeP wrote:
 Hello,
 I have been trying to use fread to open a file, but it always escapes
 special characters.
 How do I open  afile without it modifying my original file:

 $_POST[$fname] = fread($fileHandle, $_POST[$fname.'_size']);
 I use this and get slashes everywhere.This kills my REGex that gets coded
 next.

 Check this magically shitty setting in your php.ini:

magic_quotes_runtime

 It should be off unless someone with less brains than a turd got a hold
 of your ini file.

 Cheers,
 Rob.
 -- 
 http://www.interjinn.com
 Application and Templating Framework for PHP
 



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



RE: [PHP] fread question

2008-12-18 Thread Boyd, Todd M.
 -Original Message-
 From: MikeP [mailto:mpel...@princeton.edu]
 Sent: Thursday, December 18, 2008 7:33 AM
 To: php-general@lists.php.net
 Subject: Re: [PHP] fread question
 
 Still having problems:
 magic_quotes_runtime is off
 BUT
 magic_quotes_gpc is on
 I cant change them myself so I tried
 stripslashes
 That doesnt work though:
 
 $_POST[$fname] = fread($fileHandle, $_POST[$fname.'_size']);
 $test=$_POST[$fname];
 $test3=stripslashes($test);
 
 $test3 and $test are the same.
 
 Any other Ideas?
 
 Robert Cummings rob...@interjinn.com wrote in message
 news:1229567238.8302.35.ca...@localhost...
  On Wed, 2008-12-17 at 19:54 -0500, MikeP wrote:
  Hello,
  I have been trying to use fread to open a file, but it always
 escapes
  special characters.
  How do I open  afile without it modifying my original file:
 
  $_POST[$fname] = fread($fileHandle, $_POST[$fname.'_size']);
  I use this and get slashes everywhere.This kills my REGex that gets
 coded
  next.
 
  Check this magically shitty setting in your php.ini:
 
 magic_quotes_runtime
 
  It should be off unless someone with less brains than a turd got a
 hold
  of your ini file.

The PHP site's page on ini_set() [1] talks a bit about how to set that
particular option in an .htaccess file:

set PHP_INI_PERDIR settings in a .htaccess file with 'php_flag'
like this:

php_flag register_globals off
php_flag magic_quotes_gpc on

If you can get at your .htaccess, maybe you could do it that way (since
I don't believe you can change magic_quotes_gpc using ini_set() or
similar methods).

HTH,


// Todd

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



RE: [PHP] fread question

2008-12-18 Thread Boyd, Todd M.
Hah! Forgot to add the link:

1. http://php.net/ini_set

How would you guys have ever figured out that was the page on PHP's
website you need to visit in order to view information about the
ini_set() function?!

;)


// Todd

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



Re: [PHP] fread question

2008-12-18 Thread ceo

PHP does *not* do the addslashes on $_POST when you cram something into it in 
your PHP code.



It does it during the process of auto-filling up $_POST.



So either:

A) you have magic_quotes_runtime turned on LOCALLY. Use phpinfo() to see.

B) you actually managed to put the backslashes into your text file.



PS

You really shouldn't be cramming data into $_POST, imho.

Too confusing for later development/maintenance.

$_POST should be read only

Copy the parts of $_POST you want into something else, and add in your file 
contents as well.



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



Re: [PHP] fread question

2008-12-18 Thread MikeP
 you have magic_quotes_runtime turned on LOCALLY. Use phpinfo() to see.
NOmagic_quotes_runtime Off

 you actually managed to put the backslashes into your text file.
NO
tdinput name=letter type=file id=letter size=50 maxlength=255 
/
.
.
.
.
?php
process_uploaded_file('letter');
function process_uploaded_file($fname) {
// Assumes set of $_POST variables in the form: name, name_fname, 
name_size, name_type
$_POST[$fname.'_fname'] = $_FILES[$fname]['name'];
$_POST[$fname.'_size'] = $_FILES[$fname]['size'];
$_POST[$fname.'_type'] = $_FILES[$fname]['type'];
$_POST[$fname.'_fname'] = strtr($_POST[$fname.'_fname'],' 
%*;:{}[]|\,/()%...@!',''); //fix special chars in 
name
$_POST[$fname.'_fname'] = strtr($_POST[$fname.'_fname'],',_);
$fileHandle = fopen($_FILES[$fname]['tmp_name'], r);
$_POST[$fname] =stripslashes(fread($fileHandle, 
$_POST[$fname.'_size']));


Neither

c...@l-i-e.com wrote in message 
news:20081218155854.69674.qm...@o2.hostbaby.com...

 PHP does *not* do the addslashes on $_POST when you cram something into it 
 in your PHP code.

 It does it during the process of auto-filling up $_POST.

 So either:
 A) you have magic_quotes_runtime turned on LOCALLY. Use phpinfo() to see.
 B) you actually managed to put the backslashes into your text file.

 PS
 You really shouldn't be cramming data into $_POST, imho.
 Too confusing for later development/maintenance.
 $_POST should be read only
 Copy the parts of $_POST you want into something else, and add in your 
 file contents as well.
 



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



Re: [PHP] fread question

2008-12-17 Thread Robert Cummings
On Wed, 2008-12-17 at 19:54 -0500, MikeP wrote:
 Hello,
 I have been trying to use fread to open a file, but it always escapes 
 special characters.
 How do I open  afile without it modifying my original file:
 
 $_POST[$fname] = fread($fileHandle, $_POST[$fname.'_size']);
 I use this and get slashes everywhere.This kills my REGex that gets coded 
 next.

Check this magically shitty setting in your php.ini:

magic_quotes_runtime

It should be off unless someone with less brains than a turd got a hold
of your ini file.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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