Re: [PHP] Is it possible to disable eval()?

2007-08-16 Thread Steffen Ebermann
On Thu, Aug 16, 2007 at 09:50:30PM +0800, hshh wrote:
 I try to disable eval() function in php script, but
 failed. In php.ini disable_functions=eval is not work, 
 but other functions.
 So, is it possible to disable eval()? Thanks.

It don't work because eval() isn't a function.

The Suhosin protection system would let you do so. If an
option:
http://www.hardened-php.net/suhosin/configuration.html#suhosin.executor.disable_eval

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



Re: [PHP] Move and rename help...

2007-08-08 Thread Steffen Ebermann
On Wed, Aug 08, 2007 at 11:39:20PM +0100, Joker7 wrote:
 Can anyone give me some pointer,here's my problem.I wish 
 to move a file from a local server to a remote one.The file 
 is in the format ([EMAIL PROTECTED]) on moving the 
 file to the remote server I wish to remove the time stamp 
 part of the file and just leave ( video.jpg ). To be trueful 
 I don't have a clue where to start I did a bit of Google-ing 
 to see if I could find a ready made script with out luck.So 
 any help will be most welcome.

If the filename is never going to contain any number or @ you
cold use

  ?php
  $dirt = array (0,1,2,3,4,5,6,7,8,9,@);
  $wash = str_replace($dirt, null, $filename);
  ?

otherwise

  ?php
  $wash = preg_replace('/([EMAIL PROTECTED])@[^.]*(.+)/', \\1\\2, $filename);
  ?

Regards
  Steffen

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



Re: [PHP] [pcre] backreferences to all matches of a repeated subexpression

2007-08-02 Thread Steffen Ebermann
On Wed, Aug 01, 2007 at 08:05:09PM -0700, Jack Bates wrote:
 I'm not sure how to get an array of all subexpression matches, in the
 order matches appear in the subject, instead of the order expressions
 appear in the pattern.

This problem gave me a headache. My only idea is to use preg_split()
instead.

  ?php
  $foo = preg_split('/\[(.*)\]+|\./U',
 foo.bar[ab.cd].baz,
 -1,
 PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);

  var_dump($foo);
  ?

Seems to work as intended. Hope I could help.

Regards
  Steffen

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



Re: [PHP] registered globals on localhost (apache)

2007-02-22 Thread Steffen Ebermann

On Thu, Feb 22, 2007 at 01:40:53PM -, Ross wrote:
 I have my RG's switched off in my local .ini but I am tinkering about with 
 oscommerce.
 
 php_value register_globals on
 
 I tried to change add this line to the .htaccess file in the catalog folder 
 but still gives the error
 
 
 Server Requirement Error: register_globals is disabled in your PHP 
 configuration. This can be enabled in your php.ini configuration file or in 
 the .htaccess file in your catalog directory.
 
 
 Can I change the RG settings in tis way on my localhost?


http://php.net/manual/en/ini.php#ini.list
Below you can find a table explaining the PHP_INI_*-values.

Also you should use php_flag to set a boolean configuration directive.
http://php.net/manual/en/configuration.changes.php#configuration.changes.apache

-- 
Steffen

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



Re: [PHP] LOL, preg_match still not working.

2007-02-17 Thread Steffen Ebermann
As far as I tested, the regular expression works how it is
intended to work.

Maybe this a touch easier to read line do it for you:

  elseif (preg_match('|[EMAIL PROTECTED]*();:_. /\t-]|', $comment))



On Sat, Feb 17, 2007 at 09:27:59AM -0500, Beauford wrote:
 Hi,
 
 I previously had some issues with preg_match and many of you tried to help,
 but the same  problem still exists. Here it is again, if anyone can explain
 to me how to get this to work it would be great - otherwise I'll just remove
 it as I just spent way to much time on this.
 
 Thanks
 
 Here's the code.
 
   if(empty($comment)) { $formerror['comment'] = nocomments; 
   }
   elseif(!preg_match('|[EMAIL PROTECTED]*();:_. /\t-]+$|',
 $comment)) {
   $formerror['comment'] = invalidchars;
   }   
 
 This produces an error, which I believe it should not.
 
 Testing 12345. This is a test of the emergency broadcast system.
 
 WAKE UP!!
 
 -- 
 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] LOL, preg_match still not working.

2007-02-17 Thread Steffen Ebermann
Addendum: I encountered a problem when the string contains linebreaks. Maybe
adding \n\r into the brackets fixes your problem.


On Sat, Feb 17, 2007 at 09:27:59AM -0500, Beauford wrote:
 Hi,
 
 I previously had some issues with preg_match and many of you tried to help,
 but the same  problem still exists. Here it is again, if anyone can explain
 to me how to get this to work it would be great - otherwise I'll just remove
 it as I just spent way to much time on this.
 
 Thanks
 
 Here's the code.
 
   if(empty($comment)) { $formerror['comment'] = nocomments; 
   }
   elseif(!preg_match('|[EMAIL PROTECTED]*();:_. /\t-]+$|',
 $comment)) {
   $formerror['comment'] = invalidchars;
   }   
 
 This produces an error, which I believe it should not.
 
 Testing 12345. This is a test of the emergency broadcast system.
 
 WAKE UP!!
 
 -- 
 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] LOL, preg_match still not working.

2007-02-17 Thread Steffen Ebermann
It's 6.2 but PHP 4.4.4.

Basically, I'm not getting any error. The expression just don't match. I
don't know if it should or not.

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



Re: [PHP] what do i need to disable

2007-02-08 Thread Steffen Ebermann
It's more secure to begin with converting the string using 
htmlentities() and reconverting allowed tags afterwards.

See
http://alistapart.com/articles/secureyourcode
http://alistapart.com/articles/secureyourcode2

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



Re: [PHP] what do i need to disable

2007-02-08 Thread Steffen Ebermann
By using something like

  $var = preg_replace(
!lt;(i|b|small|big|code)gt;(.+)lt;/\\1gt;!isU,
\\1\\2/\\1, $var);

you can accomplish a solution where only closed tags 
will be reconverted.

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



Re: [PHP] Regex Mixtake

2007-02-03 Thread Steffen Ebermann
You have to use preg_match_all()

  if (preg_match_all(!\(.+)\!sU, $var, $match))


On Sat, Feb 03, 2007 at 12:36:59PM -0500, Manolet Gmail wrote:
 Hi, i have a problem using regex, i want to get all the text between  
 
 so i try this...
 
 $subject = 'menu Archer?,-,Chief?,L_Menu2,Big Mouth?,L_Menu3;';
 if (ereg('([^]*)', $subject, $regs)) {
   print_r($regs);
 }

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



Re: [PHP] Regex Mixtake

2007-02-03 Thread Steffen Ebermann
I don't know, but http://php.net/manual/en/function.ereg.php says

  Note: preg_match(), which uses a Perl-compatible regular expression
 syntax, is often a faster alternative to ereg().


On Sat, Feb 03, 2007 at 01:58:50PM -0500, Manolet Gmail wrote:
 anyway, PCRE is better that ereg? 

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



Re: [PHP] Regex Mixtake

2007-02-03 Thread Steffen Ebermann
Side note:

  $exp = explode('', $var);
  foreach ($exp as $key = $val) if ($key%2!=0) $arr[] = $val;
  var_dump($arr);

works without regular expressions.

--
Steffen


On Sat, Feb 03, 2007 at 12:36:59PM -0500, Manolet Gmail wrote:
 Hi, i have a problem using regex, i want to get all the text between  
 
 so i try this...
 
 $subject = 'menu Archer?,-,Chief?,L_Menu2,Big Mouth?,L_Menu3;';
 if (ereg('([^]*)', $subject, $regs)) {
   print_r($regs);
 }

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



Re: [PHP] preg_replace();

2007-02-02 Thread Steffen Ebermann
This always works for me:

if (preg_match_all(!\(.+)\!sU, $var, $match))
{
  for ($i=0; $icount($match[0]); $i++)
  {
$old = $match[1][$i];
$new = preg_replace(!\|| !, _, $old);
$var = str_replace(\$old\, \$new\, $var);
  }
}


On Fri, Feb 02, 2007 at 07:30:37PM +0100, Sébastien WENSKE wrote:
 Hi all,
 
 I want replace the | (pipe) and the   (space) chars where are between  
 (double-quotes)  by an underscore _ with the preg_replace(); funtction.
 
 Can someone help me to find the correct regex.
 
 Thanks in advance
 
 Seb

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



Re: [PHP] preg_replace(); [solved]

2007-02-02 Thread Steffen Ebermann
Maybe you just mistyped that, but this would *probably* also match on s=
or bar=, cause [ and ] are metacharacters.

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



Re: [PHP] preg_replace();

2007-02-02 Thread Steffen Ebermann
On Fri, Feb 02, 2007 at 09:01:38PM +0100, Steffen Ebermann wrote:

 $new = preg_replace(!\|| !, _, $old);

Heyha, the mail's subject gone obsolete. preg_replace isn't
necessary at all.

Better use: $new = str_replace(array (|, ), _, $old);

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