|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general Digest 3 Aug 2005 17:00:35 -0000 Issue 3604
php-general-digest-help
lists.php.net
Date: Wed Aug 03 2005 - 12:00:35 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 3 Aug 2005 17:00:35 -0000 Issue 3604
Topics (messages 219881 through 219913):
dl exploit
219881 by: Anas Mughal
Re: Converting integer type to long
219882 by: Torgny Bjers
Re: parent::construct not reliable working on php5.1 b2/b3
219883 by: Meno Abels
219884 by: Jochem Maas
219885 by: Meno Abels
219886 by: Jochem Maas
219887 by: Meno Abels
Everything works...Unless they hit the "back" button...
219888 by: Jack Jackson
219889 by: Mark Rees
219890 by: Jack Jackson
219894 by: Kristen G. Thorson
219896 by: Jack Jackson
Re: AJAX & PHP
219891 by: Miguel Guirao
219910 by: Graham Anderson
219912 by: Mikey
Access and PHP
219892 by: David Wills
219893 by: Rory Browne
219897 by: tg-php.gryffyndevelopment.com
Calculation error - PHP not following math hierarchi ???
219895 by: Rene Brehmer
219902 by: Robin Vickery
219907 by: Kristen G. Thorson
Re: Regex help
219898 by: Marcus Bointon
Regular expressions book
219899 by: Stefan Lemmen
Re: varibles defination]
219900 by: edwardspl.ita.org.mo
Job for SQL or PHP?
219901 by: -k.
219909 by: Kristen G. Thorson
219911 by: -k.
skip a row in foreach loop
219903 by: afan.afan.net
219904 by: John Nichel
219905 by: Chris Boget
219906 by: Stut
219908 by: afan.afan.net
Re: Sessions Issue
219913 by: Tom Ray [Lists]
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
There was a posting on http://us3.php.net/dl dated July 18th regarding the
dl exploit problem. Following the advice in the posting, my shared hosting
service disabled dl on our hosting server. I can't load my custom PHP
extension anymore.
I am wondering if anyone knows about any active development effort to fix
this problem. Please let me know.
Thank you very much.
P.S.
Text of the posting on PHP documentation page for dl:
WARNING: enable_dl/dl()
*********************
There is an exploit circulating currently which takes advantage of dl() to
inject code into Apache which causes all requests to all virtual hosts to be
redirected to a page of the attackers choice.
All operators of shared web hosting servers with Apache and PHP should
disable dl() by setting enable_dl to off otherwise your servers are
vulnerable to this exploit.
This exploit is generally known as flame.so (the object that is loaded into
Apache) and flame.php (the php script that loads it).
--
Anas Mughal
attached mail follows:
Wee Keat wrote:
>The problem is, I have not been able to convert PHP's integer/float type
>to long because there is no function that does it. Or is there?
>
The reason why is because there's no real long support in PHP.
But, since you mention a value such as 0.01, you are not looking for a
long, you are looking for a float. So, what you need to do is to
type-cast all the values involved in the making of the variable that
holds the float value.
For instance:
$var = (float)$var1 / (float)$var2;
$query = sprintf('%.2f %s', (float)$var, $string);
I haven't found the exact points where PHP forgets it's a float, but
it's always good to make sure all mathematical operations are performed
on the value as a float by type-casting, otherwise it might lose
information.
Regards,
Torgny
attached mail follows:
Thanks,
the problem with cut an paste i have not only one of these messages
i get huge amounts of these. So i stripped down to one, sorry my fault.
a) usally 4-6
b) no
c) yes, as I mentioned i tried both (old/new)
d) never tested i jump over 5.0
the problem with the code is currently the problem only occures in the
real application which as about 20000 lines of code. I tried to
stripped down
but there was not success. So I ask about how could i work out an idea
from the php source to find these problem. I'am pretty sure that i done
everything rightly in my application code. It works perfectly with
the old-style and php 4.x
and i converted all to the new style which is easy of course it is
generated
php source code so there is not really a general fault possible. If the
generator works-:)
your questions aren't silly
meno
Am 02.08.2005 um 23:34 schrieb Jochem Maas:
> Meno Abels wrote:
>
>> it is only a typo in my email i use __construct
>>
>
> ok - I would recommend cut-n-paste for this kind of output
> to prevent idiots like me pointing out you typos and to avoid
> confusion
> in general.
>
> the next questions would be:
>
> a, how many parents does the problem class (Link or Links?) have?
> b, is Rank the base class?
> c, does Rank::__construct() actually exist?
> d, does the error also occur with php5.0.x? (as apposed to php5.1beta)
>
> given these questions may seem silly - but I can't see your code from
> here :-) so I figured I'd ask anyway!
>
>
>> Meno
>> 2005/8/2, Jochem Maas <jochem
iamjochem.com>:
>>
>>> Pawel Bernat wrote:
>>>
>>>
>>>> On Tue, Aug 02, 2005 at 03:42:00PM +0100, Meno Abels wrote:
>>>>
>>>>
>>>>
>>>>> Hello,
>>>>>
>>>>> With my application that uses heavily inherent classes,
>>>>> sometimes I
>>>>>
>>>
>>> deeeeep class heirarchies can lead to brainfreeze - beware of
>>> going to deep :-)
>>>
>>>
>>>
>>>>> get the following message:
>>>>> PHP Fatal error: Call to undefined method Rank::_construtor() in
>>>>> .../inc/Links.class.php. It works
>>>>> with php
>>>>> 4.x when I use the old style of constructor calling
>>>>> $this->(CLASSNAME) . But when working with php 5.2 b2 or b3 in
>>>>> the old
>>>>> OR the new style, I get the PHP Fatal error from above.
>>>>> Is there any hints to look at this problem?
>>>>>
>>>>
>>>> Why do you call _construct instead of __construct? And how do
>>>> you do it?
>>>>
>>>
>>> he seems to be calling _construtor() which although not wrong is
>>> not the
>>> method he is looking for (cue voice of Alex Guiness for the
>>> second time this week :-)
>>>
>>> try __construct()
>>>
>>> PS - this kind of thing belongs on generals until you are _sure_
>>> it's an
>>> internals problem. IMHO.
>>>
>>>
>>>
>>>> Did you read everything at http://php.net/construct (including
>>>> Note)?
>>>> What about php 5.0?
>>>>
>>>>
>>>
>>>
>>>
>
>
>
>
--
Meno Abels 20six AG
Office: Home:
2 Lampton Place 21 Clarendon Road,Flat 4
W11 2SH London RH1 1QJ Redhill
UK UK
P: +44 20 7243 4781 P: +44 17 3776 3809
F: +44 20 7243 4762 M: +44 78 7159 9638
attached mail follows:
Meno Abels wrote:
> Thanks,
>
> the problem with cut an paste i have not only one of these messages
> i get huge amounts of these. So i stripped down to one, sorry my fault.
>
> a) usally 4-6
any given class will never have a variable number of parents ;-)
IMHO 6 levels deep is pushing the boat out a bit - but technically it
should be no problem
> b) no
> c) yes, as I mentioned i tried both (old/new)
again it may sound stupid but double check spelling in the file.
also check for weird non-printing chars in the problem file -
> d) never tested i jump over 5.0
5.1 is still beta - test it on 5.0 (consider that the mailing list equivelant
of a military order ;-)
does the problem occur in only 1 baseclass? or in a fixed number of
baseclasses? or is does it occur anywhere/everywhere.
are you trying to reassign $this or are you using the reference token (&)
when passing objects around? (I ask because you seem to indicate that the
codebase is being moved from php4 where such things are almost required to
make usuable OO code - whereas in php5 it's asking for trouble)
pump up error_reporting to full i.e. error_reporting( E_ALL | E_STRICT )
- maybe it will give you a hint.
also you might consider placing a call to debug_print_backtrace() in each
and every constructor to help see wtf is going on.
lastly get a copy of Zend Studio Client/Server and set it up so that you
can do step by step debugging to see _exactly_ what is going on.
I'm running out of ideas here ... I can only suggest now to post code
- and plenty of it - if that is possible, send a link to somewhere rather than
bombard everyone on the list with 1000's of lines of code.
>
> the problem with the code is currently the problem only occures in the
> real application which as about 20000 lines of code. I tried to
> stripped down
> but there was not success. So I ask about how could i work out an idea
> from the php source to find these problem. I'am pretty sure that i done
> everything rightly in my application code. It works perfectly with the
> old-style and php 4.x
> and i converted all to the new style which is easy of course it is
> generated
> php source code so there is not really a general fault possible. If the
> generator works-:)
that last IF is a big one though!
>
> your questions aren't silly
I know that ;-) I was just trying to make sure you didn't feel as if I was
talking down to you :-)
>
> meno
>
> Am 02.08.2005 um 23:34 schrieb Jochem Maas:
>
>> Meno Abels wrote:
>>
>>> it is only a typo in my email i use __construct
>>>
>>
>> ok - I would recommend cut-n-paste for this kind of output
>> to prevent idiots like me pointing out you typos and to avoid confusion
>> in general.
>>
>> the next questions would be:
>>
>> a, how many parents does the problem class (Link or Links?) have?
>> b, is Rank the base class?
>> c, does Rank::__construct() actually exist?
>> d, does the error also occur with php5.0.x? (as apposed to php5.1beta)
>>
>> given these questions may seem silly - but I can't see your code from
>> here :-) so I figured I'd ask anyway!
>>
>>
>>> Meno
>>> 2005/8/2, Jochem Maas <jochem
iamjochem.com>:
>>>
>>>> Pawel Bernat wrote:
>>>>
>>>>
>>>>> On Tue, Aug 02, 2005 at 03:42:00PM +0100, Meno Abels wrote:
>>>>>
>>>>>
>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> With my application that uses heavily inherent classes, sometimes I
>>>>>>
>>>>
>>>> deeeeep class heirarchies can lead to brainfreeze - beware of going
>>>> to deep :-)
>>>>
>>>>
>>>>
>>>>>> get the following message:
>>>>>> PHP Fatal error: Call to undefined method Rank::_construtor() in
>>>>>> .../inc/Links.class.php. It works with php
>>>>>> 4.x when I use the old style of constructor calling
>>>>>> $this->(CLASSNAME) . But when working with php 5.2 b2 or b3 in
>>>>>> the old
>>>>>> OR the new style, I get the PHP Fatal error from above.
>>>>>> Is there any hints to look at this problem?
>>>>>>
>>>>>
>>>>> Why do you call _construct instead of __construct? And how do you
>>>>> do it?
>>>>>
>>>>
>>>> he seems to be calling _construtor() which although not wrong is
>>>> not the
>>>> method he is looking for (cue voice of Alex Guiness for the second
>>>> time this week :-)
>>>>
>>>> try __construct()
>>>>
>>>> PS - this kind of thing belongs on generals until you are _sure_
>>>> it's an
>>>> internals problem. IMHO.
>>>>
>>>>
>>>>
>>>>> Did you read everything at http://php.net/construct (including Note)?
>>>>> What about php 5.0?
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>
>>
>>
>>
>
attached mail follows:
Am 03.08.2005 um 09:22 schrieb Jochem Maas:
> Meno Abels wrote:
>
>> Thanks,
>> the problem with cut an paste i have not only one of these messages
>> i get huge amounts of these. So i stripped down to one, sorry my
>> fault.
>> a) usally 4-6
>>
>
> any given class will never have a variable number of parents ;-)
> IMHO 6 levels deep is pushing the boat out a bit - but technically it
> should be no problem
depends on the application
>
>
>> b) no
>> c) yes, as I mentioned i tried both (old/new)
>>
>
> again it may sound stupid but double check spelling in the file.
> also check for weird non-printing chars in the problem file -
there are is alot of code which works as i mentioned all the code
is generated. The pattern of the working code is not different to the
none working. Also i have some examples where i call the same class
in other scripts and they are working. So there is no write error. Also
the old syntax should work without change and php 4 it works perfect.
>
>
>> d) never tested i jump over 5.0
>>
>
> 5.1 is still beta - test it on 5.0 (consider that the mailing list
> equivelant
> of a military order ;-)
that will take a while to do
>
> does the problem occur in only 1 baseclass? or in a fixed number of
> baseclasses? or is does it occur anywhere/everywhere.
i occurs with a random pattern
>
> are you trying to reassign $this or are you using the reference
> token (&)
> when passing objects around? (I ask because you seem to indicate
> that the
> codebase is being moved from php4 where such things are almost
> required to
> make usuable OO code - whereas in php5 it's asking for trouble)
NO not used!
>
> pump up error_reporting to full i.e. error_reporting( E_ALL |
> E_STRICT )
> - maybe it will give you a hint.
DONE, i see nothing which is seams to be helpfull
>
> also you might consider placing a call to debug_print_backtrace()
> in each
> and every constructor to help see wtf is going on.
i'am not clear what is should help for.
>
> lastly get a copy of Zend Studio Client/Server and set it up so
> that you
> can do step by step debugging to see _exactly_ what is going on.
-:)
>
> I'm running out of ideas here ... I can only suggest now to post code
> - and plenty of it - if that is possible, send a link to somewhere
> rather than
> bombard everyone on the list with 1000's of lines of code.
i will work to strip down you can't run the code without 20 own
written c++/c
extentions.
>
>
>> the problem with the code is currently the problem only occures in
>> the
>> real application which as about 20000 lines of code. I tried to
>> stripped down
>> but there was not success. So I ask about how could i work out an
>> idea
>> from the php source to find these problem. I'am pretty sure that i
>> done
>> everything rightly in my application code. It works perfectly
>> with the old-style and php 4.x
>> and i converted all to the new style which is easy of course it
>> is generated
>> php source code so there is not really a general fault possible.
>> If the
>> generator works-:)
>>
>
> that last IF is a big one though!
>
>
>> your questions aren't silly
>>
>
> I know that ;-) I was just trying to make sure you didn't feel as
> if I was
> talking down to you :-)
you are welcome
>
>
>> meno
>> Am 02.08.2005 um 23:34 schrieb Jochem Maas:
>>
>>> Meno Abels wrote:
>>>
>>>
>>>> it is only a typo in my email i use __construct
>>>>
>>>>
>>>
>>> ok - I would recommend cut-n-paste for this kind of output
>>> to prevent idiots like me pointing out you typos and to avoid
>>> confusion
>>> in general.
>>>
>>> the next questions would be:
>>>
>>> a, how many parents does the problem class (Link or Links?) have?
>>> b, is Rank the base class?
>>> c, does Rank::__construct() actually exist?
>>> d, does the error also occur with php5.0.x? (as apposed to
>>> php5.1beta)
>>>
>>> given these questions may seem silly - but I can't see your code
>>> from
>>> here :-) so I figured I'd ask anyway!
>>>
>>>
>>>
>>>> Meno
>>>> 2005/8/2, Jochem Maas <jochem
iamjochem.com>:
>>>>
>>>>
>>>>> Pawel Bernat wrote:
>>>>>
>>>>>
>>>>>
>>>>>> On Tue, Aug 02, 2005 at 03:42:00PM +0100, Meno Abels wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>> Hello,
>>>>>>>
>>>>>>> With my application that uses heavily inherent classes,
>>>>>>> sometimes I
>>>>>>>
>>>>>>>
>>>>>
>>>>> deeeeep class heirarchies can lead to brainfreeze - beware of
>>>>> going to deep :-)
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>> get the following message:
>>>>>>> PHP Fatal error: Call to undefined method Rank::_construtor
>>>>>>> () in
>>>>>>> .../inc/Links.class.php. It works
>>>>>>> with php
>>>>>>> 4.x when I use the old style of constructor calling
>>>>>>> $this->(CLASSNAME) . But when working with php 5.2 b2 or b3
>>>>>>> in the old
>>>>>>> OR the new style, I get the PHP Fatal error from above.
>>>>>>> Is there any hints to look at this problem?
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> Why do you call _construct instead of __construct? And how do
>>>>>> you do it?
>>>>>>
>>>>>>
>>>>>
>>>>> he seems to be calling _construtor() which although not wrong
>>>>> is not the
>>>>> method he is looking for (cue voice of Alex Guiness for the
>>>>> second time this week :-)
>>>>>
>>>>> try __construct()
>>>>>
>>>>> PS - this kind of thing belongs on generals until you are
>>>>> _sure_ it's an
>>>>> internals problem. IMHO.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> Did you read everything at http://php.net/construct
>>>>>> (including Note)?
>>>>>> What about php 5.0?
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>>
>>>
>>>
>>>
>
attached mail follows:
Meno Abels wrote:
>
> Am 03.08.2005 um 09:22 schrieb Jochem Maas:
>
>> Meno Abels wrote:
>>
>>> Thanks,
>>> the problem with cut an paste i have not only one of these messages
>>> i get huge amounts of these. So i stripped down to one, sorry my fault.
>>> a) usally 4-6
>>>
>>
>> any given class will never have a variable number of parents ;-)
>> IMHO 6 levels deep is pushing the boat out a bit - but technically it
>> should be no problem
>
>
> depends on the application
IC.
>
>>
>>
>>> b) no
>>> c) yes, as I mentioned i tried both (old/new)
>>>
>>
>> again it may sound stupid but double check spelling in the file.
>> also check for weird non-printing chars in the problem file -
>
>
> there are is alot of code which works as i mentioned all the code
> is generated. The pattern of the working code is not different to the
> none working. Also i have some examples where i call the same class
> in other scripts and they are working. So there is no write error. Also
> the old syntax should work without change and php 4 it works perfect.
>
>>
>>
>>> d) never tested i jump over 5.0
>>>
>>
>> 5.1 is still beta - test it on 5.0 (consider that the mailing list
>> equivelant
>> of a military order ;-)
>
>
> that will take a while to do
its worth it - regardless of whether it works properly on 5.0 or not
it strengthens any eventual bug report you may make - i.e. you can indicate
in depth problem research.
also try a fresh build of the latest php5.1 beta - just in case.
no hurry on my account, I'm just an interested bystander :-)
>
>>
>> does the problem occur in only 1 baseclass? or in a fixed number of
>> baseclasses? or is does it occur anywhere/everywhere.
>
>
> i occurs with a random pattern
ouch. when you say random does that mean that running the exact same code
will not always produce the error?
what OS are you on?
>
>>
>> are you trying to reassign $this or are you using the reference token
>> (&)
>> when passing objects around? (I ask because you seem to indicate that
>> the
>> codebase is being moved from php4 where such things are almost
>> required to
>> make usuable OO code - whereas in php5 it's asking for trouble)
>
>
> NO not used!
we can rule that out then
!
>
>>
>> pump up error_reporting to full i.e. error_reporting( E_ALL | E_STRICT )
>> - maybe it will give you a hint.
>
>
> DONE, i see nothing which is seams to be helpfull
darn. so you're not even getting any E_STRICT errors?
>
>>
>> also you might consider placing a call to debug_print_backtrace() in
>> each
>> and every constructor to help see wtf is going on.
>
>
> i'am not clear what is should help for.
it may help you to see a pattern that is not obvious by viewing the stack trace
preceeding each fatal error. just a thought - it may turn up nothing :-/
>
>>
>> lastly get a copy of Zend Studio Client/Server and set it up so that you
>> can do step by step debugging to see _exactly_ what is going on.
>
>
> -:)
>
>>
>> I'm running out of ideas here ... I can only suggest now to post code
>> - and plenty of it - if that is possible, send a link to somewhere
>> rather than
>> bombard everyone on the list with 1000's of lines of code.
>
>
> i will work to strip down you can't run the code without 20 own written
> c++/c
> extentions.
>
<ring ring> (alarm bell goes off) - you have 20+ of your own extensions that
are required, there is a distinct possibility that the problem lies within them ...
recompling php with all the debug configure options turned on
and using valgrind and/or gdb to debug maybe what you need to be doing.
Side Note: you have code generators and a bunch of custom extensions - it sounds
interesting to say the least! I'd love to see your stuff ... will you be going open
source with it per chance? (maybe that is not even a decision you are allowed to make)
rgds,
Jochem
>
>>
>>
....
attached mail follows:
Am 03.08.2005 um 11:03 schrieb Jochem Maas:
> Meno Abels wrote:
>
>> Am 03.08.2005 um 09:22 schrieb Jochem Maas:
>>
>>> Meno Abels wrote:
>>>
>>>
>>>> Thanks,
>>>> the problem with cut an paste i have not only one of these messages
>>>> i get huge amounts of these. So i stripped down to one, sorry
>>>> my fault.
>>>> a) usally 4-6
>>>>
>>>>
>>>
>>> any given class will never have a variable number of parents ;-)
>>> IMHO 6 levels deep is pushing the boat out a bit - but
>>> technically it
>>> should be no problem
>>>
>> depends on the application
>>
>
> IC.
>
>
>>>
>>>
>>>
>>>> b) no
>>>> c) yes, as I mentioned i tried both (old/new)
>>>>
>>>>
>>>
>>> again it may sound stupid but double check spelling in the file.
>>> also check for weird non-printing chars in the problem file -
>>>
>> there are is alot of code which works as i mentioned all the code
>> is generated. The pattern of the working code is not different to the
>> none working. Also i have some examples where i call the same class
>> in other scripts and they are working. So there is no write error.
>> Also
>> the old syntax should work without change and php 4 it works perfect.
>>
>>>
>>>
>>>
>>>> d) never tested i jump over 5.0
>>>>
>>>>
>>>
>>> 5.1 is still beta - test it on 5.0 (consider that the mailing
>>> list equivelant
>>> of a military order ;-)
>>>
>> that will take a while to do
>>
>
> its worth it - regardless of whether it works properly on 5.0 or not
> it strengthens any eventual bug report you may make - i.e. you can
> indicate
> in depth problem research.
>
> also try a fresh build of the latest php5.1 beta - just in case.
>
> no hurry on my account, I'm just an interested bystander :-)
>
>
>>>
>>> does the problem occur in only 1 baseclass? or in a fixed number of
>>> baseclasses? or is does it occur anywhere/everywhere.
>>>
>> i occurs with a random pattern
>>
>
> ouch. when you say random does that mean that running the exact
> same code
> will not always produce the error?
>
> what OS are you on?
FREEBSD 5.4-p6
>
>
>>>
>>> are you trying to reassign $this or are you using the reference
>>> token (&)
>>> when passing objects around? (I ask because you seem to indicate
>>> that the
>>> codebase is being moved from php4 where such things are almost
>>> required to
>>> make usuable OO code - whereas in php5 it's asking for trouble)
>>>
>> NO not used!
>>
>
> we can rule that out then
> !
>
>
>>>
>>> pump up error_reporting to full i.e. error_reporting( E_ALL |
>>> E_STRICT )
>>> - maybe it will give you a hint.
>>>
>> DONE, i see nothing which is seams to be helpfull
>>
>
> darn. so you're not even getting any E_STRICT errors?
i fixed them year go we are working only with E_STRICT on-:)
>
>
>>>
>>> also you might consider placing a call to debug_print_backtrace
>>> () in each
>>> and every constructor to help see wtf is going on.
>>>
>> i'am not clear what is should help for.
>>
>
> it may help you to see a pattern that is not obvious by viewing the
> stack trace
> preceeding each fatal error. just a thought - it may turn up
> nothing :-/
>
>
>>>
>>> lastly get a copy of Zend Studio Client/Server and set it up so
>>> that you
>>> can do step by step debugging to see _exactly_ what is going on.
>>>
>> -:)
>>
>>>
>>> I'm running out of ideas here ... I can only suggest now to post
>>> code
>>> - and plenty of it - if that is possible, send a link to
>>> somewhere rather than
>>> bombard everyone on the list with 1000's of lines of code.
>>>
>> i will work to strip down you can't run the code without 20 own
>> written c++/c
>> extentions.
>>
>
> <ring ring> (alarm bell goes off) - you have 20+ of your own
> extensions that
> are required, there is a distinct possibility that the problem lies
> within them ...
>
> recompling php with all the debug configure options turned on
> and using valgrind and/or gdb to debug maybe what you need to be
> doing.
>
LONG Done, standard procedure, the extentions working all without
change from 4.x.
Our extentions only doing some weired algorithmens on integer and
float matrixes which
are too slow in native php. They do not allocated memory only on the
stack-:). All around
it is pretty simple stuff.
> Side Note: you have code generators and a bunch of custom
> extensions - it sounds
> interesting to say the least! I'd love to see your stuff ... will
> you be going open
> source with it per chance? (maybe that is not even a decision you
> are allowed to make)
it is for you just useless stuff the application is the rapid
development enviroment for a
real huge a datamining application which is mostly design by the use
of MDA(Model Driven Architecture).
We use php for this to safe the huge compile times we need to have on
the also generated
c++ application. PHP is only used for testing and and safe turnaround
times-:) but without the
backend databases which believe me are unsharable-:) you gets out of
the code nothing.
regards
meno
> rgds,
> Jochem
>
>>>
>>>
>>>
attached mail follows:
Hi all. This has been an interesting week.
Now the form works, and I am able to error check, if no errors look into
user answer table and delete from that all q_ids matching the ones just
picked, insert this page of question/answer info (q_id/a_id) into the
user answer db, and if successful advance the category by 1 and get more
questions. It works.
I must have a logic error though because for some reason even though I
say to delete matching q_ids and reinsert, then move on, if the user
hits the back button, changes answers and hits submit again, the table
does not update . . . and the category does not increment. We get stuck
on this page of questions/answers forever.
What DOES happen after BACK is that the answers they select get passed
back to error check (eg if they select a select box to nothing, error
checking reenters its value into $message) and those values get passed
back to the display page (eg $_POST[$qname] == $aid) because the
"selected" answers change. It's just the db call and category advance
which get stuck.
Any help will be greatly appreciated - Here's the code:
<?php
//Start the session
session_start();
//Error announcements
echo "POST:<BR />";
print_r($_POST);
echo "<br /><br />";
echo "required session:<BR />";
var_dump($_SESSION['required_fields']);
echo "<br />\$ cat:" . $cat . "<br />";
echo "\$message: ";
var_dump($message);
//error_reporting(E_ALL);
/* A script to retrieve from database questions and answers,
* create a multi-page HTML form, error check answers and
* submit them to the database on a per-user basis.
* August 2005
*/
//Some basic vars
if (!isset($cat)) { $cat = "1"; }
$error=0;
$SUCCESS=0;
if (!isset($message))
{
$message = array();
}
if (!isset($_SESSION['required_fields']))
{
$_SESSION['required_fields'] = array();
}
if(!sizeof($_POST))
{
include_once(QUESTIONS . 'q.inc');
}
//error checking
reset($_SESSION['required_fields']);
foreach ($_SESSION['required_fields'] as $fieldname)
{
if (!isset($_POST[$fieldname]) || empty($_POST[$fieldname]))
{
$message[$fieldname]=1;
}
}//error check
if (!empty($message))
{ $cat=$_POST['cat'];
include_once(QUESTIONS . 'q.inc');
}
//No errors? Store what's been done so far
if ( ($_POST['action'] == 'process') && (!sizeof($message) ) )
{
foreach($_POST as $key=>$val)
{
//find key/val sets within posts which are both numeric
if(is_numeric($key) && is_numeric($val))
{
$nkey=$key;
//add keys to the qidlist
$qidlist[] .= $key;
//add these values ( q_id, a_id ) to sql statement
$qanda[] .= "('1' , '" . $nkey . "' , '" . $val .
"')";
}
//find key/val sets within sub-arrays of $_POST
which are numeric
if(is_array($val))
{
foreach ($val as $akey=>$aval)
{
//add these values ( q_id, a_id ) to sql
statement
$qanda[] .= "('1' , '" . $key . "' , '" .
$aval . "')";
var_dump($qanda);
}
}
}
$qidlist_sql="DELETE FROM $userAnswers WHERE q_id IN ("
. (implode(",",$qidlist)) . ");";
$q_a_sql="INSERT INTO $userAnswers (u_id, q_id, a_id )
VALUES " . (implode(",",$qanda)) . ";";
mysql_query($qidlist_sql);
if($q_a_result = mysql_query($q_a_sql))
{
unset($_SESSION['required_fields']);
$cat = $_POST['cat']+1;
include_once(QUESTIONS . 'q.inc');
}
else
{
echo "<b>A fatal MySQL error occured</b>.\n
<br />Query: " . $q_a_sql . "<br />\nError: (" .
mysql_error();
die;
}
}
?>
attached mail follows:
"Jack Jackson" <jackson.linux
gmail.com> wrote in message
news:42F0B043.5050108
gmail.com...
> Hi all. This has been an interesting week.
>
> Now the form works, and I am able to error check, if no errors look into
> user answer table and delete from that all q_ids matching the ones just
> picked, insert this page of question/answer info (q_id/a_id) into the
> user answer db, and if successful advance the category by 1 and get more
> questions. It works.
>
> I must have a logic error though because for some reason even though I
> say to delete matching q_ids and reinsert, then move on, if the user
> hits the back button, changes answers and hits submit again, the table
> does not update . . . and the category does not increment. We get stuck
> on this page of questions/answers forever.
Do you want to allow people to go back and chnage things ?
If so, write a suitable UPDATE statement
Sample UPDATE syntax
UPDATE table
SET field=1
WHERE field2='x'
You will probably want to check whether the answers already exist, use a
select statement for this. Unsure if this works in mysql, but
IF NOT EXISTS
(select id from table where field=1)
UPDATE table
SET field=1
WHERE field2='x'
might do the trick, or something similar will at any rate.
If you want to stop people going back, check the referer (sic)
>
> What DOES happen after BACK is that the answers they select get passed
> back to error check (eg if they select a select box to nothing, error
> checking reenters its value into $message) and those values get passed
> back to the display page (eg $_POST[$qname] == $aid) because the
> "selected" answers change. It's just the db call and category advance
> which get stuck.
>
> Any help will be greatly appreciated - Here's the code:
>
> <?php
> //Start the session
> session_start();
> //Error announcements
> echo "POST:<BR />";
> print_r($_POST);
> echo "<br /><br />";
> echo "required session:<BR />";
> var_dump($_SESSION['required_fields']);
>
> echo "<br />\$ cat:" . $cat . "<br />";
> echo "\$message: ";
> var_dump($message);
>
> //error_reporting(E_ALL);
>
>
> /* A script to retrieve from database questions and answers,
> * create a multi-page HTML form, error check answers and
> * submit them to the database on a per-user basis.
> * August 2005
> */
>
> //Some basic vars
> if (!isset($cat)) { $cat = "1"; }
> $error=0;
> $SUCCESS=0;
>
>
> if (!isset($message))
> {
> $message = array();
> }
>
> if (!isset($_SESSION['required_fields']))
> {
> $_SESSION['required_fields'] = array();
> }
>
> if(!sizeof($_POST))
> {
> include_once(QUESTIONS . 'q.inc');
> }
>
> //error checking
>
> reset($_SESSION['required_fields']);
> foreach ($_SESSION['required_fields'] as $fieldname)
> {
> if (!isset($_POST[$fieldname]) || empty($_POST[$fieldname]))
> {
> $message[$fieldname]=1;
> }
>
> }//error check
> if (!empty($message))
> { $cat=$_POST['cat'];
> include_once(QUESTIONS . 'q.inc');
> }
>
> //No errors? Store what's been done so far
>
> if ( ($_POST['action'] == 'process') && (!sizeof($message) ) )
> {
> foreach($_POST as $key=>$val)
> {
> //find key/val sets within posts which are both
numeric
> if(is_numeric($key) && is_numeric($val))
> {
> $nkey=$key;
> //add keys to the qidlist
> $qidlist[] .= $key;
> //add these values ( q_id, a_id ) to sql statement
> $qanda[] .= "('1' , '" . $nkey . "' , '" . $val .
> "')";
> }
> //find key/val sets within sub-arrays of $_POST
> which are numeric
> if(is_array($val))
> {
> foreach ($val as $akey=>$aval)
> {
> //add these values ( q_id, a_id ) to sql
> statement
> $qanda[] .= "('1' , '" . $key . "' , '" .
> $aval . "')";
> var_dump($qanda);
> }
> }
> }
>
>
> $qidlist_sql="DELETE FROM $userAnswers WHERE q_id IN ("
> . (implode(",",$qidlist)) . ");";
>
> $q_a_sql="INSERT INTO $userAnswers (u_id, q_id, a_id )
> VALUES " . (implode(",",$qanda)) . ";";
>
> mysql_query($qidlist_sql);
>
>
> if($q_a_result = mysql_query($q_a_sql))
> {
> unset($_SESSION['required_fields']);
> $cat = $_POST['cat']+1;
> include_once(QUESTIONS . 'q.inc');
> }
>
> else
> {
> echo "<b>A fatal MySQL error occured</b>.\n
> <br />Query: " . $q_a_sql . "<br />\nError: (" .
> mysql_error();
> die;
> }
>
> }
> ?>
attached mail follows:
Hi, mark,
<snip>
Mark Rees wrote:
> Do you want to allow people to go back and change things ?
> If so, write a suitable UPDATE statement
</snip>
Thanks, but I think the update function should be built in -- the sql
checks whether the userAnswer table contains the q_id the user has just
entered; if so, it deletes the row containing it and then the second
query inserts the new values.
$qidlist_sql="DELETE FROM teresa WHERE q_id IN (" .
(implode(",",$qidlist)) . ");"
$q_a_sql="INSERT INTO teresa (u_id, q_id, a_id )
VALUES " . (implode(",",$qanda)) . ";";
I think there's something wrong with the logic of how I'm handling
$_POST info and passing it back and forth: here's why: if I close the
browser and reopen it and refill the same questions, the answer table
shows the updated answers. there's something in the logic I am using
about how I am advancing the $cat and managing the $_POST information. I
think . But I cannot find it.
Anyone?
attached mail follows:
The code below isn't much help to debug. Do some checking to figure out
how far into your IF statement you're getting. Is the query running?
Is it the query you expect? (Step #1 when inserting or creating dynamic
queries that aren't working: print them out to make sure they are what
you think they are.) Is the category being incremented? You say you
can go back, but you can't go forward. Look at the page source, is the
form action what it should be? Look at the form hidden variables (if
any) are they what you expect?
kgt
Jack Jackson wrote:
> Hi, mark,
>
> <snip>
> Mark Rees wrote:
> > Do you want to allow people to go back and change things ?
> > If so, write a suitable UPDATE statement
> </snip>
>
> Thanks, but I think the update function should be built in -- the sql
> checks whether the userAnswer table contains the q_id the user has
> just entered; if so, it deletes the row containing it and then the
> second query inserts the new values.
>
> $qidlist_sql="DELETE FROM teresa WHERE q_id IN (" .
> (implode(",",$qidlist)) . ");"
>
> $q_a_sql="INSERT INTO teresa (u_id, q_id, a_id )
> VALUES " . (implode(",",$qanda)) . ";";
>
>
> I think there's something wrong with the logic of how I'm handling
> $_POST info and passing it back and forth: here's why: if I close the
> browser and reopen it and refill the same questions, the answer table
> shows the updated answers. there's something in the logic I am using
> about how I am advancing the $cat and managing the $_POST information.
> I think . But I cannot find it.
>
> Anyone?
>
>
attached mail follows:
Hi Kristen, there's a misunderstanding:
Kristen G. Thorson wrote:
> The code below isn't much help to debug. Do some checking to figure out
> how far into your IF statement you're getting. Is the query running?
Yes it runs successfully
> Is it the query you expect?
Yes it is perfect, and provided this is a new session and we're going
forward page by page, it properly deletes from and inserts to the db as
expected
(Step #1 when inserting or creating dynamic
> queries that aren't working: print them out to make sure they are what
> you think they are.) Is the category being incremented?
Yes, absolutely
>You say you
> can go back, but you can't go forward.
Actually no. In a new session, I can start and go forward page by page
to the end of the questionnaire, advancing each stage perfectly, storing
all values exactly as I'd expect.
The trouble starts if, during the process, the user hits the BACK
button. At that point, user can reload the last page of questions,
displaying the answers they gave. If the user makes changes, those
changes get error checked but do not become part of the sql query. Also,
user can not move forwards any more. So it's as the subject says -
everything works...until they hit the back button, from which point the
whole thing goes gablooey.
Look at the page source, is the
> form action what it should be?
Yes
Look at the form hidden variables (if
> any) are they what you expect?
No. $cat remains what it was BEFORE the user hit the BACK button.
However the questions dispayed are from the $cat which is in fact $cat-1
??!!
attached mail follows:
Hey!!! What resources do you used to learn AJAX?
I saw a presentation about AJAX hosted by PHP Architect and I like it, but I
want to go deep in the subject, so far I have not found resources.
Thanks in advance!!
-----Original Message-----
From: Graham Anderson [mailto:grahama
siren.cc]
Sent: Martes, 02 de Agosto de 2005 01:46 p.m.
To: php
Subject: Re: [PHP] AJAX & PHP
Has anyone integrated JPGraph [or another php graph class] into a
PHP/AJAX setup ?
I would really like to integrate interactive graphs based upon user
variables.
Would be fantastic.
Are there any examples out there ?
g
Este mensaje es exclusivamente para el uso de la persona o entidad a quien esta dirigido; contiene informacion estrictamente confidencial y legalmente protegida, cuya divulgacion es sancionada por la ley. Si el lector de este mensaje no es a quien esta dirigido, ni se trata del empleado o agente responsable de esta informacion, se le notifica por medio del presente, que su reproduccion y distribucion, esta estrictamente prohibida. Si Usted recibio este comunicado por error, favor de notificarlo inmediatamente al remitente y destruir el mensaje. Todas las opiniones contenidas en este mail son propias del autor del mensaje y no necesariamente coinciden con las de Radiomovil Dipsa, S.A. de C.V. o alguna de sus empresas controladas, controladoras, afiliadas y subsidiarias. Este mensaje intencionalmente no contiene acentos.
This message is for the sole use of the person or entity to whom it is being sent. Therefore, it contains strictly confidential and legally protected material whose disclosure is subject to penalty by law. If the person reading this message is not the one to whom it is being sent and/or is not an employee or the responsible agent for this information, this person is herein notified that any unauthorized dissemination, distribution or copying of the materials included in this facsimile is strictly prohibited. If you received this document by mistake please notify immediately to the subscriber and destroy the message. Any opinions contained in this e-mail are those of the author of the message and do not necessarily coincide with those of Radiomovil Dipsa, S.A. de C.V. or any of its control, controlled, affiliates and subsidiaries companies. No part of this message or attachments may be used or reproduced in any manner whatsoever.
attached mail follows:
not a whole lot of info on the subject for working with graph classes :(
at least at this point
g
On Aug 3, 2005, at 7:05 AM, Miguel Guirao wrote:
Hey!!! What resources do you used to learn AJAX?
I saw a presentation about AJAX hosted by PHP Architect and I like it,
but I
want to go deep in the subject, so far I have not found resources.
Thanks in advance!!
-----Original Message-----
From: Graham Anderson [mailto:grahama
siren.cc]
Sent: Martes, 02 de Agosto de 2005 01:46 p.m.
To: php
Subject: Re: [PHP] AJAX & PHP
Has anyone integrated JPGraph [or another php graph class] into a
PHP/AJAX setup ?
I would really like to integrate interactive graphs based upon user
variables.
Would be fantastic.
Are there any examples out there ?
g
Este mensaje es exclusivamente para el uso de la persona o entidad a
quien esta dirigido; contiene informacion estrictamente confidencial y
legalmente protegida, cuya divulgacion es sancionada por la ley. Si el
lector de este mensaje no es a quien esta dirigido, ni se trata del
empleado o agente responsable de esta informacion, se le notifica por
medio del presente, que su reproduccion y distribucion, esta
estrictamente prohibida. Si Usted recibio este comunicado por error,
favor de notificarlo inmediatamente al remitente y destruir el mensaje.
Todas las opiniones contenidas en este mail son propias del autor del
mensaje y no necesariamente coinciden con las de Radiomovil Dipsa, S.A.
de C.V. o alguna de sus empresas controladas, controladoras, afiliadas
y subsidiarias. Este mensaje intencionalmente no contiene acentos.
This message is for the sole use of the person or entity to whom it is
being sent. Therefore, it contains strictly confidential and legally
protected material whose disclosure is subject to penalty by law. If
the person reading this message is not the one to whom it is being sent
and/or is not an employee or the responsible agent for this
information, this person is herein notified that any unauthorized
dissemination, distribution or copying of the materials included in
this facsimile is strictly prohibited. If you received this document
by mistake please notify immediately to the subscriber and destroy the
message. Any opinions contained in this e-mail are those of the author
of the message and do not necessarily coincide with those of Radiomovil
Dipsa, S.A. de C.V. or any of its control, controlled, affiliates and
subsidiaries companies. No part of this message or attachments may be
used or reproduced in any manner whatsoever.
attached mail follows:
Graham Anderson wrote:
> not a whole lot of info on the subject for working with graph classes :(
> at least at this point
>
>
> g
>
Surely it would be much simpler to just use have javascript to set a
placed image to a new (or the same) location - this image is then
generated by JPGraph et al with no modification to code. I have been
using this technique for years to make server calls without page
refreshing. (Well, that or an invisible frame/iframe/layer)
HTH,
Mikey
attached mail follows:
I am looking for some resources to use my Access Databases with PHP, anyone have a good link?
David
attached mail follows:
I haven't used access with php(mainly due to the fact that I use php
on linux), but any access use I've seen so far was through OBDC(and
that was in phpBB). I suggest you consider both this, and dogging your
way through MS's COM docs.
On 8/3/05, David Wills <davidwills
cox.net> wrote:
> I am looking for some resources to use my Access Databases with PHP, anyone have a good link?
>
> David
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
Just looked into this recently and here's a brief rundown of what I've found:
1. If you run PHP on a non-Windows system, your only option seems to be making a connection to a remote ODBC data source (hosted on a Windows machine presumably). There was something..err.. ODBTP (?) that would work on linux to connect to remote ODBC connections
If you run PHP on a Windows server, then you have the following options:
2. ODBC connection via DSN
3. DSNLess connection (you can do this with a DB abstraction layer like ADODB)
4. COM connection (requires Access be installed on the server and, in my opinion, is the worst solution out of the group due to it's resource use)
There doesn't appear to be a good direct way to read Access files on a linux machine. I may have come across a commercial Access driver ($$$) for linux, but can't remember. If I did, I would have dismissed it fairly quickly as 'free' is more my budget right now :)
If you need links to the stuff above, let me know and I'll try to dig up some. I also have a script I wrote using WinBinder and ADODB on a Windows box to hit an Access database, pull data, scrub it, then insert it into a MySQL database via ODBC.
-TG
= = = Original message = = =
I am looking for some resources to use my Access Databases with PHP, anyone have a good link?
David
___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.
attached mail follows:
I've run into a situation where PHP is way off when doing a relatively
simple calculation of distance between two points in 2-dimensional space,
where coordinates go from 1 to 300 in both X and Y directions. When passing
300, it goes back to 1, and vise-versa (it's for a game and is supposed to
approximate the movement over a sphere).
Using this function:
function calc_distance($curX,$curY,$newX,$newY) {
// calculate distance to new location
$distX = abs($curX - $newX);
$distY = abs($curY - $newY);
if ($distX <= 150 && $distY <= 150) {
$dist = sqrt($distX^2 + $distY^2);
} elseif ($distX > 150 && $distY <= 150) {
$dist = sqrt((abs(300 - $newX))^2 + $distY^2);
} elseif ($distX <= 150 && $distY > 150) {
$dist = sqrt($distX^2 + (abs(300 - $newY))^2);
} else {
$dist = sqrt((abs(300 - $newX))^2 + (abs(300 - $newY))^2);
}
return $dist;
}
And using 150,150 as $curX,$curY and 300,300 as $newX,$newY ... PHP
calculates $dist as 3.46410161514
which obviously is far off target ...referring to my calcultor, the correct
result for the same code is supposed to be 212.1320
What happens here ? And how the heck do I get to calculate right ?
Float errors usually isn't this severe, so I'm assuming it's a problem with
properly acknowledging the hierarchi of the mathematical operators ...
It's PHP ver. 4.3.0, on Apache/2.0.53 (Win32), on WinXP SP1
I've been trying to manually calculate the formula out of order to figure
out how the strange result comes about, but haven't had any success yet ...
Any suggestions ?
Rene
--
Rene Brehmer
aka Metalbunny
We have nothing to fear from free speech and free information on the
Internet, but pop-up advertising!
http://metalbunny.net/
My little mess of things...
attached mail follows:
On 8/3/05, Rene Brehmer <piv
metalbunny.net> wrote:
> I've run into a situation where PHP is way off when doing a relatively
> simple calculation of distance between two points in 2-dimensional space,
> where coordinates go from 1 to 300 in both X and Y directions. When passing
> 300, it goes back to 1, and vise-versa (it's for a game and is supposed to
> approximate the movement over a sphere).
>
> Using this function:
>
> function calc_distance($curX,$curY,$newX,$newY) {
> // calculate distance to new location
> $distX = abs($curX - $newX);
> $distY = abs($curY - $newY);
>
> if ($distX <= 150 && $distY <= 150) {
> $dist = sqrt($distX^2 + $distY^2);
I don't think you really want to do a bitwise xor there.
http://www.php.net/manual/en/language.operators.bitwise.php
Try pow() instead
http://www.php.net/manual/en/function.pow.php
-robin
attached mail follows:
See
http://us3.php.net/manual/en/language.operators.php
http://us3.php.net/manual/en/language.operators.bitwise.php
You want this:
function calc_distance($curX,$curY,$newX,$newY) {
// calculate distance to new location
$distX = abs($curX - $newX);
$distY = abs($curY - $newY);
if ($distX <= 150 && $distY <= 150) {
$dist = sqrt(pow( $distX,2) + pow($distY,2));
} elseif ($distX > 150 && $distY <= 150) {
$dist = sqrt(pow((abs(300 - $newX)),2) + pow($distY,2));
} elseif ($distX <= 150 && $distY > 150) {
$dist = sqrt(pow($distX,2) + pow((abs(300 - $newY)),2));
} else {
$dist = sqrt(pow((abs(300 - $newX)),2) + pow((abs(300 - $newY)),2));
}
return $dist;
}
echo calc_distance( 150, 150, 300, 300 ); //echoes 212.13203435596
echo "<br>150^2=".(150^2)." and pow(150,2)=".(pow(150,2)); //echoes
150^2=148 and pow(150,2)=22500
kgt
Rene Brehmer wrote:
>I've run into a situation where PHP is way off when doing a relatively
>simple calculation of distance between two points in 2-dimensional space,
>where coordinates go from 1 to 300 in both X and Y directions. When passing
>300, it goes back to 1, and vise-versa (it's for a game and is supposed to
>approximate the movement over a sphere).
>
>Using this function:
>
>function calc_distance($curX,$curY,$newX,$newY) {
> // calculate distance to new location
> $distX = abs($curX - $newX);
> $distY = abs($curY - $newY);
>
> if ($distX <= 150 && $distY <= 150) {
> $dist = sqrt($distX^2 + $distY^2);
> } elseif ($distX > 150 && $distY <= 150) {
> $dist = sqrt((abs(300 - $newX))^2 + $distY^2);
> } elseif ($distX <= 150 && $distY > 150) {
> $dist = sqrt($distX^2 + (abs(300 - $newY))^2);
> } else {
> $dist = sqrt((abs(300 - $newX))^2 + (abs(300 - $newY))^2);
> }
>
> return $dist;
>}
>
>And using 150,150 as $curX,$curY and 300,300 as $newX,$newY ... PHP
>calculates $dist as 3.46410161514
>which obviously is far off target ...referring to my calcultor, the correct
>result for the same code is supposed to be 212.1320
>
>What happens here ? And how the heck do I get to calculate right ?
>
>Float errors usually isn't this severe, so I'm assuming it's a problem with
>properly acknowledging the hierarchi of the mathematical operators ...
>
>It's PHP ver. 4.3.0, on Apache/2.0.53 (Win32), on WinXP SP1
>
>I've been trying to manually calculate the formula out of order to figure
>out how the strange result comes about, but haven't had any success yet ...
>
>Any suggestions ?
>
>Rene
>
>
attached mail follows:
On 2 Aug 2005, at 15:12, Robin Vickery wrote:
> I don't suppose this is the place for a rant about the futility of
> checking email addresses with a regexp?
Though I will agree with you to some extent, I've had quite a lot of
success with this, which is pretty thorough:
^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-
\/\=\?\^\`\{\|\}\~]+
(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!\.)){0,61}
[a-zA-Z0-9]?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61}[a-zA-Z0-9]?)|
(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]
\d|25[0-5])\]))$
Which I got from here:
http://www.hexillion.com/samples/#Regex
Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
marcus
synchromedia.co.uk | http://www.synchromedia.co.uk
attached mail follows:
Hi,
I've want to dig a bit deeper into regular expressions for php.
I wonder if anyone can help me choosing between 2 books I'm considering buying:
1. Open Source Regular Expression Recipes - Nathan A Good
2. Mastering Regular Expressions - Jeffrey Freidl
If your using/reading one of these books, please let me know which one
is best for PHP regex.
Thnx
Stefan Lemmen
Apeldoorn Holland
attached mail follows:
Dear you,
So, if I need to define a set of varibles ( two dimension array, eg :
$func[0,0] ) and via the varibles of form tag ( format, eg :
$_GET["varname"] or $_POST["varname"] ), how about the example sources ?
Thank for your help !
Edward.
attached mail follows:
> If I want to define and display a set of varibles, for example :
> $func1 = 0
> $func2 = 1
> $func3 = 2
> $func4 = 3
> $func5 = 4
>
> How can we define and display the varibles by using for loop
> function ?
<?php
for ($x=0;$x<10;$x++){
$func[$x]=$x;
}
print_r($func);
?>
This uses an array, so, in this case, your variables would be referenced as
$func[0]..$func[9].
JM
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Just for the sake of example let's say i keep track of all of a customers previous orders in a
table like this:
Last_Order
------
Cust_ID
Item_No
No_ordered
When a customer places an order i put the order details in an a table like this:
Orders
-----------
Order_ID
Cust_ID
Item_No
No_ordered
Let's say when my customer returns he decides he wants everything he ordered previously plus some
other stuff. Assuming this customer has unique customer ID of 345 and his current new order id is
678. Can i copy his last order into the orders table with just a SQL statement like:
INSERT INTO Orders VALUES ('678',(SELECT * FROM Last_Order WHERE Cust_ID = '678'))
What i want to do is grab all the data from Last_Order associated with cust_id 345 (or whatever)
and insert it into the Orders table with a Order_ID in this case 678. Let me know if this isn’t
clear. This SQL obviously doesn't work, however, my question is there a way to do this with SQL
alone? Or do i need to grab all the records from the Last_Order table loop through the record set
and insert each new row into Orders individually?
-k.
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
attached mail follows:
Try
INSERT INTO Orders (SELECT '678',Cust_ID,Item_No,No_ordered FROM
Last_Order WHERE Cust_ID = '678')
kgt
-k. wrote:
>Just for the sake of example let's say i keep track of all of a customers previous orders in a
>table like this:
>
>Last_Order
>------
>Cust_ID
>Item_No
>No_ordered
>
>When a customer places an order i put the order details in an a table like this:
>
>Orders
>-----------
>Order_ID
>Cust_ID
>Item_No
>No_ordered
>
>
>Let's say when my customer returns he decides he wants everything he ordered previously plus some
>other stuff. Assuming this customer has unique customer ID of 345 and his current new order id is
>678. Can i copy his last order into the orders table with just a SQL statement like:
>
>INSERT INTO Orders VALUES ('678',(SELECT * FROM Last_Order WHERE Cust_ID = '678'))
>
>What i want to do is grab all the data from Last_Order associated with cust_id 345 (or whatever)
>and insert it into the Orders table with a Order_ID in this case 678. Let me know if this isn’t
>clear. This SQL obviously doesn't work, however, my question is there a way to do this with SQL
>alone? Or do i need to grab all the records from the Last_Order table loop through the record set
>and insert each new row into Orders individually?
>
>
>
>-k.
>
>__________________________________________________
>Do You Yahoo!?
>Tired of spam? Yahoo! Mail has the best spam protection around
>http://mail.yahoo.com
>
>
>
attached mail follows:
--- "Kristen G. Thorson" <kthorson
allegroconsultants.com> wrote:
> Try
>
> INSERT INTO Orders (SELECT '678',Cust_ID,Item_No,No_ordered FROM
> Last_Order WHERE Cust_ID = '678')
Thanks that nailed it. You rock.
-k.
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
attached mail follows:
I have a code
foreach($results as $key => $value)
{
echo $key.': '. $value .'<br>';
}
But, $value could be zero too.
How to skip printing on screen when $vlaue == 0?
I know I can do
foreach($results as $key => $value)
{
if(!empty($value))
{
echo $key.': '. $value .'<br>';
}
}
but there is a tons of code lines inside the loop and was thingking is
there any part in foreach function that can do that? something like:
foraech($results as $key => $value, skip(empty($value)))
{
//
}
Tahnks.
attached mail follows:
afan
afan.net wrote:
> I have a code
>
> foreach($results as $key => $value)
> {
> echo $key.': '. $value .'<br>';
> }
>
> But, $value could be zero too.
> How to skip printing on screen when $vlaue == 0?
>
> I know I can do
> foreach($results as $key => $value)
> {
> if(!empty($value))
> {
> echo $key.': '. $value .'<br>';
> }
> }
Is $results coming from a db? Select only the rows which do not have a
value of 0.
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
john
kegworks.com
attached mail follows:
> but there is a tons of code lines inside the loop and was thingking is
> there any part in foreach function that can do that? something like:
> foraech($results as $key => $value, skip(empty($value)))
> {
> //
> }
'continue' is your friend.
http://us3.php.net/manual/en/control-structures.continue.php
thnx,
Chris
attached mail follows:
afan
afan.net wrote:
> I have a code
>
> foreach($results as $key => $value)
> {
> echo $key.': '. $value .'<br>';
> }
>
> But, $value could be zero too.
> How to skip printing on screen when $vlaue == 0?
foreach($results as $key => $value)
{
if ($value == 0) continue;
echo $key.': '. $value .'<br>';
}
-Stut
attached mail follows:
Yes, it comes fro DB, but, quesry is alerady "to complex" (for me :))
with union, joint, ... and expanding with something else ill take
additional few hours to figure it out.
And, Stut's and Chris' "continue" solution sound perfect for me :)
Thanks guys on such a fast respond!
-afan
John Nichel wrote:
> afan
afan.net wrote:
>
>> I have a code
>>
>> foreach($results as $key => $value)
>> {
>> echo $key.': '. $value .'<br>';
>> }
>>
>> But, $value could be zero too.
>> How to skip printing on screen when $vlaue == 0?
>>
>> I know I can do
>> foreach($results as $key => $value)
>> {
>> if(!empty($value))
>> {
>> echo $key.': '. $value .'<br>';
>> }
>> }
>
>
> Is $results coming from a db? Select only the rows which do not have
> a value of 0.
>
attached mail follows:
Yeah, I thought about that. But to be honest, I don't know how to
recompile with builds from the CD/rpms. This is the first time I've ever
done it this way. So if I get the latest RPM and install it it should
activate session right? And then I just need to restart apache2 and I
should be good?
Burhan Khalid wrote:
>
> On Jul 29, 2005, at 8:07 PM, Tom Ray [Lists] wrote:
>
>> We built a box about 7 months or so ago using the SuSE 9.1 cd's,
>> straight install from the CDs. While I've read that sessions are
>> turned on by default, when we try to call on the sessions functions
>> (like with phpOpenChat or start_session()) we get calls to undefined
>> function errors. This is leading me to belive that sessions are
>> disabled for some reason. I need to enable the sessions so I have a
>> few questions
>>
>> 1) Can I do this without recompiling?
>> 2) If I can't, how do I recompile this since I used the SuSE cds?
>>
>> It's SuSE 9.1 running Php 4.3.4 with APache 2.0.49
>
>
> I don't *think* there is a separate module/rpm for sessions, so you
> are off to a recompile job.
>
> While you are it, upgrade your PHP to the latest stable version.
> 4.3.4 is quite old. Maybe there is a new package for SuSE that does
> it? (not really familiar with SuSE).
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]