php-general Digest 24 Jan 2007 00:46:32 -0000 Issue 4586
Topics (messages 247626 through 247652):
Re: preg_match problem
247626 by: Martin Alterisio
247627 by: Roman Neuhauser
247629 by: Paul Novitski
247630 by: Beauford
247635 by: Beauford
247637 by: Jim Lucas
247638 by: Jim Lucas
247639 by: Paul Novitski
creating an api-which protocol do you use?
247628 by: blackwater dev
Re: exec('make') Q
247631 by: james.jwm-art.net
no database selected
247632 by: Ross
247633 by: Dave Goodchild
247634 by: Jay Blanchard
Encoding issue with £
247636 by: Dave Goodchild
247649 by: tedd
Re: JPEG info needed
247640 by: zerof
OT - Leaving
247641 by: John Nichel
247646 by: tg-php.gryffyndevelopment.com
247647 by: Jay Blanchard
247648 by: Robert Cummings
247650 by: tedd
Re: [HELP] Fatal error when uploading large files!
247642 by: Jay Paulson
247643 by: Jay Paulson
To many connections error message
247644 by: Kevin Murphy
247645 by: Pintér Tibor
php installation problem
247651 by: Ross
Re: Encoding issue with £
247652 by: Larry Garfield
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
php-general@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
2007/1/22, Beauford <[EMAIL PROTECTED]>:
... much blah blah blah ...
I've probably read 100 pages on this, and no matter what I try it doesn't
work. Including all of what you suggested above - is my PHP possessed?
if(preg_match("/[EMAIL PROTECTED]&()*;:_.'/\\ ]+$/", $string)) { gives me
this error.
Warning: preg_match() [function.preg-match]: Unknown modifier '\' in
/constants.php on line 107
So if If you wouldn't mind, could you show me exactly what I need right
from
the beginning and explain why it works.
i.e.
if(preg_match(what goes here", $string)) {
Echo "You got it";
if (preg_match('/[EMAIL PROTECTED]&()*;:_.'\\/\\\\ ]+$/', $string))
Use single quotes and double back-slashes. PHP strings also have escape
sequences that use the back-slash as escape character, that's why you have
to double them. And single quotes to avoid the $ character interpreted as
the start of a variable.
PS: Will we be risking going the perl way if we ask that PHP supported
regular expressions natively (I mean: without having to provide them as
strings)?
--- End Message ---
--- Begin Message ---
# [EMAIL PROTECTED] / 2007-01-23 09:52:17 -0300:
> 2007/1/22, Beauford <[EMAIL PROTECTED]>:
> PS: Will we be risking going the perl way if we ask that PHP supported
> regular expressions natively (I mean: without having to provide them as
> strings)?
Yes. I don't know about other people's objections (I have no problem
with the look and feel of "naked" regular expressions, but the parser
would get a bit hairier. I mean, parsers.
--
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man. You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991
--- End Message ---
--- Begin Message ---
At 1/23/2007 04:52 AM, Martin Alterisio wrote:
if (preg_match('/[EMAIL PROTECTED]&()*;:_.'\\/\\\\ ]+$/', $string))
Close but no cigar. Because you're using apostrophe to quote the
expression, PHP interprets the apostrophe inside the character class
as ending the quoted expressions and fails. Both PHP and PREG need
you to escape any character inside a string that's used to delimit
the string itself.
(I think it's just as important to test the code we offer to solve
problems on the list as it is to research problems before posting
them. This is all getting archived....)
Regards,
Paul
__________________________
Juniper Webcraft Ltd.
http://juniperwebcraft.com
--- End Message ---
--- Begin Message ---
> if (preg_match('/[EMAIL PROTECTED]&()*;:_.'\\/\\\\ ]+$/', $string))
>
> Use single quotes and double back-slashes. PHP strings also
> have escape sequences that use the back-slash as escape
> character, that's why you have to double them. And single
> quotes to avoid the $ character interpreted as the start of a
> variable.
>
> PS: Will we be risking going the perl way if we ask that PHP
> supported regular expressions natively (I mean: without
> having to provide them as strings)?
I have tried all the examples posted in the last couple of days, and none of
them, including the above work. Is there another solution to this, as this
just seems to be way to buggy?
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in
/constants.php on line 107
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in
//constants.php on line 107
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in
/constants.php on line 107
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in
/constants.php on line 107
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in
//constants.php on line 107
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in
//constants.php on line 107
Parse error: syntax error, unexpected ']' in //constants.php on line 107
--- End Message ---
--- Begin Message ---
> You need to escape that forward slash in the character class:
>
> preg_match("/[EMAIL PROTECTED]&()*;:_.'\/
>
> Also, you've got only two backslashes in your char class. PHP is
> reducing this to a single backslash before the space character. I
> think you intend this to be two backslashes in the pattern so you
> need four backslashes in PHP:
>
> preg_match("/[EMAIL PROTECTED]&()*;:_.'\/\\\\ ]+$/", $string)
>
On top of this, every time a ' is entered it gets preceded by \. If I just
check for the characters like below that doesn't happen. Totally confused.
if(preg_match("/^[-A-Za-z0-9_.' ]+$/", $string)) {
--- End Message ---
--- Begin Message ---
if (preg_match('/[EMAIL PROTECTED]&()*;:_.'\\/\\\\ ]+$/', $string))
Here is my rendition of what I think you are looking for.
$str = 'tab( )/space( )/[EMAIL PROTECTED]&*();:...';
if ( preg_match('|[EMAIL PROTECTED]&*();:_.\\\\ /\t-]+$|', $str) ) {
echo 'success';
} else {
echo 'failure';
}
--
Enjoy,
Jim Lucas
Different eyes see different things. Different hearts beat on different
strings. But there are times for you and me when all such things agree.
- Rush
--- End Message ---
--- Begin Message ---
Beauford wrote:
You need to escape that forward slash in the character class:
preg_match("/[EMAIL PROTECTED]&()*;:_.'\/
Also, you've got only two backslashes in your char class. PHP is
reducing this to a single backslash before the space character. I
think you intend this to be two backslashes in the pattern so you
need four backslashes in PHP:
preg_match("/[EMAIL PROTECTED]&()*;:_.'\/\\\\ ]+$/", $string)
On top of this, every time a ' is entered it gets preceded by \. If I just
check for the characters like below that doesn't happen. Totally confused.
if(preg_match("/^[-A-Za-z0-9_.' ]+$/", $string)) {
check out magic_quote_gpc??
use the funciton "get_magic_quotes_gpc()" to determine if it is on and
run stripslashes() on the value if you find that it is on.
--
Enjoy,
Jim Lucas
Different eyes see different things. Different hearts beat on different
strings. But there are times for you and me when all such things agree.
- Rush
--- End Message ---
--- Begin Message ---
At 1/23/2007 09:50 AM, Beauford wrote:
> preg_match("/[EMAIL PROTECTED]&()*;:_.'\/\\\\ ]+$/", $string)
>
On top of this, every time a ' is entered it gets preceded by \. If I just
check for the characters like below that doesn't happen. Totally confused.
if(preg_match("/^[-A-Za-z0-9_.' ]+$/", $string)) {
You don't need to escape the apostrophe if the pattern isn't quoted
with apostrophes in PHP or delimited by apostrophes in the PREG
pattern. But generally there's no harm in escaping characters
unnecessarily; it just makes for messier code.
Here is a simple test of the regexp I recommended yesterday using the pattern:
"/[EMAIL PROTECTED]&()*;:_.'\/\\\\ ]+$/"
http://juniperwebcraft.com/test/regexp_test_2007-01-23.php
If you're still having trouble getting this to work, please post a
link to a page that demonstrates it not working and give us the
complete PHP statements so we can find your error.
As an additional resource, here's Oliver Steele's RegExp workbench:
http://osteele.com/tools/rework/
Regards,
Paul
__________________________
Juniper Webcraft Ltd.
http://juniperwebcraft.com
--- End Message ---
--- Begin Message ---
I need to create some webservices for our web app and am really torn as to
which route to go...SOAP, XML_RPC, etc.? I like the looks of REST but many
of our partners that will be using our services use cold fusion and I think
that has build in SOAP support.
Which protocol would you use?
Thanks!
--- End Message ---
--- Begin Message ---
Roman,
On 23/1/2007, "Roman Neuhauser" <[EMAIL PROTECTED]> wrote:
>> KEYLIST := keylist.txt
>> DEPS := $(wildcard *.txt)
>> FILES := *.txt
>>
>> $(KEYLIST): $(DEPS)
>> grep ^keywords $(FILES) > $@
>
>Why is it so roundabout about $(DEPS)/$(FILES)? The target *actuall*
>depends on different files than those declared in the sources list!
>What does $(DEPS) (and $(FILES)) contain?
>This is what your Makefile does, BTW:
> grep ^keywords keylist.txt ... > keylist.txt
Sorry my fault, I decided to change the filename extensions of DEPS+FILES
to *.txt before posting without noticing they became same as KEYLIST.
$(DEPS) !== $(FILES) as wanted pass '*.txt' to grep rather than every
individual filename.
>Try it with this instead (rename keylist.txt to key.list), but make sure
>you have at least one file ending in .txt in that directory first!):
>
>KEYLIST := key.list
>FILES := $(wildcard *.txt)
>
>$(KEYLIST): $(FILES) ; grep '^keywords' $^ > $@
Ok, tried that, still same problem. it works running make from
commandline, but not from PHP using exec, or shell_exec, or system.
It's the redirection which does not work for some reason. I'm
temporarily displaying output in PHP from make, so can see that
grep is grepping, but not redirecting to the target.
Cheers,
James.
--- End Message ---
--- Begin Message ---
I am using this to connect remotely but I get a no database selected error.
The table is contacts but there is not a parameter for database name
according to the documentation. How do I delect my database when conencting
this way?
$link = mysql_connect('xxxx.org:3306', 'my_username', 'mypass');
echo 'Connected successfully';
$query = "SELECT * FROM contacts";
--- End Message ---
--- Begin Message ---
mysql_select_db
--- End Message ---
--- Begin Message ---
[snip]
I am using this to connect remotely but I get a no database selected
error.
The table is contacts but there is not a parameter for database name
according to the documentation. How do I delect my database when
conencting
this way?
[/snip]
http://us3.php.net/manual/en/function.mysql-select-db.php
--- End Message ---
--- Begin Message ---
This may be more of a mysql issue, but I am using php for my app so here
goes...
I have a fee field in the database, and when users post events they can
specify entrance fee in £. In some, not all, of the fields I am getting, for
example, £7 rather than £. Is this an encoding issue?
Many thanks in advance...
--
http://www.web-buddha.co.uk
--- End Message ---
--- Begin Message ---
At 5:55 PM +0000 1/23/07, Dave Goodchild wrote:
This may be more of a mysql issue, but I am using php for my app so here
goes...
I have a fee field in the database, and when users post events they can
specify entrance fee in £. In some, not all, of the fields I am getting, for
example, £7 rather than £. Is this an encoding issue?
My guess is that it is. There are difference
between browsers, OS's, and thus support for
multilingual code-points. Not all allow the user
to submit those types of characters and worse
yet, some allow to them to be submitted
incorrectly.
As such, if it were me and I wanted a form for
the end user to indicate what currency s/her was
entering, I would make it a selection control of
some type and thereby control the user's input.
My $0.02.
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
Gerry D escreveu:
I need PHP to find out if a jpeg file uses progressive encoding. None
of the standard exif or image functions seem to be able to tell me
that. (please correct me if I'm wrong)
Can anybody help me?
TIA
Gerry
http://www.jpeg.org/
--
zerof
http://www.educar.pro.br/
Apache - PHP - MySQL - Boolean Logics - Project Management
----------------------------------------------------------
Você deve, sempre, consultar uma segunda opião!
----------------------------------------------------------
You must hear, always, one second opinion! In all cases.
----------------------------------------------------------
--- End Message ---
--- Begin Message ---
Howdy ladies and gents:
For the past 9 or so years, with one email account or another, I have
been subscribed to the PHP General Mailing List. Well, life an work
have succeeded in taking up all of my time, and the only thing I've been
able to do with this list over the past year or so is select all the
unread messages in my php folder, and hit the delete key. If I've
posted 10 messages over the past year, I'd be surprised (probably why
you n00bs are saying to yourself, "who the hell is this guy"). I'm just
popping in now to let y'all know that I'm off to join people like John
and Jason in the world of, "what ever happened to him". For those of
you who give a damn ;) I can be reached at numerous email addresses,
including:
john <at> nichel <dot> net
jnichel <at> by-tor <dot> com
As well as the other in this email (which have already been harvested by
a billion spam bots).
Have fun, and I'll see ya on the other side.
--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
Best wishes John! We'll hold the fort and keep fighting the good fight in your
absence. :)
Good luck to ya!
-TG
= = = Original message = = =
Howdy ladies and gents:
For the past 9 or so years, with one email account or another, I have
been subscribed to the PHP General Mailing List. Well, life an work
have succeeded in taking up all of my time, and the only thing I've been
able to do with this list over the past year or so is select all the
unread messages in my php folder, and hit the delete key. If I've
posted 10 messages over the past year, I'd be surprised (probably why
you n00bs are saying to yourself, "who the hell is this guy"). I'm just
popping in now to let y'all know that I'm off to join people like John
and Jason in the world of, "what ever happened to him". For those of
you who give a damn ;) I can be reached at numerous email addresses,
including:
john <at> nichel <dot> net
jnichel <at> by-tor <dot> com
As well as the other in this email (which have already been harvested by
a billion spam bots).
Have fun, and I'll see ya on the other side.
--
John C. Nichel IV
Programmer/System Admin (~berGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]
___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.
--- End Message ---
--- Begin Message ---
[snip]
...damned sappy stuff...
[/snip]
Later gator, we're going to miss your pseudo-Cajun self!
--- End Message ---
--- Begin Message ---
Who's John Nichel?
;)
FYI, for the noobs, the John and Jason referenced in the email are John
Holmes and Jason Wong.
Cheers,
Rob.
On Tue, 2007-01-23 at 14:45 -0500, John Nichel wrote:
> Howdy ladies and gents:
>
> For the past 9 or so years, with one email account or another, I have
> been subscribed to the PHP General Mailing List. Well, life an work
> have succeeded in taking up all of my time, and the only thing I've been
> able to do with this list over the past year or so is select all the
> unread messages in my php folder, and hit the delete key. If I've
> posted 10 messages over the past year, I'd be surprised (probably why
> you n00bs are saying to yourself, "who the hell is this guy"). I'm just
> popping in now to let y'all know that I'm off to join people like John
> and Jason in the world of, "what ever happened to him". For those of
> you who give a damn ;) I can be reached at numerous email addresses,
> including:
>
> john <at> nichel <dot> net
> jnichel <at> by-tor <dot> com
>
> As well as the other in this email (which have already been harvested by
> a billion spam bots).
>
> Have fun, and I'll see ya on the other side.
>
> --
> John C. Nichel IV
> Programmer/System Admin (ÜberGeek)
> Dot Com Holdings of Buffalo
> 716.856.9675
> [EMAIL PROTECTED]
>
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
--- End Message ---
--- Begin Message ---
At 2:45 PM -0500 1/23/07, John Nichel wrote:
Howdy ladies and gents:
For the past 9 or so years, with one email account or another, I
have been subscribed to the PHP General Mailing List. Well, life an
work have succeeded in taking up all of my time, and the only thing
I've been able to do with this list over the past year or so is
select all the unread messages in my php folder, and hit the delete
key. If I've posted 10 messages over the past year, I'd be
surprised (probably why you n00bs are saying to yourself, "who the
hell is this guy"). I'm just popping in now to let y'all know that
I'm off to join people like John and Jason in the world of, "what
ever happened to him". For those of you who give a damn ;) I can
be reached at numerous email addresses, including:
john <at> nichel <dot> net
jnichel <at> by-tor <dot> com
As well as the other in this email (which have already been
harvested by a billion spam bots).
Have fun, and I'll see ya on the other side.
--
John C. Nichel IV
John:
Does this mean that I'm out of your kill file now? :-)
Take care and I hope everything goes well for you.
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
>> Hi everyone,
>>
>> Hopefully you all can help! I¹m at a loss as to what to do next. I¹m
>> running PHP 5.1.2 with Apache 2.0.55 on RedHat ES4 and I keep getting the
>> following PHP error when trying to upload a larger file. I have
>> AllowOverride turned on in the httpd.conf file so my .htaccess file is below
>> as well. When I look at phpinfo() it reflects the changes in the .htaccess
>> file but yet still I get the following PHP fatal error. Anyone have any
>> ideas what could be going on? Could it be the Zend Memory Manager
>> (something that I know nothing about)? Or anything else I may not be aware
>> of?
>>
>> Any help would be greatly appreciated!
>>
>>
>> Fatal error: Allowed memory size of 20971520 bytes exhausted (tried to
>> allocate 19590657 bytes) in /path/to/php/file on line 979
>>
>> LimitRequestBody 0
>> php_value memory_limit 40M
>> php_value post_max_size 30M
>> php_value upload_max_filesize 30M
>> php_value display_errors On
>> php_value max_execution_time 300
>> php_value max_input_time 300
>>
>
> doesn't seem to me that it is following the directives for memory size
>
> OR or you are up against a 20mb disk quota possibly???
How would I check to see if I'm up against a 20md disk quota?
Thanks.
--- End Message ---
--- Begin Message ---
>> Hi everyone,
>>
>> Hopefully you all can help! I¹m at a loss as to what to do next. I¹m
>> running PHP 5.1.2 with Apache 2.0.55 on RedHat ES4 and I keep getting the
>> following PHP error when trying to upload a larger file. I have
>> AllowOverride turned on in the httpd.conf file so my .htaccess file is below
>> as well. When I look at phpinfo() it reflects the changes in the .htaccess
>> file but yet still I get the following PHP fatal error. Anyone have any
>> ideas what could be going on? Could it be the Zend Memory Manager
>> (something that I know nothing about)? Or anything else I may not be aware
>> of?
>>
>> Any help would be greatly appreciated!
>>
>>
>> Fatal error: Allowed memory size of 20971520 bytes exhausted (tried to
>> allocate 19590657 bytes) in /path/to/php/file on line 979
>>
>> LimitRequestBody 0
>> php_value memory_limit 40M
>> php_value post_max_size 30M
>> php_value upload_max_filesize 30M
>> php_value display_errors On
>> php_value max_execution_time 300
>> php_value max_input_time 300
>
> php_value can't overrule a php_admin_value (your apache conf or another
> .htaccess
> maybe setting these ini settings usiong php_admin_value).
>
> check that the php ini settings you've got in your .htaccess are
> actually being honored:
>
> foreach (array('memory_limit','post_max_size','upload_max_filesize') as $ini)
> echo ini_get($ini),'<br />';
>
I ran the foreach like you have and the values came back with the ones I'm
using in my .htaccess file.
I couldn't find any occurrences of php_admin_value used any where. Hm.
Thanks!
--- End Message ---
--- Begin Message ---
I'm working with my host to resolve why I am getting these error
messages, but in the meantime, I am getting this message on the website:
Warning: mysql_connect(): Too many connections in /path/number/user/
code/connect.php on line 10
Sorry: Could not connect to database. Please contact the webmaster at
[EMAIL PROTECTED]
Where my connection code is:
$con = mysql_connect($host, $dbuser, $pw)
or die("Sorry: Could not connect to database. Please contact the
webmaster at [EMAIL PROTECTED]");
@mysql_select_db($db,$con);
The questions is, since I don't have error reporting turned on, why
am I getting an error message that includes the complete path to my
connect script.... something I would like to not be telling the
general public? Is there a way to suppress that?
--
Kevin Murphy
Webmaster: Information and Marketing Services
Western Nevada Community College
www.wncc.edu
775-445-3326
--- End Message ---
--- Begin Message ---
@, or ask your hoster to disable display_errors
t
The questions is, since I don't have error reporting turned on, why am
I getting an error message that includes the complete path to my
connect script.... something I would like to not be telling the
general public? Is there a way to suppress that?
--- End Message ---
--- Begin Message ---
Just installed apache and am looking at an error
Warning: session_start() [function.session-start]:
open(C:\DOCUME~1\Ross\LOCALS~1\Temp\php\upload\sess_ob822kp9sqlndjvu089r845e50,
O_RDWR) failed: No such file or directory (2) in
C:\Apache\Apache2\htdocs\ssn\editor.php on line 4
Should I set up a local folder to save the session data or something. Do I
set this up in the php.ini or apache config?
R.
--- End Message ---
--- Begin Message ---
On Tuesday 23 January 2007 11:55 am, Dave Goodchild wrote:
> This may be more of a mysql issue, but I am using php for my app so here
> goes...
>
> I have a fee field in the database, and when users post events they can
> specify entrance fee in £. In some, not all, of the fields I am getting,
> for example, £7 rather than £. Is this an encoding issue?
>
> Many thanks in advance...
Yep, sounds like encoding to me. This article talks more about smart quotes
than the £ sign, but the recommendation applies for that as well.
http://www.garfieldtech.com/blog/stupid-quotes
--
Larry Garfield AIM: LOLG42
[EMAIL PROTECTED] ICQ: 6817012
"If nature has made any one thing less susceptible than all others of
exclusive property, it is the action of the thinking power called an idea,
which an individual may exclusively possess as long as he keeps it to
himself; but the moment it is divulged, it forces itself into the possession
of every one, and the receiver cannot dispossess himself of it." -- Thomas
Jefferson
--- End Message ---