[PHP] ! function_exists("curl_init") BUT curl_init exists and works.
! function_exists("curl_init") BUT curl_init exists and works. After my host blocked the file_get_contents and other functions, I am using CURL - but when I do function_exists("curl_init") it returns false but I can still use it anyone knows why? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Sending a POST variable to an ASP page
say jesse, if youre subscribed to php-general, you likely did that yourself ;) > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] let me know what the police have to say about it :p -nathan On Wed, Aug 27, 2008 at 10:32 PM, jesse church <[EMAIL PROTECTED]>wrote: > stop emailing me.. > now..i > never signed up for shit leave me alone taking me off you emailing list or i > will file charges with the police > > --- On *Wed, 8/27/08, Nathan Nobbe <[EMAIL PROTECTED]>* wrote: > > From: Nathan Nobbe <[EMAIL PROTECTED]> > Subject: Re: [PHP] Re: Sending a POST variable to an ASP page > To: "shaun thornburgh" <[EMAIL PROTECTED]> > Cc: php-general@lists.php.net > Date: Wednesday, August 27, 2008, 3:45 PM > > > On Wed, Aug 27, 2008 at 2:41 PM, shaun thornburgh <[EMAIL PROTECTED]> wrote: > > > > To: php-general@lists.php.net> Date: Wed, 27 Aug 2008 14:07:31 > -0500> > > From: [EMAIL PROTECTED]> Subject: [PHP] Re: Sending a POST variable > to > > an ASP page> > shaun thornburgh wrote:> > Hi,> > > > > I need to send a post > > variable to an ASP page, can I do this within my PHP script?> > > > > I don't > > need to view the page, or get any acknowledgment back, just send the > single > > POST variable...> > > > Thanks for your advice> > > > _> > > Get > > Hotmail on your mobile from Vodafone > > > > http://clk.atdmt.com/UKM/go/107571435/direct/01/> > If you don't > mind > > building the headers yourself in the code, it's just a > matter of > using > > fsockopen() and then fputs().> > -Shawn> > -- > PHP General > Mailing List ( > > http://www.php.net/)> To unsubscribe, visit:http://www.php.net/unsub.php> > > > > Hi Shawn, I have tried the following but it doesnt seem to work: > > foreach($_POST['newsletter-group'] as $key => $value){ > > $_POST['addressbookid'] = $value; $out = "POST > /signup.ashx";$fp = > > fsockopen("server-url", 80, $errno, $errstr, 30); if (!$fp) { > echo > > "$errstr ($errno)\n"; } else { fputs($fp, > $out . "\r\n");} > > fclose($fp); } Am I building the headers incorrectly? > > _ > > Make a mini you on Windows Live Messenger! > > http://clk.atdmt.com/UKM/go/107571437/direct/01/ > > > > dude, honestly, why would you take that approach unless you had a particular > reason for it? especially when you can knock it out in 2 minutes w/ curl... > > btw, google is pretty key as usual, try googling 'php curl post' ;) > > -nathan > > >
Re: [PHP] Re: Variable name as a string
More specifically: option 1 - colour: # red # green # blue colour: $colour\n"; ?> -- Ross McKay, Toronto, NSW Australia "If ye cannae see the bottom, dinnae complain if ye droon" - The Wee Book of Calvin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Variable name as a string
On Wed, 27 Aug 2008 22:25:44 -0500, Micah Gersten wrote: >You cannot have anything in the brackets for the name in a checkbox >group. [...] Bollocks. option 1 - colour: option 2 - flavour: option 3 - size: colour: $colour\n"; $flavour = $_POST['options']['flavour']; echo "flavour: $flavour\n"; $size = $_POST['options']['size']; echo "size: $size\n"; } ?> NB: no quotes around array key! I found this very handy for having variable product options on a simple shopping cart. -- Ross McKay, Toronto, NSW Australia "The lawn could stand another mowing; funny, I don't even care" - Elvis Costello -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Variable name as a string
Micah Gersten wrote: You cannot have anything in the brackets for the name in a checkbox group. The brackets specify that it is an array. The name of the array is the key in $_POST that contains the values of the checkbox group that were checked. You can have as many groups as you like. Eh? Course you can. value="1" > Val 1 value="2" > Val 2 Val 1 (Field 1) Val 2 (Field 2) Array ( [field_name] => Array ( [0] => 1 ) [field2] => Array ( [0] => 1 [1] => 2 ) ) ) -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Variable name as a string
You cannot have anything in the brackets for the name in a checkbox group. The brackets specify that it is an array. The name of the array is the key in $_POST that contains the values of the checkbox group that were checked. You can have as many groups as you like. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Shawn McKenzie wrote: > I guess you missed my last post, it was maybe the first or second > reply to this thread: > > value="1" > > > Then on post you have a $_POST['data'] array that contains the > field_names as keys and the checkbox values as values. > > That's why I was wondering if I was missing something. > > -Shawn > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Variable name as a string
tedd wrote: At 1:58 PM -0500 8/27/08, Shawn McKenzie wrote: ioannes wrote: Actually, you are right, as you just put the checkbox index in the POST and get the value from there. So you just need the number of checkboxes...sorry. for ($i = 1; $i <= 4; $i++) { $a = 'a' . $i; $b = 'whatever' . $i; if($_POST[$a] == 'on') { my_array[] = $_POST[$b] } } " John Either I'm missing what you're trying to do, or this has become incredibly over complicated! -Shawn It's not over complicated, but just a method of passing checked checkbox values to a php array. Do you have something better? Cheers, tedd I guess you missed my last post, it was maybe the first or second reply to this thread: value="1" > Then on post you have a $_POST['data'] array that contains the field_names as keys and the checkbox values as values. That's why I was wondering if I was missing something. -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: concatenating with "." or ","
On Aug 27, 2008, at 6:53 PM, tedd wrote: At 1:03 PM -0500 8/27/08, Jay Blanchard wrote: [snip] My memory may be a bit off but I think tedd is around 4017 (he uses rocks if you can recall) [/snip] I am certainly no less virile. Let's see if anyone can GREP this reference for my age; I was born "The Day the Music Died" That's easy -- Bye bye American pie. Drove my Chevy to the levy and the levy was dry. Good old boys drinking whiskey and Rye singing this will be the day that I die... this will be the day that I die. Who can identify (no fair using Google): "There she was friends and neighbors in all her radiant beauty eating on a raisin, a pomegranate, a bowl of chitlins, two bananas, three Hershey bars, listening to the Grand Old Opry of TV, sipping on a RC coke a cola and signing "Does your crewing gum lose it's favor and the bed post over night." That one no... How about? "Ou ee, ou ah ah, ting tang wala wala bing bang"? This one I know :) Only because my wife makes me watch grease though Lets see if you can get this one: The punk rolled up his big blue eyes And said to the jocker, "Sandy,I've hiked and hiked and wandered too, But I ain't seen any candy.I've hiked and hiked till my feet are sore And I'll be damned if I hike any moreTo be buggered sore like a hobo's whore" ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for email validation
Honestly, I'd stick to using php's filter extension. It -should- be the best one out there. If it is not processing something it should, then it's a bug - submit it so all of us benefit :) I am tired of trying to find regexps and all that every time, I put my stock into PHP's core when I can. On 8/27/08, Lupus Michaelis <[EMAIL PROTECTED]> wrote: > mike a écrit : > > > > php should have a good check built-in. > > > > see http://www.php.net/manual/en/function.filter-var.php > > > > Argh ! Howmany times it is in ? I spent so many time to write a regex that > belongs the RFC822 :-/ Because all the regex in answer here was false. They > don't allow email like "Mickael Doodoo"@lupusmic.com nor > [EMAIL PROTECTED] ; and they are valuable email addresses. Without > the fact that a top level domain isn't always between two and three > characters (think about .museum). > > -- > Mickaël Wolff aka Lupus Michaelis > http://lupusmic.org > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
Re: [PHP] Re: concatenating with "." or ","
On 27 Aug 2008, at 22:26, tedd wrote: At 7:35 PM +0100 8/27/08, Stut wrote: On 27 Aug 2008, at 18:44, Jay Blanchard wrote: [snip] Bah, who put me in a box with crayons. I'm a scalpel for crying out loud. Anyways, I could wax on forever, but cutting to the point... I think I'm hanging with the wrong bunch of tools. (multiple puns intended ;) [/snip] I, myself, am a hammer I like to think of myself as a laparoscopic surgery machine. -Stut So, what are you doing programming? :-) I like to take the occasional holiday doing something simpler than surgery. PHP fits the bill quite nicely. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Variable name as a string
At 12:07 AM +0200 8/28/08, Maciek Sokolewicz wrote: tedd wrote: At 1:58 PM -0500 8/27/08, Shawn McKenzie wrote: ioannes wrote: Actually, you are right, as you just put the checkbox index in the POST and get the value from there. So you just need the number of checkboxes...sorry. for ($i = 1; $i <= 4; $i++) { $a = 'a' . $i; $b = 'whatever' . $i; if($_POST[$a] == 'on') { my_array[] = $_POST[$b] } } Either I'm missing what you're trying to do, or this has become incredibly over complicated! -Shawn It's not over complicated, but just a method of passing checked checkbox values to a php array. Do you have something better? Cheers, tedd Well, this seems easier/cleaner to me: 1 1 1 1 $my_checked_checkboxes = $_REQUEST['my_checkboxes']; // whichever you wish, $_GET or $_POST, I don't care right now; you choose. Yeah, I remember that -- but a bit different. Don't use indexes, but rather just my_checkboxes[] and on the php side $my_checked_checkboxes = $_REQUEST['my_checkboxes']; The array $my_checked_checkboxes equals the $_REQUEST$_/$_POST/$_GET array -- all the indexes will match (i.e., $my_checked_checkboxes[3] is the same as $_POST[3]). The only problem I have with that method is that the [] becomes confusing with dealing with javascript that can also handles the form. One of the ways to get around this is to: That way php will use "name" and javascript will use "id". But, there are lot's of ways to do this. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: concatenating with "." or ","
At 1:03 PM -0500 8/27/08, Jay Blanchard wrote: [snip] My memory may be a bit off but I think tedd is around 4017 (he uses rocks if you can recall) [/snip] I am certainly no less virile. Let's see if anyone can GREP this reference for my age; I was born "The Day the Music Died" That's easy -- Bye bye American pie. Drove my Chevy to the levy and the levy was dry. Good old boys drinking whiskey and Rye singing this will be the day that I die... this will be the day that I die. Who can identify (no fair using Google): "There she was friends and neighbors in all her radiant beauty eating on a raisin, a pomegranate, a bowl of chitlins, two bananas, three Hershey bars, listening to the Grand Old Opry of TV, sipping on a RC coke a cola and signing "Does your crewing gum lose it's favor and the bed post over night." How about? "Ou ee, ou ah ah, ting tang wala wala bing bang"? I can go back a couple of centuries on this game. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for email validation
This one time, at band camp, Yeti <[EMAIL PROTECTED]> wrote: > # this one worked fine for me, but it does not cover the full RFC > like: "name" [EMAIL PROTECTED] OR name <[EMAIL PROTECTED]> > $regex = > "^[a-z0-9,!#\$%&'\*\+/=\?\^_`\{\|}~-]+(\.[a-z0-9,!#\$%&'\*\+/=\?\^_`\{\|}~-]+)[EMAIL > PROTECTED](\.[a-z0-9-]+)*\.([a-z]{2,})$"; > if (eregi($regex, $email)) { > // do something > } > # Beware that the filter functions only work under PHP5+. If your PHP > supports them they should be the preferred choice > ?> There is no silver bullet regex to validate all RFC compliant email address. Many have tried, but they all fail at some point. The best you can do is cater to most _sane_ addresses. And when the domain name space is opened up, well, you will back to strpos() and @ Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for email validation
At 8:35 PM +0200 8/27/08, Per Jessen wrote: > So, regardless of the documentation, which may be outdated, I know > that Unicode characters can be used in IDNS and thus on both sides of the @, You're wrong - IDNs only apply to the right side of the @. (check out what the 'D' means). The D in IDNS is Internationalized "Domain" Names -- note what the 'I' stands for. I was wrong to say that Unicode code points can be used on the LHS of the @ but domain names contain Unicode code points (in fact, that's all they contain) and thus these code points can appear on the RHS of email. For example, one *can* use other than ASCII characters in a domain name -- that's what the IDNS WG was for solving. The WG did solve this issue and came up with a way to do that -- the current algorithm is called PUNYCODE which allows Unicode code-points to appear in a domain name. I know this to be true because I have several domains that lie outside the standard ASCII AND they are real domains that have real web sites. For example: http://xn--u2g.com If you have a browser (like Safari) that is capable of showing the URL in it's native charset, then you will see the Rx.com in the url. If not, then you'll see xn--u2g.com. Now, email can be sent from that domain, but I have not found an application that will send nor receive it. The software has simply not caught up with the technology. One thing for sure, as the rest of the world logs on, more and more people will demand that their applications will implement the capabilities of the current IDNS. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Variable name as a string
First, the type is checkbox, not check. Second, you cannot put a value in the brackets for a checkbox group. A checkbox group is passed to PHP automatically as an array. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Maciek Sokolewicz wrote: > Well, this seems easier/cleaner to me: > > 1 > 1 > 1 > 1 > > $my_checked_checkboxes = $_REQUEST['my_checkboxes'];// whichever > you wish, $_GET or $_POST, I don't care right now; you choose. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Variable name as a string
tedd wrote: At 1:58 PM -0500 8/27/08, Shawn McKenzie wrote: ioannes wrote: Actually, you are right, as you just put the checkbox index in the POST and get the value from there. So you just need the number of checkboxes...sorry. for ($i = 1; $i <= 4; $i++) { $a = 'a' . $i; $b = 'whatever' . $i; if($_POST[$a] == 'on') { my_array[] = $_POST[$b] } } " John Either I'm missing what you're trying to do, or this has become incredibly over complicated! -Shawn It's not over complicated, but just a method of passing checked checkbox values to a php array. Do you have something better? Cheers, tedd Well, this seems easier/cleaner to me: 1 1 1 1 $my_checked_checkboxes = $_REQUEST['my_checkboxes']; // whichever you wish, $_GET or $_POST, I don't care right now; you choose. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for email validation
At 8:35 PM +0200 8/27/08, Per Jessen wrote: Go on, send me that email to '[EMAIL PROTECTED]' ... for what it's worth, I can't even define an account like that, so my mailserver might well reject it. Yes, you are right. I was thinking of something else, namely that the LHS of the email address is case-sensitive -- this was something that was discussed about five years ago on the IDNS list, of which I attended. Considering that the list was created to solve the IDNS problem, I mistakenly remembered them were discussing IDNS problems, but instead they were discussing case-sensitivity. Sorry to add to the confusion. tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Variable name as a string
At 1:58 PM -0500 8/27/08, Shawn McKenzie wrote: ioannes wrote: Actually, you are right, as you just put the checkbox index in the POST and get the value from there. So you just need the number of checkboxes...sorry. for ($i = 1; $i <= 4; $i++) { $a = 'a' . $i; $b = 'whatever' . $i; if($_POST[$a] == 'on') { my_array[] = $_POST[$b] } } " John Either I'm missing what you're trying to do, or this has become incredibly over complicated! -Shawn It's not over complicated, but just a method of passing checked checkbox values to a php array. Do you have something better? Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: concatenating with "." or ","
At 2:54 PM -0400 8/27/08, Robert Cummings wrote: Pamela Anderson still confuses me... as do a lot of so called stars. They all look so plasticky. I tend to err on the side of caution and just assume they're not real. Cheers, Rob. Well, I'm not confused I know what all of those plasticky parts are for. I'm a guy, real doesn't count for much. :-) Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: concatenating with "." or ","
At 7:35 PM +0100 8/27/08, Stut wrote: On 27 Aug 2008, at 18:44, Jay Blanchard wrote: [snip] Bah, who put me in a box with crayons. I'm a scalpel for crying out loud. Anyways, I could wax on forever, but cutting to the point... I think I'm hanging with the wrong bunch of tools. (multiple puns intended ;) [/snip] I, myself, am a hammer I like to think of myself as a laparoscopic surgery machine. -Stut So, what are you doing programming? :-) Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for email validation
Per Jessen a écrit : I don't know, but I suspect due to lack of support in popular mailers and mail-servers. Also, the use of quotes does make it cumbersome to work with, both as a user and as a mailserver admin. I had to write some pieace of code that can handle "toto toto"@ndd five years ago, it was Lotus Mail habits of the end users ;) -- Mickaël Wolff aka Lupus Michaelis http://lupusmic.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Sending a POST variable to an ASP page
On Wed, Aug 27, 2008 at 2:41 PM, shaun thornburgh < [EMAIL PROTECTED]> wrote: > > To: php-general@lists.php.net> Date: Wed, 27 Aug 2008 14:07:31 -0500> > From: [EMAIL PROTECTED]> Subject: [PHP] Re: Sending a POST variable to > an ASP page> > shaun thornburgh wrote:> > Hi,> > > > I need to send a post > variable to an ASP page, can I do this within my PHP script?> > > > I don't > need to view the page, or get any acknowledgment back, just send the single > POST variable...> > > > Thanks for your advice> > > _> > Get > Hotmail on your mobile from Vodafone > > > http://clk.atdmt.com/UKM/go/107571435/direct/01/> > If you don't mind > building the headers yourself in the code, it's just a > matter of using > fsockopen() and then fputs().> > -Shawn> > -- > PHP General Mailing List ( > http://www.php.net/)> To unsubscribe, visit: http://www.php.net/unsub.php> > > Hi Shawn, I have tried the following but it doesnt seem to work: > foreach($_POST['newsletter-group'] as $key => $value){ > $_POST['addressbookid'] = $value; $out = "POST /signup.ashx";$fp = > fsockopen("server-url", 80, $errno, $errstr, 30); if (!$fp) {echo > "$errstr ($errno)\n"; } else { fputs($fp, $out . "\r\n");} > fclose($fp); } Am I building the headers incorrectly? > _ > Make a mini you on Windows Live Messenger! > http://clk.atdmt.com/UKM/go/107571437/direct/01/ dude, honestly, why would you take that approach unless you had a particular reason for it? especially when you can knock it out in 2 minutes w/ curl... btw, google is pretty key as usual, try googling 'php curl post' ;) -nathan
RE: [PHP] Re: Sending a POST variable to an ASP page
> To: php-general@lists.php.net> Date: Wed, 27 Aug 2008 14:07:31 -0500> From: > [EMAIL PROTECTED]> Subject: [PHP] Re: Sending a POST variable to an ASP page> > > shaun thornburgh wrote:> > Hi,> > > > I need to send a post variable to an > ASP page, can I do this within my PHP script?> > > > I don't need to view the > page, or get any acknowledgment back, just send the single POST variable...> > > > > Thanks for your advice> > > _> > Get > Hotmail on your mobile from Vodafone > > > http://clk.atdmt.com/UKM/go/107571435/direct/01/> > If you don't mind > building the headers yourself in the code, it's just a > matter of using > fsockopen() and then fputs().> > -Shawn> > -- > PHP General Mailing List > (http://www.php.net/)> To unsubscribe, visit: http://www.php.net/unsub.php> Hi Shawn, I have tried the following but it doesnt seem to work: foreach($_POST['newsletter-group'] as $key => $value){ $_POST['addressbookid'] = $value; $out = "POST /signup.ashx";$fp = fsockopen("server-url", 80, $errno, $errstr, 30); if (!$fp) {echo "$errstr ($errno)\n"; } else { fputs($fp, $out . "\r\n");} fclose($fp); } Am I building the headers incorrectly? _ Make a mini you on Windows Live Messenger! http://clk.atdmt.com/UKM/go/107571437/direct/01/
Re: [PHP]About the magic function __call
My information was incomplete: I'm running php 5.1.2 (a requirement from the customer). I found this http://bugs.php.net/bug.php?id=42937 I "coded" this without testing, using only the idea. Thanks! Thanks for the help Nathan! 2008/8/27 Nathan Nobbe <[EMAIL PROTECTED]> > On Wed, Aug 27, 2008 at 1:49 PM, Nathan Nobbe <[EMAIL PROTECTED]>wrote: > >> On Wed, Aug 27, 2008 at 1:35 PM, Paulo Sousa <[EMAIL PROTECTED] >> > wrote: >> ... >> > > this *should* work, > > here is a test, tests/classes/__call_005.phpt, you can take the part > beneath the --FILE-- section and see if it blows up on your system or not. > right now, im getting errors on a php5.2.5 system, and its working as > expected on a php5.2.6 system. > > --TEST-- > When __call() is invoked via ::, ensure private implementation of __call() > in superclass is accessed without error. > --FILE-- > class A { > private function __call($strMethod, $arrArgs) { > echo "In " . __METHOD__ . "($strMethod, array(" . > implode(',',$arrArgs) . "))\n"; > var_dump($this); > } > } > > class B extends A { > function test() { > A::test1(1,'a'); > B::test2(1,'a'); > self::test3(1,'a'); > parent::test4(1,'a'); > } > } > > $b = new B(); > $b->test(); > ?> > --EXPECTF-- > In A::__call(test1, array(1,a)) > object(B)#1 (0) { > } > In A::__call(test2, array(1,a)) > object(B)#1 (0) { > } > In A::__call(test3, array(1,a)) > object(B)#1 (0) { > } > In A::__call(test4, array(1,a)) > object(B)#1 (0) { > } > > also, i found in the code you posted, you are missing a 'function' in front > of doWhatever (cause a parse error, which is why i mention it); w/ the > following modification to your code, its running fine on a php 5.2.6 system, > and choking on 5.2.5; > > function __call($function, $args){ > var_dump($function); > var_dump($args); > $this->doWhatever(); > } > >private function doWhatever() { > } > > [EMAIL PROTECTED] ~/unpack/php-5.2.6RC3/tests/classes $ php testOtherStuff.php > string(5) "drive" > array(1) { > [0]=> > string(7) "testing" > } > > -nathan > > (sorry for the long-winded post) >
Re: [PHP]About the magic function __call
On Wed, Aug 27, 2008 at 1:49 PM, Nathan Nobbe <[EMAIL PROTECTED]>wrote: > On Wed, Aug 27, 2008 at 1:35 PM, Paulo Sousa <[EMAIL PROTECTED]>wrote: > ... > this *should* work, here is a test, tests/classes/__call_005.phpt, you can take the part beneath the --FILE-- section and see if it blows up on your system or not. right now, im getting errors on a php5.2.5 system, and its working as expected on a php5.2.6 system. --TEST-- When __call() is invoked via ::, ensure private implementation of __call() in superclass is accessed without error. --FILE-- test(); ?> --EXPECTF-- In A::__call(test1, array(1,a)) object(B)#1 (0) { } In A::__call(test2, array(1,a)) object(B)#1 (0) { } In A::__call(test3, array(1,a)) object(B)#1 (0) { } In A::__call(test4, array(1,a)) object(B)#1 (0) { } also, i found in the code you posted, you are missing a 'function' in front of doWhatever (cause a parse error, which is why i mention it); w/ the following modification to your code, its running fine on a php 5.2.6 system, and choking on 5.2.5; function __call($function, $args){ var_dump($function); var_dump($args); $this->doWhatever(); } private function doWhatever() { } [EMAIL PROTECTED] ~/unpack/php-5.2.6RC3/tests/classes $ php testOtherStuff.php string(5) "drive" array(1) { [0]=> string(7) "testing" } -nathan (sorry for the long-winded post)
Re: [PHP]About the magic function __call
On Wed, Aug 27, 2008 at 1:35 PM, Paulo Sousa <[EMAIL PROTECTED]>wrote: > Hi there! > > I'm working with the following code: > > > abstract class Foo{ > > protected $a; > protected $b; > protected $c; > > function __construct($arg){ > $this->a = $arg; > } > > function __call($function, $args){ > $this->b = $function; > $this->c = $args; > $this->doWhatever(); > } > > private doWhatever(){ > } > } > > > class Boo extends Foo{ > > protected $e; > > public function __construct(){ > parent::__construct('Blah'); > } > > public function drive(){ > $e = 'testing'; > parent::drive($e); > } > } > > > $br = new Boo(); > $br->drive(); > > > > But I get a Fatal error: Call to undefined method Foo::drive() > > The magic fuction __call don't catch the "drive()". Why not? > > I need another idea for this problem and avoid edit the abstract class. looks like __call() might not work through a subclass if defined in the parent; i might poke around in the .phpt tests that come w/ the php source to ensure this is the correct behavior. in the meantime you can get away w/ some variant this ugliness, class B extends A { function __call($method, $args) { return parent::__call($method, $args); } } -nathan
[PHP]About the magic function __call
Hi there! I'm working with the following code: a = $arg; } function __call($function, $args){ $this->b = $function; $this->c = $args; $this->doWhatever(); } private doWhatever(){ } } class Boo extends Foo{ protected $e; public function __construct(){ parent::__construct('Blah'); } public function drive(){ $e = 'testing'; parent::drive($e); } } $br = new Boo(); $br->drive(); But I get a Fatal error: Call to undefined method Foo::drive() The magic fuction __call don't catch the "drive()". Why not? I need another idea for this problem and avoid edit the abstract class. Sorry about the english. Thanks for any help
Re: [PHP] Regex for email validation
Lupus Michaelis wrote: > Per Jessen a écrit : > >> That format is about as dead as the dinosaurs. > >Why ? I don't know, but I suspect due to lack of support in popular mailers and mail-servers. Also, the use of quotes does make it cumbersome to work with, both as a user and as a mailserver admin. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: concatenating with "." or ","
On Wed, 2008-08-27 at 14:57 -0400, tedd wrote: > At 1:55 PM -0400 8/27/08, Robert Cummings wrote: > >My memory may be a bit off but I think tedd is around 4017 (he uses > >rocks if you can recall) but I have no idea about your age... myself I'm > >a virile 34 year old :D > > > >Cheers, > >Rob. > > I've been around long enough to remember that pyramids were the first > real constants. > > As for 34, I thought you were younger. But at 34 ,you've already > passed your prime (in all things) -- you might as well be as old as > me for it's all downhill from there. I dunno... I've got another son on his way due early October... and with the other 2 kids I swear it feels like an uphill climb :) At any rate, I've got another prime coming up at 37... then there's 41, 43, 47, etc. Plenty of prime left in me ;) > My advice, start saving now for your Internet connection in the rest > home -- because they won't allow you to bring your blow-up doll and > what are you going to do for entertainment without the net? Saving? I bleed money to things like kindergarten supplies, clothes, food, gymnastics, swimming, play groups, etc, etc, etc. My wife stays home though, so at least there's no daycare costs and I see my kids a lot. I'm a happy bleeder though :D Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending a POST variable to an ASP page
heres a simple example shaun, $cH = curl_init('url to asp box'); curl_setopt_array( $cH, array( CURLOPT_POST => TRUE, * CURLOPT_POSTFIELDS* => array( 'yourParamName' => 'yourParamVal' ) )); $response = curl_exec($cH); personally though, i prefer the http extension and its much cleaner api. -nathan
[PHP] Re: Sending a POST variable to an ASP page
shaun thornburgh wrote: Hi, I need to send a post variable to an ASP page, can I do this within my PHP script? I don't need to view the page, or get any acknowledgment back, just send the single POST variable... Thanks for your advice _ Get Hotmail on your mobile from Vodafone http://clk.atdmt.com/UKM/go/107571435/direct/01/ If you don't mind building the headers yourself in the code, it's just a matter of using fsockopen() and then fputs(). -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Variable name as a string
ioannes wrote: Actually, you are right, as you just put the checkbox index in the POST and get the value from there. So you just need the number of checkboxes...sorry. ioannes wrote: Yes, Tedd, this does however incur the overhead of find out what i is, because it could be a range of IDs from the database, not necessarily a count of the checkboxes on the page: " for ($i = 1; $i <= 4; $i++) { $a = 'a' . $i; $b = 'whatever' . $i; if($_POST[$a] == 'on') { my_array[] = $_POST[$b] } } " John Either I'm missing what you're trying to do, or this has become incredibly over complicated! -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending a POST variable to an ASP page
On Wed, Aug 27, 2008 at 12:13 PM, tedd <[EMAIL PROTECTED]> wrote: > At 5:54 PM + 8/27/08, shaun thornburgh wrote: > >> Hi, >> >> I need to send a post variable to an ASP page, can I do this within my PHP >> script? >> >> I don't need to view the page, or get any acknowledgment back, just send >> the single POST variable... > > use the curl or http extension. The point is not IF php can send a POST (it can), but rather can ASP receive > a POST? if this were the case i doubt asp would have ever been used at all ;) -nathan
RE: [PHP] Re: concatenating with "." or ","
At 1:55 PM -0400 8/27/08, Robert Cummings wrote: My memory may be a bit off but I think tedd is around 4017 (he uses rocks if you can recall) but I have no idea about your age... myself I'm a virile 34 year old :D Cheers, Rob. I've been around long enough to remember that pyramids were the first real constants. As for 34, I thought you were younger. But at 34 ,you've already passed your prime (in all things) -- you might as well be as old as me for it's all downhill from there. My advice, start saving now for your Internet connection in the rest home -- because they won't allow you to bring your blow-up doll and what are you going to do for entertainment without the net? :-) Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Sending a POST variable to an ASP page
> Date: Wed, 27 Aug 2008 14:13:23 -0400> To: php-general@lists.php.net> From: > [EMAIL PROTECTED]> Subject: Re: [PHP] Sending a POST variable to an ASP page> > > At 5:54 PM + 8/27/08, shaun thornburgh wrote:> >Hi,> >> >I need to send > a post variable to an ASP page, can I do this within > >my PHP script?> >> >I > don't need to view the page, or get any acknowledgment back, just > >send the > single POST variable...> > The point is not IF php can send a POST (it can), > but rather can ASP > receive a POST?> Hi Tedd, The ASP script has been set up to receive POST variables from a form.> Cheers,> > tedd> > -- > ---> http://sperling.com http://ancientstones.com http://earthstones.com> > -- > PHP General Mailing List (http://www.php.net/)> To unsubscribe, visit: http://www.php.net/unsub.php> _ Win New York holidays with Kellogg’s & Live Search http://clk.atdmt.com/UKM/go/107571440/direct/01/
RE: [PHP] Re: concatenating with "." or ","
On Wed, 2008-08-27 at 14:49 -0400, tedd wrote: > At 12:44 PM -0500 8/27/08, Jay Blanchard wrote: > >tedd-o has been around for a long time and has witnessed the evolution > >of said blow-ups dolls enough to know when he sees quality, form and > >function. > > > >I think I may be the second oldest regular on the listtedd and I had > >that discussion once before. So I am stuck neither in the toolbox or the > >crayon box. > > Rob's pretty good, he can recognize women two out of three times. So > it's understandable that blow-ups enter any conversation he has about > women. :-) Pamela Anderson still confuses me... as do a lot of so called stars. They all look so plasticky. I tend to err on the side of caution and just assume they're not real. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for email validation
Per Jessen a écrit : That format is about as dead as the dinosaurs. Why ? -- Mickaël Wolff aka Lupus Michaelis http://lupusmic.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: concatenating with "." or ","
On Wed, 2008-08-27 at 14:44 -0400, tedd wrote: > At 1:24 PM -0400 8/27/08, Robert Cummings wrote: > >On Wed, 2008-08-27 at 13:17 -0400, tedd wrote: > > > As it is, you Stut, Rob, and Daniel are going to be the ones who > >> fight out who's the sharpest crayon in this box. I'm glad I no longer > >> have to defend that title (as if I ever did). > > > >Bah, who put me in a box with crayons. I'm a scalpel for crying out > >loud. Anyways, I could wax on forever, but cutting to the point... I > >think I'm hanging with the wrong bunch of tools. > > > >(multiple puns intended ;) > > :-) > > Don't give up your day job for stand-up. > > > > >> But, I would rather get the good looking girl anyway (as I have > >> already done). :-) > > > >Isn't it amazing the amount of choice in blow up dolls these days? > > > >(ducks and runs) > > > >Cheers, > >Rob. > > LOL! Good one! > > My wife just got her gun and is asking "Who is the Rob character anyway?" So you could say she's blowing up at me? That's awesome!! Self-inflating! ;) Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: concatenating with "." or ","
At 12:44 PM -0500 8/27/08, Jay Blanchard wrote: tedd-o has been around for a long time and has witnessed the evolution of said blow-ups dolls enough to know when he sees quality, form and function. I think I may be the second oldest regular on the listtedd and I had that discussion once before. So I am stuck neither in the toolbox or the crayon box. Rob's pretty good, he can recognize women two out of three times. So it's understandable that blow-ups enter any conversation he has about women. :-) Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: concatenating with "." or ","
At 1:24 PM -0400 8/27/08, Robert Cummings wrote: On Wed, 2008-08-27 at 13:17 -0400, tedd wrote: > As it is, you Stut, Rob, and Daniel are going to be the ones who fight out who's the sharpest crayon in this box. I'm glad I no longer have to defend that title (as if I ever did). Bah, who put me in a box with crayons. I'm a scalpel for crying out loud. Anyways, I could wax on forever, but cutting to the point... I think I'm hanging with the wrong bunch of tools. (multiple puns intended ;) :-) Don't give up your day job for stand-up. But, I would rather get the good looking girl anyway (as I have already done). :-) Isn't it amazing the amount of choice in blow up dolls these days? (ducks and runs) Cheers, Rob. LOL! Good one! My wife just got her gun and is asking "Who is the Rob character anyway?" Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: concatenating with "." or ","
At 1:24 PM -0400 8/27/08, Jason Pruim wrote: On Aug 27, 2008, at 1:17 PM, tedd wrote: At 5:46 PM +0100 8/27/08, Colin Guthrie wrote: tedd wrote: PS: As for me -- thanks, but I'm not the smart one on this list -- just the best looking. :-) Age before beauty. oh wait. Dang. :p Col Yes, I have both those categories tied up. As it is, you Stut, Rob, and Daniel are going to be the ones who fight out who's the sharpest crayon in this box. I'm glad I no longer have to defend that title (as if I ever did). But, I would rather get the good looking girl anyway (as I have already done). :-) Hey... Why aren't I included in the fight for the sharpest crayon in the box? :P I'll be the underdog! Jason Pruim I'm sorry, the two remaining categories are: 1) The ugliest; 2) and, the dullest crayon. You care to try out for either of those? :-) Sometimes, it's best not to be in the running for anything. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: concatenating with "." or ","
On 27 Aug 2008, at 18:44, Jay Blanchard wrote: [snip] Bah, who put me in a box with crayons. I'm a scalpel for crying out loud. Anyways, I could wax on forever, but cutting to the point... I think I'm hanging with the wrong bunch of tools. (multiple puns intended ;) [/snip] I, myself, am a hammer I like to think of myself as a laparoscopic surgery machine. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for email validation
tedd wrote: > >>No, they can't. There are no 8-bit characters allowed in an >>email-address. Check out RFC2821. > > You can throw all the facts and documentation you want at me, but the > left side of the @ has always been open to anything you want. Except anything 8-bit, yes. Seriously, read RFC2821 and maybe -2822 > The right side of the @ has had to deal with 7-bit limitation (the > DNS problem). But, considering the work that the IDNS has done, (circa > 2000) we can use Unicode characters on both sides of the @. No, you cannot. Certainly not on the left side, and only on the right side if you assume visual representation = email-address. Why don't you send me an email at this address: [EMAIL PROTECTED] (that's an a with accent grave like in your domain further down). > However, the software (browsers and email apps) may/may-not be able to > deal with it, as shown by my recent example of: > >> > [EMAIL PROTECTED] >>> >>> is a legal and working email address. >> >>If that reads "tedd(at).com", it might be valid on your system, >>but not in public. > > The email address is perfectly valid, and works, > but our definition of "public" is apparently > different. Sorry, I didn't see the a with the accent grave. Still, try using that address in Thunderbird, and you'll see that it doesn't work. The correct email-address (which is what we're talking about) for '[EMAIL PROTECTED]' is [EMAIL PROTECTED], which an email-system like sendmail/exim/postfix/etc will understand (whereas it will choke on '[EMAIL PROTECTED]'. > So, regardless of the documentation, which may be outdated, I know > that Unicode characters can be used in IDNS and thus on both sides of > the @, You're wrong - IDNs only apply to the right side of the @. (check out what the 'D' means). Go on, send me that email to '[EMAIL PROTECTED]' ... for what it's worth, I can't even define an account like that, so my mailserver might well reject it. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Variable name as a string
Actually, you are right, as you just put the checkbox index in the POST and get the value from there. So you just need the number of checkboxes...sorry. ioannes wrote: Yes, Tedd, this does however incur the overhead of find out what i is, because it could be a range of IDs from the database, not necessarily a count of the checkboxes on the page: " for ($i = 1; $i <= 4; $i++) { $a = 'a' . $i; $b = 'whatever' . $i; if($_POST[$a] == 'on') { my_array[] = $_POST[$b] } } " John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Variable name as a string
At 7:08 PM +0100 8/27/08, ioannes wrote: Yes, Tedd, this does however incur the overhead of find out what i is, because it could be a range of IDs from the database, not necessarily a count of the checkboxes on the page: " for ($i = 1; $i <= 4; $i++) { $a = 'a' . $i; $b = 'whatever' . $i; if($_POST[$a] == 'on') { my_array[] = $_POST[$b] } } " John John: Yes, and I thought that I showed you how to handle that -- that an easy thing to do. You simply list all the items you want to expose to the user for the user's consideration to delete. Then you accept what the user has selected and delete them accordingly. (However, you should work out a way to clean this information before doing anything). I only added the count thing IF you wanted to know how many deletions the user selected. Please review what I said and consider. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: concatenating with "." or ","
[snip] 1959 [/snip] Very good! That puts me learning / writing Fortran when you were in diapersassuming you wore diapers of course. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending a POST variable to an ASP page
At 5:54 PM + 8/27/08, shaun thornburgh wrote: Hi, I need to send a post variable to an ASP page, can I do this within my PHP script? I don't need to view the page, or get any acknowledgment back, just send the single POST variable... The point is not IF php can send a POST (it can), but rather can ASP receive a POST? Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for email validation
At 7:55 PM +0200 8/27/08, Lupus Michaelis wrote: mike a écrit : php should have a good check built-in. see http://www.php.net/manual/en/function.filter-var.php Argh ! Howmany times it is in ? I spent so many time to write a regex that belongs the RFC822 :-/ Because all the regex in answer here was false. They don't allow email like "Mickael Doodoo"@lupusmic.com nor [EMAIL PROTECTED] ; and they are valuable email addresses. Without the fact that a top level domain isn't always between two and three characters (think about .museum). Or TLD's like: http://tedd.mobi/ Things are a changing fast. Just wait until you start designing stuff for cell phones. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Variable name as a string
Yes, Tedd, this does however incur the overhead of find out what i is, because it could be a range of IDs from the database, not necessarily a count of the checkboxes on the page: " for ($i = 1; $i <= 4; $i++) { $a = 'a' . $i; $b = 'whatever' . $i; if($_POST[$a] == 'on') { my_array[] = $_POST[$b] } } " John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: concatenating with "." or ","
On Wed, 2008-08-27 at 13:03 -0500, Jay Blanchard wrote: > [snip] > My memory may be a bit off but I think tedd is around 4017 (he uses > rocks if you can recall) > [/snip] > > I am certainly no less virile. Let's see if anyone can GREP this > reference for my age; I was born "The Day the Music Died" 1959 :) Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for email validation
At 6:30 PM +0200 8/27/08, Per Jessen wrote: Well, I left that for the OP to figure out. Still, your regex is worse - a domain name cannot contain '%'. The only valid characters for a domain name are letters, numbers and a hyphen. Also, maximum length for a domain name is 64 characters, which could/should be checked too. Well, I stole that regex anyway -- I agree that % should have not been there. No, they can't. There are no 8-bit characters allowed in an email-address. Check out RFC2821. You can throw all the facts and documentation you want at me, but the left side of the @ has always been open to anything you want. The right side of the @ has had to deal with 7-bit limitation (the DNS problem). But, considering the work that the IDNS has done, (circa 2000) we can use Unicode characters on both sides of the @. However, the software (browsers and email apps) may/may-not be able to deal with it, as shown by my recent example of: > [EMAIL PROTECTED] is a legal and working email address. If that reads "tedd(at).com", it might be valid on your system, but not in public. The email address is perfectly valid, and works, but our definition of "public" is apparently different. I claim if it's valid on any system, then it's public. I don't hold to the notion that if M$ doesn't recognize it then it isn't public. M$ has always had it's collective head up it's vested interest butt anyway. For demonstration Safari has absolutely no problems dealing with IDNS, whereas all IE's do. To prove my point, if you have Safari, try entering option v into the browser URL box and hit return. You don't have to enter anything else (i.e., no http://, www, or dot com). What will happen is that you will be automagically transported to one of my sites where the url is square-root dot com. However if you're dealing with one of the leading "also-ran" IE browsers, then you'll see the PUNYCODE equivalent, which was never intended to be seen by end users anyway. Just another example of how M$ always has a better idea. So, regardless of the documentation, which may be outdated, I know that Unicode characters can be used in IDNS and thus on both sides of the @, but it's the software that needs to catch up to the technology. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for email validation
Lupus Michaelis wrote: >Argh ! Howmany times it is in ? I spent so many time to write a >regex > that belongs the RFC822 :-/ Because all the regex in answer here was > false. They don't allow email like "Mickael Doodoo"@lupusmic.com nor That format is about as dead as the dinosaurs. I know it IS a valid format, but ... /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: concatenating with "." or ","
[snip] My memory may be a bit off but I think tedd is around 4017 (he uses rocks if you can recall) [/snip] I am certainly no less virile. Let's see if anyone can GREP this reference for my age; I was born "The Day the Music Died" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: concatenating with "." or ","
On Wed, 2008-08-27 at 12:44 -0500, Jay Blanchard wrote: > [snip] > Bah, who put me in a box with crayons. I'm a scalpel for crying out > loud. Anyways, I could wax on forever, but cutting to the point... I > think I'm hanging with the wrong bunch of tools. > > (multiple puns intended ;) > [/snip] > > I, myself, am a hammer Can't touch this... do do de do! > [sniperoo] > > But, I would rather get the good looking girl anyway (as I have > > already done). :-) > > Isn't it amazing the amount of choice in blow up dolls these days? > > (ducks and runs) > [/sniperoo] > > tedd-o has been around for a long time and has witnessed the evolution > of said blow-ups dolls enough to know when he sees quality, form and > function. tedd has been around long enough to be an honourary member of the product testing department. > > I think I may be the second oldest regular on the listtedd and I had > that discussion once before. So I am stuck neither in the toolbox or the > crayon box. My memory may be a bit off but I think tedd is around 4017 (he uses rocks if you can recall) but I have no idea about your age... myself I'm a virile 34 year old :D Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sending a POST variable to an ASP page
Hi, I need to send a post variable to an ASP page, can I do this within my PHP script? I don't need to view the page, or get any acknowledgment back, just send the single POST variable... Thanks for your advice _ Get Hotmail on your mobile from Vodafone http://clk.atdmt.com/UKM/go/107571435/direct/01/
Re: [PHP] Regex for email validation
mike a écrit : php should have a good check built-in. see http://www.php.net/manual/en/function.filter-var.php Argh ! Howmany times it is in ? I spent so many time to write a regex that belongs the RFC822 :-/ Because all the regex in answer here was false. They don't allow email like "Mickael Doodoo"@lupusmic.com nor [EMAIL PROTECTED] ; and they are valuable email addresses. Without the fact that a top level domain isn't always between two and three characters (think about .museum). -- Mickaël Wolff aka Lupus Michaelis http://lupusmic.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: concatenating with "." or ","
[snip] Bah, who put me in a box with crayons. I'm a scalpel for crying out loud. Anyways, I could wax on forever, but cutting to the point... I think I'm hanging with the wrong bunch of tools. (multiple puns intended ;) [/snip] I, myself, am a hammer [sniperoo] > But, I would rather get the good looking girl anyway (as I have > already done). :-) Isn't it amazing the amount of choice in blow up dolls these days? (ducks and runs) [/sniperoo] tedd-o has been around for a long time and has witnessed the evolution of said blow-ups dolls enough to know when he sees quality, form and function. I think I may be the second oldest regular on the listtedd and I had that discussion once before. So I am stuck neither in the toolbox or the crayon box. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] [OT|Troll] Re: [PHP] Re: PHP IDE needed
Sancar Saran a écrit : Whats wrong with echo "" > index.php Two syntacticals errors ? :p is there anything to satisfy your needs... I prefer cat for that purpose, more flexible. -- Mickaël Wolff aka Lupus Michaelis http://lupusmic.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: concatenating with "." or ","
On Wed, 2008-08-27 at 13:17 -0400, tedd wrote: > At 5:46 PM +0100 8/27/08, Colin Guthrie wrote: > >tedd wrote: > >>PS: As for me -- thanks, but I'm not the smart one on this list -- > >>just the best looking. :-) > > > >Age before beauty. oh wait. Dang. :p > > > >Col > > Yes, I have both those categories tied up. > > As it is, you Stut, Rob, and Daniel are going to be the ones who > fight out who's the sharpest crayon in this box. I'm glad I no longer > have to defend that title (as if I ever did). Bah, who put me in a box with crayons. I'm a scalpel for crying out loud. Anyways, I could wax on forever, but cutting to the point... I think I'm hanging with the wrong bunch of tools. (multiple puns intended ;) > But, I would rather get the good looking girl anyway (as I have > already done). :-) Isn't it amazing the amount of choice in blow up dolls these days? (ducks and runs) Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: concatenating with "." or ","
On Aug 27, 2008, at 1:17 PM, tedd wrote: At 5:46 PM +0100 8/27/08, Colin Guthrie wrote: tedd wrote: PS: As for me -- thanks, but I'm not the smart one on this list -- just the best looking. :-) Age before beauty. oh wait. Dang. :p Col Yes, I have both those categories tied up. As it is, you Stut, Rob, and Daniel are going to be the ones who fight out who's the sharpest crayon in this box. I'm glad I no longer have to defend that title (as if I ever did). But, I would rather get the good looking girl anyway (as I have already done). :-) Hey... Why aren't I included in the fight for the sharpest crayon in the box? :P I'll be the underdog! -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 11287 James St Holland, MI 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] concatenating with "." or ","
On Wed, 2008-08-27 at 13:13 -0400, tedd wrote: > At 12:17 PM -0400 8/27/08, Robert Cummings wrote: > >What does random have to do with > > Oh no! > > Someone mentioned the R word in front of Rob. > > We should put this in a list of things not to do on this list. *heheh* well in the above I'm not so concerned about the issue of random itself, but more about how it doesn't benefit the particular issue being benchmarked. Random (or pretend random depending on your randomly religious views ;) is certainly useful in some benchmarks... for instance testing the speed of a new sorting algorithm, or tree algorithm, etc when a broad data sample is necessary. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Benchmark for echoing via comma, concat, inteprolation, and heredoc.
On Wed, 2008-08-27 at 18:02 +0100, Colin Guthrie wrote: > Robert Cummings wrote: > > That echo benchmark though... WTF! > > Yup similar numbers here tho' not quite as staggering on my setup: Hah, your values led me to think about it... then I realized I've been playing around with Xen lately and was currently running the Xen kernel. This was having a huge performance penalty on my system... which is odd since I have a Quad Phenom Black Edition (must be at the kernel level then since my CPU load is miniscule). Anyways, rebooting to the non Xen kernel I get the following numbers which reflect the same distribution but are MUCH faster lol. shell:~> time php5 -qC test.echo.php > /dev/null real0m10.622s user0m5.380s sys 0m4.680s shell:~> time php5 -qC test.concat.php > /dev/null real0m4.875s user0m3.990s sys 0m0.870s shell:~> time php5 -qC test.interpol.php > /dev/null real0m4.799s user0m3.740s sys 0m1.050s shell:~> time php5 -qC test.heredoc.php > /dev/null real0m4.901s user0m3.750s sys 0m1.070s Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: concatenating with "." or ","
At 5:46 PM +0100 8/27/08, Colin Guthrie wrote: tedd wrote: PS: As for me -- thanks, but I'm not the smart one on this list -- just the best looking. :-) Age before beauty. oh wait. Dang. :p Col Yes, I have both those categories tied up. As it is, you Stut, Rob, and Daniel are going to be the ones who fight out who's the sharpest crayon in this box. I'm glad I no longer have to defend that title (as if I ever did). But, I would rather get the good looking girl anyway (as I have already done). :-) Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] concatenating with "." or ","
At 12:17 PM -0400 8/27/08, Robert Cummings wrote: What does random have to do with Oh no! Someone mentioned the R word in front of Rob. We should put this in a list of things not to do on this list. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Benchmark for echoing via comma, concat, inteprolation, and heredoc.
At 12:35 PM -0400 8/27/08, Robert Cummings wrote: -big snip- That echo benchmark though... WTF! Scripts are attached for your own testing / commenting about how much they suck ;) Cheers, Rob. Way to go Rob -- however, we have to realize that this is one of those things that only Geeks get excited about. The rest of the world meanders along not knowing what we've discovered. Oh, the ignorant fools -- if they only realized the knowledge and power we hold in the palm of our collective hands and appreciated how we administer this for the greater good of all. Someday, they might realize our contributions and build statues to our heroic efforts -- or do you think I'm going too far with this? Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Benchmark for echoing via comma, concat, inteprolation, and heredoc.
Robert Cummings wrote: That echo benchmark though... WTF! Yup similar numbers here tho' not quite as staggering on my setup: PHP 5.2.6 with Suhosin-Patch 0.9.6.2 (cli) (built: Aug 25 2008 10:09:21) Copyright (c) 1997-2008 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies (Tho' Suhosin is disabled). To summerise, the echo method took about twice as long as the others. shell:~> time php -qC test.echo.php >/dev/null 8.52user 8.23system 0:16.97elapsed 98%CPU (0avgtext+0avgdata 0maxresident)k 608inputs+0outputs (2major+2721minor)pagefaults 0swaps shell:~> time php -qC test.concat.php >/dev/null 7.16user 1.70system 0:08.94elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+2724minor)pagefaults 0swaps shell:~> time php -qC test.interpol.php >/dev/null 5.84user 1.76system 0:07.62elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+2724minor)pagefaults 0swaps shell:~> time php -qC test.heredoc.php >/dev/null 5.52user 1.73system 0:07.29elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+2723minor)pagefaults 0swaps shell:~> time php -qC test.echo.php >/dev/null 8.21user 8.08system 0:16.44elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+2723minor)pagefaults 0swaps shell:~> time php -qC test.concat.php >/dev/null 7.29user 1.66system 0:08.98elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+2724minor)pagefaults 0swaps shell:~> time php -qC test.interpol.php >/dev/null 6.34user 1.79system 0:08.15elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+2723minor)pagefaults 0swaps shell:~> time php -qC test.heredoc.php >/dev/null 6.10user 1.67system 0:07.79elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+2724minor)pagefaults 0swaps And just for sh1ts and giggles, I tried printf... which although I expected to be slow, it still turned out faster than the echo!!! shell:~> time php -qC test.printf.php >/dev/null 11.85user 1.67system 0:13.63elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+2727minor)pagefaults 0swaps shell:~> time php -qC test.printf.php >/dev/null 12.27user 1.69system 0:13.99elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+2728minor)pagefaults 0swaps -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mandriva Linux Contributor [http://www.mandriva.com/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/] test.printf.php Description: application/php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Variable name as a string
At 4:55 PM +0100 8/27/08, JOHN DILLON wrote: Perhaps this example may help. Eg: a form with checkboxes and submit button, a few are checked and I want to delete the corresponding records from the database. The database table has an ID column: for each ($argv as $key=>$value) { //$key is named cb_1 $value is "checked" //to get 1 from the key name, then //needed: function like nameof() $var=nameof($key); $ID=substr($var,3); $query="delete * from dbtable where ID='$ID'"; //etc } Okay, your data is coming in from a form and you want to translate that data to a php array -- here's how to do it: In your form you use: In your receiving php script, you use: for ($i = 1; $i <= 4; $i++) { $a = 'a' . $i; $b = 'whatever' . $i; if($_POST[$a] == 'on') { my_array[] = $_POST[$b] } } If a user clicks any/all of the checkboxes, then those checkboxes will be turned 'on' and the values associated with the hidden fields will come into play and be recorded in the my_array[]. A "count(my_array)" will provide you with the number of checkboxes that were actually checked. Sure you can do this in while statements if you wish, but the idea of how to translate checkboxes to a php array is here. The hidden values above could just as easily be values taken from a database corresponding to record deletions, such as: "> The point is that you can determine what the user clicked and tied it to whatever you presented. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: concatenating with "." or ","
tedd wrote: PS: As for me -- thanks, but I'm not the smart one on this list -- just the best looking. :-) Age before beauty. oh wait. Dang. :p Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mandriva Linux Contributor [http://www.mandriva.com/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Benchmark for echoing via comma, concat, inteprolation, and heredoc.
I've attached 4 scripts to benchmark each of the various methods of echoing content. I was very surprised to find that the state of things is completely out of synch with what many of us have come to expect. That said, I trust these benchmarks. Output has been redirected to /dev/null so that rendering to terminal is not an source of benchmark noise. I ran each twice because some things were just so surprising and I ran for PHP4 after running for PHP5 to contrast. So anyways... the benchmarks: shell:~> php5 -v PHP 5.2.5 (cli) (built: Aug 9 2008 01:24:36) Copyright (c) 1997-2007 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies with eAccelerator v0.9.5.2, Copyright (c) 2004-2006 eAccelerator, by eAccelerator shell:~> time php5 -qC test.echo.php > /dev/null real1m2.867s user0m14.285s sys 0m48.043s shell:~> time php5 -qC test.concat.php > /dev/null real0m15.453s user0m5.664s sys 0m9.785s shell:~> time php5 -qC test.interpol.php > /dev/null real0m15.098s user0m5.736s sys 0m9.353s shell:~> time php5 -qC test.heredoc.php > /dev/null real0m15.356s user0m5.020s sys 0m10.333s shell:~> time php5 -qC test.echo.php > /dev/null real1m1.689s user0m14.317s sys 0m47.371s shell:~> time php5 -qC test.concat.php > /dev/null real0m15.414s user0m5.888s sys 0m9.493s shell:~> time php5 -qC test.interpol.php > /dev/null real0m15.120s user0m5.488s sys 0m9.625s shell:~> time php5 -qC test.heredoc.php > /dev/null real0m15.250s user0m5.576s sys 0m9.665s Wow! Look at the time it takes for echo to run with multiple parameters. It's about 4 times longer than any other option. And all the other options are almost on perfect par. Considering this was interated 10 million times I don't think there's any reason to choose one method over another when considering concatenation, interpolation, or heredoc. But this is weird. We were told that echo was fastest a long time ago and heredoc was slowest. I'm not sure why multiple parameter echo is so piggishly slow but I'm guessing optimizations were done for interpolation and heredoc to make them on par with concatenation. But let's take a peek back to PHP4 to see what the same scripts do there: shell:~> php -v PHP 4.4.9 (cli) (built: Aug 9 2008 01:27:42) Copyright (c) 1997-2008 The PHP Group Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies with eAccelerator v0.9.5, Copyright (c) 2004-2006 eAccelerator, by eAccelerator shell:~> time php -qC test.echo.php > /dev/null real1m8.570s user0m20.961s sys 0m47.591s shell:~> time php -qC test.concat.php > /dev/null real0m19.879s user0m10.201s sys 0m9.657s shell:~> time php -qC test.interpol.php > /dev/null real0m28.446s user0m18.469s sys 0m9.973s shell:~> time php -qC test.heredoc.php > /dev/null real0m28.136s user0m18.465s sys 0m9.665s shell:~> time php -qC test.echo.php > /dev/null real1m10.657s user0m21.421s sys 0m49.223s shell:~> time php -qC test.concat.php > /dev/null real0m19.578s user0m10.073s sys 0m9.501s shell:~> time php -qC test.interpol.php > /dev/null real0m28.729s user0m18.681s sys 0m10.021s shell:~> time php -qC test.heredoc.php > /dev/null real0m27.875s user0m17.913s sys 0m9.961s Again we see that echo with multiple params sucks. But now we see the old expectations for interpolation and heredoc... though interestingly heredoc is pretty much on par with double quote interpolation. So it seems from PHP4 to PHP5 (current versions anyways) that interpolation and heredoc got a big boost to make them on par with concatenation. So I guess there's not much point any longer on being preachy about efficiency between these three options :) For those wondering btw, eAccelerator is benign for shell execution. That echo benchmark though... WTF! Scripts are attached for your own testing / commenting about how much they suck ;) Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP test.echo.php Description: application/php test.concat.php Description: application/php test.interpol.php Description: application/php test.heredoc.php Description: application/php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for email validation
Yeti wrote: > # this one worked fine for me, but it does not cover the full RFC > like: "name" [EMAIL PROTECTED] OR name <[EMAIL PROTECTED]> > $regex = > "^[a-z0-9,!#\$%&'\*\+/=\?\^_`\{\|}~-]+(\.[a-z0-9,!#\$%&'\*\+/=\ \^_`\{\|}~-]+)[EMAIL PROTECTED](\.[a-z0-9-]+)*\.([a-z]{2,})$"; For the domain part, I would check against "@([a-z0-9-]+\.)+[a-z0-9-]+" and then do a lookup for an A record. There are still some patterns that will fit the above, without being valid domain-names. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for email validation
tedd wrote: >> >>Option 1: /[EMAIL PROTECTED]/ >> >>This is probably what you meant: >> >>/[EMAIL PROTECTED]/ >> >>/Per Jessen, Zürich > > Which is probably what you meant: > > eregi("[EMAIL PROTECTED],6}$", $email) > > Email comes in different TLD flavors. Well, I left that for the OP to figure out. Still, your regex is worse - a domain name cannot contain '%'. The only valid characters for a domain name are letters, numbers and a hyphen. Also, maximum length for a domain name is 64 characters, which could/should be checked too. > But, even that still doesn't cover all the possible and legal Unicode > code-points that can exist on both sides of the @ of an email address. No, they can't. There are no 8-bit characters allowed in an email-address. Check out RFC2821. > [EMAIL PROTECTED] > > is a legal and working email address. If that reads "tedd(at).com", it might be valid on your system, but not in public. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] concatenating with "." or ","
On Wed, 2008-08-27 at 12:27 +0200, Bernhard Kohl wrote: > tedd wrote: > > There are significant orders of magnitude difference between your results > > and mine. > > For example, it didn't make any difference if you used a comma or > > concatenation, but in my system concatenation was 15 times faster than using > > a comma. Interesting, I would have guessed it would have been the other way > > around. > > I refined the test, so that it is more random and therefore maybe more > accurate. What does random have to do with the echo, concatenaton, interpolation, or heredoc functionality? I would presume these to be mutually exclusive. As such your test adds noise to the problem and is more than likely less accurate. > -- > For all those who want to try it out, here is the code: > -- > > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> > http://www.w3.org/1999/xhtml";> > > > Test for Tedd > > > Test Results > global $iterations, $results, $test_string; > $iterations = 2048; > $iterations2 = 128; // iterations for 2nd test > $results1 = array( > "comma" => array("total_time" => 0, "count" => 0), > "concat" => array("total_time" => 0, "count" => 0), > "interpol" => array("total_time" => 0, "count" => 0), > "heredoc" => array("total_time" => 0, "count" => 0) > > ); An array? You do realize that arrays are stored as some kind of tree with O( lg n ) lookup? This means that it WILL take longer to access some of those entries than it does for others. They can't all be sitting at the root node of the tree. These tests shoul dhave been run individually. > $results2 = $results1; > $test_array = array(); > $test_string = md5(time()); // a 32 character string > $eval_strings = create_eval_strings(); > for ($i = 0; $i < $iterations; ++$i) $test_array[] = > str_shuffle($test_string); // random strings Aggain I'd like to point out that randomizing the string more than likely does nothing for the benchmark. > for ($i = 0; $i < $iterations; ++$i) test_method(rand(0,3)); A function call... to a less than simplistic function (yes simple logically, complex when benchmarks should normally be run on the simplest representation of the problem). > function test_method($method) { > $start_time = $end_time = 0; > $test_array =& $GLOBALS['test_array']; > $test_string =& $GLOBALS['test_string']; > $eval_strings =& $GLOBALS['eval_strings']; > for ($i = 0; $i < 10; ++$i) { > $j = rand(0, $GLOBALS['iterations']); > $test_array[$j] = str_shuffle($test_array[$j]); // change some arr > vals to outsmart any php speedup/cache > } > $arr2 = array(); // array for 2nd test > for ($i = 0; $i < $GLOBALS['iterations2']; ++$i) $arr2[] = > $test_array[rand(0, $GLOBALS['iterations'])]; > # 1st test will output # of iterations random strings > # 2nd test will output a sequence of #iterations2 random strings > switch ($method) { > case 0: // comma > # -> TEST 1 <- > ob_start(); > $start_time = microtime(true); > foreach ($test_array as $array_value) { >echo $test_string, $array_value; > } > $end_time = microtime(true); > ob_end_clean(); > $GLOBALS["results1"]["comma"]["total_time"] += abs($end_time - > $start_time)*1000/$GLOBALS["iterations"]; > ++$GLOBALS["results1"]["comma"]["count"]; > # -> TEST 2 <- > ob_start(); > $start_time = microtime(true); > eval($eval_strings['comma']); > $end_time = microtime(true); > ob_end_clean(); > $GLOBALS["results2"]["comma"]["total_time"] += abs($end_time - > $start_time)*1000; > ++$GLOBALS["results2"]["comma"]["count"]; > break 1; Do you mind if I scream here... output buffering, eval, internal microtime function to measure the efficiency of multiple different approaches? These are all going to add to the noise. You should use the system's time command to determine actual time spent on the process. > case 1: // concatenation > # -> TEST 1 <- > ob_start(); > $start_time = microtime(true); > foreach ($test_array as $array_value) { >echo $test_string.$array_value; > } > $end_time = microtime(true); > ob_end_clean(); > $GLOBALS["results1"]["concat"]["total_time"] += abs($end_time - > $start_time)*1000/$GLOBALS["iterations"]; > ++$GLOBALS["results1"]["concat"]["count"]; > # -> TEST 2 <- > ob_start(); > $start_time = microtime(true); > eval($eval_strings['concat']); > $end_time = microtime(true); > ob_end_clean(); > echo $eval_string."\n"; > $GLOBALS["results2"]["concat"]["total_time"] += abs($end_time - > $start_time)*1000; > ++$GLOBALS["results2"]["concat"]["count"]; > break 1; > case 2: // interpolation > # -> TE
[PHP] Re: [PHP-DB] Problem with updating MySQL table
On Aug 27, 2008, at 12:06 PM, Jason Pruim wrote: Hi Everyone, So I'm working on a project (Same one I sent the question about regarding the user access rights on monday) And now I am attempting to update the record... Here is some of my code: index.php First Name/Last Namevalue="{$row['FName']}" $edit> value="{$row['LName']}" $edit> Email Address value="{$row['email']}" $edit> Company name value="{$row['Business']}" $edit> Company Address value="{$row['Address1']}" $edit> City/State/Zip value="{$row['City']}" $edit> value="{$row['State']}" $edit> value="{$row['Zip']}" $edit> Phone $edit> Your Favorite Type of coffee: value="Starbucks"> name="rdoCoffee" value="Other"> Other: name="txtCoffee" size="20"> When would a good time to bring it over be? name="txtMeeting"> ?> purlprocessing.php $sql = "UPDATE `schreur` set FName='{$FName}', LName='{$LName}', email='{$Email}', Business='{$Business}', Address1='{$Address1}', City='{$City}', State='{$State}', Zip='{$Zip}', Coffee='{$Coffee}', subscribed='0', date='{$date}', IPAddress='{$IPAddress}', Meeting='{$Meeting}' WHERE record='{$Record}'"; mysqli_query($link, $sql) or die("Could not update..." . mysqli_error($link)); ?> mysql> describe schreur; ++-+--+-+-+---+ | Field | Type| Null | Key | Default | Extra | ++-+--+-+-+---+ | FName | varchar(20) | YES | | NULL| | | LName | varchar(20) | YES | | NULL| | | email | varchar(50) | YES | | NULL| | | phone | varchar(12) | YES | | NULL| | | url| int(12) | YES | | NULL| | | record | int(7) | YES | | NULL| | | subscribed | int(1) | NO | | | | | date | varchar(12) | YES | | NULL| | | IPAddress | varchar(19) | YES | | NULL| | | Business | varchar(20) | YES | | NULL| | | Address1 | varchar(50) | YES | | NULL| | | City | varchar(20) | YES | | NULL| | | State | varchar(2) | YES | | NULL| | | Zip| varchar(10) | YES | | NULL| | | Coffee | varchar(20) | YES | | NULL| | | Meeting| text| YES | | NULL| | ++-+--+-+-+---+ The problem is when I am attempting to update some of the info, it erases the info in the field. Anyone got a clue as to what is going on? :) Thanks for looking! Okay so I should have looked just a little bit longer before sending the e-mail... the $edit var that is in some of the text fields either contains NULL or "disabled" depending on an editing flag... disabled fields don't get passed back to the script and so it sets the fields to NULL... Now I just need to figure out how to overcome that limitation... What I'm trying to do, is if the text they are presented with is correct, don't give them the ability to "accidentally" edit it. Make them have to click a link to enable editing. It makes it a more intentional method, and hopefully will keep the bots out a LITTLE bit if they find the form and the pURL's... -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 11287 James St Holland, MI 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for email validation
$regex = "^[a-z0-9,!#\$%&'\*\+/=\?\^_`\{\|}~-]+(\.[a-z0-9,!#\$%&'\*\+/=\?\^_`\{\|}~-]+)[EMAIL PROTECTED](\.[a-z0-9-]+)*\.([a-z]{2,})$"; if (eregi($regex, $email)) { // do something } # Beware that the filter functions only work under PHP5+. If your PHP supports them they should be the preferred choice ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Variable name as a string
Perhaps this example may help. Eg: a form with checkboxes and submit button, a few are checked and I want to delete the corresponding records from the database. The database table has an ID column: for each ($argv as $key=>$value) { //$key is named cb_1 $value is "checked" //to get 1 from the key name, then //needed: function like nameof() $var=nameof($key); $ID=substr($var,3); $query="delete * from dbtable where ID='$ID'"; //etc } For database use I do the following in forms: name="data[field_name]" Or for multiple table that you update together: name="data[table_name][field_name]" -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Search Suggestions
At 9:31 AM -0400 8/26/08, Dan Shirah wrote: Any ideas? Dan: Yes, a few of them. 1. Use LIMIT in your MySQL query to get the number of records provided down to a manageable size. 2. Use pagination to keep the page size to a manageable size. Here's an example: http://php1.net/b/pagination-images/ Here's an example with code and it has an example of using LIMIT with offsets: http://webbytedd.com/bbb/paging/ 3. Then use a toggle for showing small/large amount of information. http://webbytedd.com/cc/toggle/ I often use this for showing clients lot's of data without having to show all of it at one time. Here's another example: http://sperling.com/quarters/ Note how "The rules" and "How to win" are shown. As to showing the user one item expanded and all the rest collapsed, I leave that to you, but my hint is redefining the css display rule (display: block) on the initial load of the page. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] restricted file access
Hello, i saw that the end file always has the name test.zip ( http://php1.net/b/file-browser/index.php ) Are you zipping the file before outputing to the user ? In that case, you are accomplishing the desired goal of hidding the path, because the file changed but the path is always the same. Am i right ? On Wed, Aug 27, 2008 at 4:28 PM, tedd <[EMAIL PROTECTED]> wrote: > At 4:13 PM +0200 8/27/08, Angelo Zanetti wrote: > >> Hi all, >> >> We have a site and we have created an admin section where the admin can >> upload documents. >> >> We have made a user login section where they can view a list of the >> documents (from the DB) and download the file. >> >> We want to make the site however not allow ppl to type in the path of the >> document and retrieve the file. How is this accomplished? >> >> Are the documents stored in a hidden / non-web accessible directory? >> >> Or is this restricted with APACHE? >> >> Please advise >> > > > Well...none of the above. > > I would have a php script deliver the files and not allow the user to see > the path. > > Here's an example: > > http://php1.net/b/file-browser/index.php > > It would be a simple matter not to show the path but rather just show > what's available to the user and then let the php script deliver the product > to the user via a common url, like the demo does. > > In other words, the most that any user can get is the path to one spot > where your script deposits the file for download. > > Cheers, > > tedd > > -- > --- > http://sperling.com http://ancientstones.com http://earthstones.com > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Com os melhores cumprimentos, Tiago Palhota
Re: [PHP] restricted file access
At 4:13 PM +0200 8/27/08, Angelo Zanetti wrote: Hi all, We have a site and we have created an admin section where the admin can upload documents. We have made a user login section where they can view a list of the documents (from the DB) and download the file. We want to make the site however not allow ppl to type in the path of the document and retrieve the file. How is this accomplished? Are the documents stored in a hidden / non-web accessible directory? Or is this restricted with APACHE? Please advise Well...none of the above. I would have a php script deliver the files and not allow the user to see the path. Here's an example: http://php1.net/b/file-browser/index.php It would be a simple matter not to show the path but rather just show what's available to the user and then let the php script deliver the product to the user via a common url, like the demo does. In other words, the most that any user can get is the path to one spot where your script deposits the file for download. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for email validation
At 9:31 AM +0200 8/27/08, Per Jessen wrote: VamVan wrote: Hello Guys, Does any have a regex for email validation? I need to allow only period and underscore in the local part , we would need a @ and .com or watever for domain. Option 1: /[EMAIL PROTECTED]/ This is probably what you meant: /[EMAIL PROTECTED]/ /Per Jessen, Zürich Which is probably what you meant: eregi("[EMAIL PROTECTED],6}$", $email) Email comes in different TLD flavors. But, even that still doesn't cover all the possible and legal Unicode code-points that can exist on both sides of the @ of an email address. For example: [EMAIL PROTECTED] is a legal and working email address. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] comments function being spammed, how do I stop it?
On 27 Aug 2008, at 15:37, tedd wrote: At 3:37 PM +0100 8/26/08, Stut wrote: In my experience most spam can be blocked by case-insensitively checking for "[url" and "there that don't include URLs. -Stut Well... that would block me many times from providing comment for I often not only comment but back my point up with a link to a demo. Obviously if you want to accept links from users then this won't work for you, but for blocking comments from spam bots that hit every form they can find I've found nothing better than refusing comments with links. A half-way-house would be to refuse anything with more than n links where n is reasonable for the content you're expecting. Most spam comments try to include a large number in each posting. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] concatenating with "." or ","
At 7:56 PM -0600 8/26/08, Govinda wrote: I never thanked all the people who answered my Q in so many helpful ways and on so many levels.I see that this list if chock full of really quality people with loads of expertise and many other fine qualities (tedd sperling's broad perspective, for one) ... I would be tempted to thank people all the time for so many things. What to do? -G Hey guys! We fooled another one. :-) Cheers, tedd PS: As for me -- thanks, but I'm not the smart one on this list -- just the best looking. :-) -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] comments function being spammed, how do I stop it?
At 3:37 PM +0100 8/26/08, Stut wrote: In my experience most spam can be blocked by case-insensitively checking for "[url" and "there that don't include URLs. -Stut Well... that would block me many times from providing comment for I often not only comment but back my point up with a link to a demo. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Variable name as a string
ioannes wrote: Could someone tell me how to get the name of a variable as a string. This would be useful in form submission with multiple check-boxes to match against database records. At the moment I use ${"var".$ID[$x]} or someting like that to go through all the possible matches, but it would be quicker to explode the name of a checkbox like a string like cb_1 to match to record 1 etc. There is some reason I do not use the value of the check box, but I can't remember it now! John For database use I do the following in forms: name="data[field_name]" Or for multiple table that you update together: name="data[table_name][field_name]" -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP IDE needed
VamVan wrote: use Aptana its awesome and free as well. thanks And it's Eclipse as well :-) -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] restricted file access
Hi all, We have a site and we have created an admin section where the admin can upload documents. We have made a user login section where they can view a list of the documents (from the DB) and download the file. We want to make the site however not allow ppl to type in the path of the document and retrieve the file. How is this accomplished? Are the documents stored in a hidden / non-web accessible directory? Or is this restricted with APACHE? Please advise Thanks in advance. Web: http://www.elemental.co.za -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variable name as a string
U could use an array to keep all of your fieldnames as keys and the values would be the values of the form inputs. That would be very easy and with no programagic. On Wed, Aug 27, 2008 at 3:00 PM, ioannes <[EMAIL PROTECTED]> wrote: > Could someone tell me how to get the name of a variable as a string. This > would be useful in form submission with multiple check-boxes to match > against database records. At the moment I use ${"var".$ID[$x]} or someting > like that to go through all the possible matches, but it would be quicker to > explode the name of a checkbox like a string like cb_1 to match to record 1 > etc. > > There is some reason I do not use the value of the check box, but I can't > remember it now! > > John > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
[PHP] Variable name as a string
Could someone tell me how to get the name of a variable as a string. This would be useful in form submission with multiple check-boxes to match against database records. At the moment I use ${"var".$ID[$x]} or someting like that to go through all the possible matches, but it would be quicker to explode the name of a checkbox like a string like cb_1 to match to record 1 etc. There is some reason I do not use the value of the check box, but I can't remember it now! John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Closing a website (mod_redirect) SOLVED
At 5:42 PM +0100 8/26/08, Alex Chamberlain wrote: Why do you always solve a problem you have been working on for a day as soon as you email a mail list!?! The serious answer to that is -- when you have to explain the problem to others, it's often the first time you've fully realized the problem yourself. I usually spend a lot of time writing a question to this group. The question has to be distinct, clear and specifically to the point. An example/demo is almost mandatory. After doing all that, it's good to read the question yourself and ask if someone else had posted this question: 1) would you be able to understand what the problem was? 2) and could you solve it? After that much evaluation, I usually find that I either already know the answer OR how to find the answer. After repeating that cycle a couple of times, I either finish my post to the list or I forget what the hell I was doing. In either case, the problem passes. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Assign things to users
At 10:20 AM -0400 8/26/08, Dan Joseph wrote: My question is: How do you all do handle similar situations like this? I've been thinking there has to be a better way to do it, but I have not been able to think of a good way to do it. I'd like to see how if I'm doing it like everyone else, or what else is out there. Any ideas would be appreciated! I've worked in places where they have one manager beating a drum and another working the whip. It works great if you're chained to your desk else you run away. What you have is a great closed system where you can not only distribute the workload but can evaluate workers based upon ability to handle the quotes. The "grab the brass ring if you're available" set-up you have now sounds as good as any other I can think of. It's just that now you can have the data to evaluate workers and find out who's the best and lest productive. What you do with that data is up to you to improve, or degrade, working conditions and production. From my background, I would find it exciting to evaluate such data with respect to time of day, days of the week, weeks of the month, month of the year, and so on. You can not only learn more about your employees, but also your customers. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP editor for linux
Yes, it's quite nice actually. I used it once. And I am using vim on Linux platform now. I am feeling quite easy with it. Maybe you have noticed the survey I made on http://phparch.cn. A lot of people just look at the result. I really want people to choose their option first. Because that's helpful for future visitors. Anyway, everybody is free to make his own choice. On Tue, Aug 26, 2008 at 10:26 PM, Carlos Medina <[EMAIL PROTECTED]>wrote: > Thodoris schrieb: > >> >> O/H It flance ??: >> >>> Hi, >>> >>> What do you think is the best php editor for linux. >>> >>> I'm using the Debian distribution. >>> >>> Thanks >>> >>> >>> >>> >>> >> I surprisingly use PSPad editor which is quite neat solution and support >> some basic regexps. >> >> http://www.pspad.com/ >> >> I think I'll probably move to vim since nothing seems more powerful but >> yet so nerdish. >> >> It was nice talking for this all boring, again-and-again issue because I >> got some very good ideas and I will totally try eclipse. >> >> Hi, > PHPed is nice > > Regards > > Carlos > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- With best regards, Shelley Shyan http://phparch.cn
Re: [PHP] comments function being spammed, how do I stop it?
tedd wrote: > At 3:14 PM -0700 8/25/08, Jim Lucas wrote: >>Here is the function that I added to a generic guest book script. >>It works great for me. I have a predefined list of sexual, >>pharmaceutical, rude, vulgar, etc... words that I have in the >>spamwords.dat file. >> >>function is_spam($str) { >> $data = './data/spamwords.dat'; >> $spamword = file($data); >> $str = strtolower($str); >> foreach ($spamword AS $word) { >> $word = trim($word); >> if ( ! empty($word) && // Blank line >> strpos($word, 0, 1) != '#' && // Comment line >> strpos($str, strtolower($word)) !== false ) { // Compare >> return true; >> } >> } >> return false; >>} >> >>Just setup the spamwords.dat file to have each word/string that you >>want to reject for separated on each line. >> >>-- >>Jim Lucas > > > Will you share your spamwords.dat file? I get too excited trying to > type them in myself. :-) > > This reminds me (if I have my story correct) that recently a > Christian web site had a similar filter except it filtered news they > scrubbed off other site/sources. One of their routines checked for > offensive words and then replaced them with PC words. > > This receive national attention when their site changed Tyson Gay's > name to Tyson Homosexual. > > Cheers, > > tedd > I figure their spamfilter would have permanent epilepsy if they took a feed from the Scunthorpe Evening Telegraph's site at http://www.thisisscunthorpe.co.uk/ Cheers -- David Robley Phobia: what's left after drinking 2 out of a 6 pack Today is Prickle-Prickle, the 20th day of Bureaucracy in the YOLD 3174. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] concatenating with "." or ","
tedd wrote: > There are significant orders of magnitude difference between your results > and mine. > For example, it didn't make any difference if you used a comma or > concatenation, but in my system concatenation was 15 times faster than using > a comma. Interesting, I would have guessed it would have been the other way > around. I refined the test, so that it is more random and therefore maybe more accurate. Test Results Results for 2048 cycles of echoing a 32-character string with a random 32-character string 2048 times: comma Method Number of Echoes: 536 Total time: 1.57938525391 milliseconds Average time: 0.00294661427968 milliseconds concat Method Number of Echoes: 537 Total time: 2.64919824219 milliseconds Average time: 0.0049005994 milliseconds interpol Method Number of Echoes: 480 Total time: 4.38319873047 milliseconds Average time: 0.00913166402181 milliseconds heredoc Method Number of Echoes: 495 Total time: 3.66322021484 milliseconds Average time: 0.00740044487847 milliseconds Results for echoing 128 random 32-character string 2048 times: comma Method Number of Echoes: 536 Total time: 817.227 milliseconds Average time: 1.52467723881 milliseconds concat Method Number of Echoes: 537 Total time: 826.971 milliseconds Average time: 1.53998324022 milliseconds interpol Method Number of Echoes: 480 Total time: 3764.781 milliseconds Average time: 7.84329375 milliseconds heredoc Method Number of Echoes: 495 Total time: 540.391 milliseconds Average time: 1.0916989899 milliseconds -- For all those who want to try it out, here is the code: -- http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> http://www.w3.org/1999/xhtml";> Test for Tedd Test Results array("total_time" => 0, "count" => 0), "concat" => array("total_time" => 0, "count" => 0), "interpol" => array("total_time" => 0, "count" => 0), "heredoc" => array("total_time" => 0, "count" => 0) ); $results2 = $results1; $test_array = array(); $test_string = md5(time()); // a 32 character string $eval_strings = create_eval_strings(); for ($i = 0; $i < $iterations; ++$i) $test_array[] = str_shuffle($test_string); // random strings for ($i = 0; $i < $iterations; ++$i) test_method(rand(0,3)); function test_method($method) { $start_time = $end_time = 0; $test_array =& $GLOBALS['test_array']; $test_string =& $GLOBALS['test_string']; $eval_strings =& $GLOBALS['eval_strings']; for ($i = 0; $i < 10; ++$i) { $j = rand(0, $GLOBALS['iterations']); $test_array[$j] = str_shuffle($test_array[$j]); // change some arr vals to outsmart any php speedup/cache } $arr2 = array(); // array for 2nd test for ($i = 0; $i < $GLOBALS['iterations2']; ++$i) $arr2[] = $test_array[rand(0, $GLOBALS['iterations'])]; # 1st test will output # of iterations random strings # 2nd test will output a sequence of #iterations2 random strings switch ($method) { case 0: // comma # -> TEST 1 <- ob_start(); $start_time = microtime(true); foreach ($test_array as $array_value) { echo $test_string, $array_value; } $end_time = microtime(true); ob_end_clean(); $GLOBALS["results1"]["comma"]["total_time"] += abs($end_time - $start_time)*1000/$GLOBALS["iterations"]; ++$GLOBALS["results1"]["comma"]["count"]; # -> TEST 2 <- ob_start(); $start_time = microtime(true); eval($eval_strings['comma']); $end_time = microtime(true); ob_end_clean(); $GLOBALS["results2"]["comma"]["total_time"] += abs($end_time - $start_time)*1000; ++$GLOBALS["results2"]["comma"]["count"]; break 1; case 1: // concatenation # -> TEST 1 <- ob_start(); $start_time = microtime(true); foreach ($test_array as $array_value) { echo $test_string.$array_value; } $end_time = microtime(true); ob_end_clean(); $GLOBALS["results1"]["concat"]["total_time"] += abs($end_time - $start_time)*1000/$GLOBALS["iterations"]; ++$GLOBALS["results1"]["concat"]["count"]; # -> TEST 2 <- ob_start(); $start_time = microtime(true); eval($eval_strings['concat']); $end_time = microtime(true); ob_end_clean(); echo $eval_string."\n"; $GLOBALS["results2"]["concat"]["total_time"] += abs($end_time - $start_time)*1000; ++$GLOBALS["results2"]["concat"]["count"]; break 1; case 2: // interpolation # -> TEST 1 <- ob_start(); $start_time = microtime(true); foreach ($test_array as $array_value) { echo "{$test_string}{$array_value}"; } $end_time = microtime(true); ob_end_clean(); $GLOBALS["results1"]["interpol"]["total_time"] += abs($end_time - $start_time)*1000/$GLOBALS["iterations"]; ++$GLOBALS
Re: [PHP] Bug in array_key_exist?
Korgan napsal(a): Jim Lucas napsal(a): Korgan wrote: Hi, I have a problem with array_key_exists in if statement. I have a class with this function class XXX { private items = array(); ... ... ... public function addXXX($id, $count) { $count = (int)$cout; Let me point at it Check your spelling If error_reporting was set to E_ALL AND display_errors were turned on, you would see that you are using an undefined variable in your method called $cout, casting is as an int and assigning the resulting value (which would always be zero) to $count. Sorry i didnt see it :). In the script is $count = (int)$count; After add a item value is ok look at first B vardump which is on the end of the script. No variable $count is mandatory so that is defined. But its not main idea of my question... Function add items correctly, but if go to next page, values in array change. Values are changed passing from one page to another one, why and where? if (!array_key_exists($id, $this->items)) $this->items[$id] = $count; else $this->items[$id] += $count; } ... ... } And I want to send instance of this class with SESSION. If I add a item to the array, count is ok, but if i go to the next page count will change. There is the code of index.php /** its loading classes ***/ spl_autoload_register('loadClass'); session_start(); var_dump($_SESSION['XX']); /** A **/ ... ... ... if ($_SESSION['XX'] instanceof XXX) $x = $_SESSION['XX']; else new... .. .. /** Do onzl this **/ if $x->addXXX($id, $cnt); ... ... $_SESSION['XX'] = X; var_dump($_SESSION['XX']); /** B **/ There is a vardump if action addXXX exec: A: object(Kosik)#1 (1) { ["zbozi:private"]=> array(0) { } } B: object(Kosik)#1 (1) { ["zbozi:private"]=> array(1) { [1]=> int(1) } } And than i will go to some page and vardums are: A: object(Kosik)#1 (1) { ["zbozi:private"]=> array(1) { [1]=> int(4) } } 1 : 4 B: object(Kosik)#1 (1) { ["zbozi:private"]=> array(1) { [1]=> int(4) } } I am thinking that do both codes in if statement, but $this->items[$id] += $count; exec after send page. I am using PHP Version 5.2.6 and Smarty v.2.6.19 Thanks for help :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for email validation
> Does any have a regex for email validation? I need to allow only period and > underscore in the local part , we would need a @ and .com or watever for > domain. You could: 1. Take the isValidInetAddress() method out of the PEAR Mail_RFC822 class and use that. 2. Use the filter extension which I understand is now part of PHP (5.2.x+) This would the preferable option. -- Richard Heyes HTML5 Graphing: http://www.phpguru.org/RGraph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP IDE needed
Whats wrong with echo "" > index.php is there anything to satisfy your needs... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for email validation
That's a very handy extension. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com mike wrote: > > php should have a good check built-in. > > see http://www.php.net/manual/en/function.filter-var.php > > if(!filter_var($var, FILTER_VALIDATE_EMAIL)) { > echo "invalid email"; > } > > some people also go the extra mile and verify the MX record is valid, > or lookup the MX record and even validate the user exists by querying > the mail server. > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for email validation
VamVan wrote: > Hello Guys, > > Does any have a regex for email validation? I need to allow only > period and underscore in the local part , we would need a @ and .com > or watever for domain. Option 1: /[EMAIL PROTECTED]/ This is probably what you meant: /[EMAIL PROTECTED]/ /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for email validation
> On 8/27/08, VamVan <[EMAIL PROTECTED]> wrote: > Hello Guys, > > Does any have a regex for email validation? I need to allow only period and > underscore in the local part , we would need a @ and .com or watever for > domain. php should have a good check built-in. see http://www.php.net/manual/en/function.filter-var.php if(!filter_var($var, FILTER_VALIDATE_EMAIL)) { echo "invalid email"; } some people also go the extra mile and verify the MX record is valid, or lookup the MX record and even validate the user exists by querying the mail server. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP IDE needed
Sascha Braun schrieb: Hi people, I have a webproject which is round about 3 GB in size. I was usually using eclipse to work with the software but over time eclipse became very instable regarding that project. As soon as I open classes with 2000 or more lines of code in it, an out of memory error occours. So I need a new IDE for linux. Please tell me which IDE might be a true alternative for projects at that size. Thank you friends, kind regards, Sascha Hi Sascha, Try PHPed Regards Carlos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Regex for email validation
Hello Guys, Does any have a regex for email validation? I need to allow only period and underscore in the local part , we would need a @ and .com or watever for domain. thank you