php-general Digest 21 Jul 2006 18:36:13 -0000 Issue 4251
php-general Digest 21 Jul 2006 18:36:13 - Issue 4251 Topics (messages 239675 through 239689): Re: headers and newline at end of script 239675 by: Jochem Maas UTF-8 With content-type text/xml problem. 239676 by: Mathijs 239678 by: Barry 239679 by: Jon Anderson Re: PAYMENT TRANSACTION 239677 by: tedd Stumped! 4.x to 5.1 problem!! 239680 by: Mark 239682 by: Mark Re: Setting cookie on one domain for an other domain 239681 by: Mark Bug in == comparison? 239683 by: Jeffrey Sambells 239684 by: Adam Zey 239685 by: Adam Zey 239686 by: Adam Zey 239687 by: Adam Zey 239688 by: Jeffrey Sambells Re: Enterprise grade CMS+Ecomm 239689 by: Chris W. Parker Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: php-general@lists.php.net -- ---BeginMessage--- Robert Cummings wrote: On Thu, 2006-07-20 at 16:50, Jochem Maas wrote: Robert Cummings wrote: On Thu, 2006-07-20 at 14:15, Martin Marques wrote: On Thu, 20 Jul 2006 13:06:10 -0400, Robert Cummings [EMAIL PROTECTED] wrote: On Thu, 2006-07-20 at 12:12, Adam Zey wrote: Martin Marques wrote: Now, my question is: Is it a bad practice to NOT close the script with the PHP closing ?? I mean, just leave the script without a closing PHP simbols, as this scripts are included? Yes. Wrong :) Why? ;-) See links I posted in previous response :) I don't understand - the links point to posts by Rasmus saying that's 'beneficial' - seems to me to be a fairly robust endorsement yet you consider leaving off trailing '?' wrong (and use Rasmus' comments to back that up) we're having another heatwave here in europe so that could be compounding my lack of understanding ;-) The original question says Is it bad practice? Adam Zey said Yes. I said he is Wrong. Now granted, re-reading the original post, there are two questions, I presumed (quite possibly incorrectly) Adam Zey was answering the first. Generally when you have Y answers for X questions and Y X then the first Y questions are presumed answered. Just like when parsing CSV files and you run out of commas :) If we didn't have this basic presumption, then the universe would begin to tear apart -- trust me on that one ;) ah, I think Im back on track now :-) Cheers, Rob. ---End Message--- ---BeginMessage--- Hello ppl, I have a big prob. I have a page which post some input. This input can be UTF-8 like chinese or other utf-8 chars. Also i need it to return UTF-8 and it has to be xml. For some strange reason this isn't working. Small example. PHP Code: ?php header('Content-Type: text/xml; charset=utf-8'); print '?xml version=1.0 encoding=utf-8 ?'.\n; print 'testdata'.$_GET['test'].'/data/test'.\n; ? as GET var fill in something like ?test=éëêæ This will break it.. Only Opera does a good job. Firefox and IE both can't handle it. If i remove the header Firefox goes well. IE Still can't handle it. I Just need simple XML with UTF8 data. PS: This also breaks database saving, it doesn't save correct. And i have mbstring installed. Thx in advance. --- avast! Antivirus: Outbound message clean. Virus Database (VPS): 0629-1, 07/19/2006 Tested on: 7/21/2006 11:17:03 AM avast! - copyright (c) 1988-2006 ALWIL Software. http://www.avast.com ---End Message--- ---BeginMessage--- Mathijs schrieb: Hello ppl, I have a big prob. I have a page which post some input. This input can be UTF-8 like chinese or other utf-8 chars. Also i need it to return UTF-8 and it has to be xml. For some strange reason this isn't working. Small example. PHP Code: ?php header('Content-Type: text/xml; charset=utf-8'); print '?xml version=1.0 encoding=utf-8 ?'.\n; print 'testdata'.$_GET['test'].'/data/test'.\n; ? as GET var fill in something like ?test=éëêæ This will break it.. Only Opera does a good job. Firefox and IE both can't handle it. If i remove the header Firefox goes well. IE Still can't handle it. I Just need simple XML with UTF8 data. PS: This also breaks database saving, it doesn't save correct. And i have mbstring installed. Thx in advance. Is the output also UTF-8 encoded? -- Smileys rule (cX.x)C --o(^_^o) Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o) ---End Message--- ---BeginMessage--- I'm somewhat new to this stuff as well, so take this with a grain of salt... Someone else was hinting at this, but more directly, try running utf8_encode() on whatever part of your data that requires utf8 encoding. In the case of your example, you could just utf8_encode the test get variable. To extend your example a little: header('Content-Type: text/xml; charset=utf-8'); print ?xml version=\1.0\ encoding=\utf-8\ ?\n; print test\n; print origEncoding .
Re: [PHP] Re: Help with some clever bit operations
Niels schrieb: The problem: A function tries to update an existing value, but is only allowed to write certain bits. There are 3 variables: A: the existing value, eg. 10110101 B: what the function wants to write, eg. 01011100 C: which bits the function is allowed to write, eg. With these examples, 1000 should be written. How do I combine A, B and C to get that result? 1) First, AND the mask with the value the function wants to write in order to suppress bits: 01011100 (B: value the function wants to write) (C: mask) 1100 (D: intermediate result) $D = $B $C; 2) Next, OR the above result with the existing value: 10110101 (A: existing value) | 1100 (D: B C) 1001 (E: final result) $E = $A | $D; Or, more succinctly: $E = $A | ($B $C); I love Boolean operations. Used cleverly, they can replace code branching with simple statements. Back when I was coding in assembler PL/M it was a righteously fast way of producing complex results. Regards, Paul [Sorry if this question has long since been answered, but I missed the rest of the thread.] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: headers and newline at end of script
Robert Cummings wrote: On Thu, 2006-07-20 at 16:50, Jochem Maas wrote: Robert Cummings wrote: On Thu, 2006-07-20 at 14:15, Martin Marques wrote: On Thu, 20 Jul 2006 13:06:10 -0400, Robert Cummings [EMAIL PROTECTED] wrote: On Thu, 2006-07-20 at 12:12, Adam Zey wrote: Martin Marques wrote: Now, my question is: Is it a bad practice to NOT close the script with the PHP closing ?? I mean, just leave the script without a closing PHP simbols, as this scripts are included? Yes. Wrong :) Why? ;-) See links I posted in previous response :) I don't understand - the links point to posts by Rasmus saying that's 'beneficial' - seems to me to be a fairly robust endorsement yet you consider leaving off trailing '?' wrong (and use Rasmus' comments to back that up) we're having another heatwave here in europe so that could be compounding my lack of understanding ;-) The original question says Is it bad practice? Adam Zey said Yes. I said he is Wrong. Now granted, re-reading the original post, there are two questions, I presumed (quite possibly incorrectly) Adam Zey was answering the first. Generally when you have Y answers for X questions and Y X then the first Y questions are presumed answered. Just like when parsing CSV files and you run out of commas :) If we didn't have this basic presumption, then the universe would begin to tear apart -- trust me on that one ;) ah, I think Im back on track now :-) Cheers, Rob. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] UTF-8 With content-type text/xml problem.
Hello ppl, I have a big prob. I have a page which post some input. This input can be UTF-8 like chinese or other utf-8 chars. Also i need it to return UTF-8 and it has to be xml. For some strange reason this isn't working. Small example. PHP Code: ?php header('Content-Type: text/xml; charset=utf-8'); print '?xml version=1.0 encoding=utf-8 ?'.\n; print 'testdata'.$_GET['test'].'/data/test'.\n; ? as GET var fill in something like ?test=éëêæ This will break it.. Only Opera does a good job. Firefox and IE both can't handle it. If i remove the header Firefox goes well. IE Still can't handle it. I Just need simple XML with UTF8 data. PS: This also breaks database saving, it doesn't save correct. And i have mbstring installed. Thx in advance. --- avast! Antivirus: Outbound message clean. Virus Database (VPS): 0629-1, 07/19/2006 Tested on: 7/21/2006 11:17:03 AM avast! - copyright (c) 1988-2006 ALWIL Software. http://www.avast.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PAYMENT TRANSACTION
At 12:37 AM -0700 7/21/06, BBC wrote: How are you all? I hope some body can give me some references for internet payment. I made a kind of shopping cart in my project; even though I was doubt in making it caused I don't have any idea how to make internet transaction. But I just heard from a friend of mine that we can 'join' with special web site which handles payment transaction. I'll be pleasure if some body can give references about this issue which explains how to collaborate with them step by step. Thank you guys.. Try PayPal. 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: UTF-8 With content-type text/xml problem.
Mathijs schrieb: Hello ppl, I have a big prob. I have a page which post some input. This input can be UTF-8 like chinese or other utf-8 chars. Also i need it to return UTF-8 and it has to be xml. For some strange reason this isn't working. Small example. PHP Code: ?php header('Content-Type: text/xml; charset=utf-8'); print '?xml version=1.0 encoding=utf-8 ?'.\n; print 'testdata'.$_GET['test'].'/data/test'.\n; ? as GET var fill in something like ?test=éëêæ This will break it.. Only Opera does a good job. Firefox and IE both can't handle it. If i remove the header Firefox goes well. IE Still can't handle it. I Just need simple XML with UTF8 data. PS: This also breaks database saving, it doesn't save correct. And i have mbstring installed. Thx in advance. Is the output also UTF-8 encoded? -- Smileys rule (cX.x)C --o(^_^o) Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] UTF-8 With content-type text/xml problem.
I'm somewhat new to this stuff as well, so take this with a grain of salt... Someone else was hinting at this, but more directly, try running utf8_encode() on whatever part of your data that requires utf8 encoding. In the case of your example, you could just utf8_encode the test get variable. To extend your example a little: header('Content-Type: text/xml; charset=utf-8'); print ?xml version=\1.0\ encoding=\utf-8\ ?\n; print test\n; print origEncoding . mb_detect_encoding($_GET['test']) . /origEncoding\n; print utf8data1 . utf8_encode($_GET['test']) . /utf8data1\n; print utf8data2 . mb_convert_encoding($_GET['test'],'UTF-8') . /utf8data2\n; print /test\n; I tried this with: 會意字/会意字, which I stole from Wikipedia. I don't have a clue what it means. jon Mathijs wrote: Hello ppl, I have a big prob. I have a page which post some input. This input can be UTF-8 like chinese or other utf-8 chars. Also i need it to return UTF-8 and it has to be xml. For some strange reason this isn't working. Small example. PHP Code: ?php header('Content-Type: text/xml; charset=utf-8'); print '?xml version=1.0 encoding=utf-8 ?'.\n; print 'testdata'.$_GET['test'].'/data/test'.\n; ? as GET var fill in something like ?test=éëêæ This will break it.. Only Opera does a good job. Firefox and IE both can't handle it. If i remove the header Firefox goes well. IE Still can't handle it. I Just need simple XML with UTF8 data. PS: This also breaks database saving, it doesn't save correct. And i have mbstring installed. Thx in advance. --- avast! Antivirus: Outbound message clean. Virus Database (VPS): 0629-1, 07/19/2006 Tested on: 7/21/2006 11:17:03 AM avast! - copyright (c) 1988-2006 ALWIL Software. http://www.avast.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Stumped! 4.x to 5.1 problem!!
I have an extension that seems to create PHP variables correctly, and var_dump() doesn't seem to have a problem. but upon moving to 5.1.x it fails. Anyone have a suggestion? xmp xmldbx version='1.0'ycis_host t='a' R='1' C='2' cb='2' xag t='o' nm='0' cn='classfoo' hostname t='sz' v='foo'//xagxag t='o' nm='1' cn='classfoo' hostname t='sz' v='bar'//xag/ycis_host/xmldbxxmpp array(2) { [0]= object(classfoo)#2 (1) { [hostname]= string(3) foo } [1]= object(classfoo)#3 (1) { [hostname]= string(3) bar } } array(2) { [0]= object(classfoo)#4 (1) { [hostname]= string(3) foo } [1]= object(classfoo)#5 (1) { [hostname]= string(3) bar } } Object failed foo.php Description: application/php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Setting cookie on one domain for an other domain
Peter Lauri wrote: Best group member, When a user does a specific action on domain1.com I want a cookie to be set so that domain1.com and domain2.com can reach it. Ok, after reading the manual for setcookie() I tried this: setcookie(thevariable, thevalue, time()+60*60*24*30, /, .domain1.com); setcookie(thevariable, thevalue, time()+60*60*24*30, /, .domain2.com); However, I can not detect the cookie at domain2.com. A solution would be to just make a redirect to the other domain where the cookie is set and then return. Question is: Can I not set a cookie at domain1.com to work at domain2.com? This is a common problem, and the easiest solution, if you have control over both domains, is to put a bug (a small image) on domain1 and domain2, something like: showlogo.php Which returns a jpeg of an image. The trick is that you send it a parameter such as: http://domain2.com/showlogo.php?session=MYSESESSION Then this code sets its cookie in domain2, so when you go there it is there. You should try to use encryption, temp variables, or something to keep this from being easy to hack. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Stumped! 4.x to 5.1 problem!!
Mark wrote: I have an extension that seems to create PHP variables correctly, and var_dump() doesn't seem to have a problem. but upon moving to 5.1.x it fails. Anyone have a suggestion? Well, it is fixed. Evidently, PHP 5.1 sees a difference between $var[0] and $var[0]. It never did before. BTW: this behavior is almost certainly in wddx. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Bug in == comparison?
OK I have a very strange bug: In the middle of my script I have these two lines: var_dump($test,$test2); echo '$test'=='$test2' is .($test==$test2); which is giving: int(0) string(6) Points '0'=='Points' is 1 I understand that PHP is loose typed and automatically does type conversion but in the many years I've been using PHP (mostly v4) the comparison had always converted to 'string' and in the case above returned FALSE, not TRUE. It seems here they are comparing as integers thus 'Points' evaluates to 0 and the comparison is TRUE. I tried comparing in the reverse sequence ($test2==$test) and the same occurred. It does work as expected if I have === but the rest of the scirpt isn't type sensitive so I want NULL, 0, and empty string to still maintain equality. Any ideas why this is suddenly happening? I'm using PHP 5.1, and I realize I could use other functions such as strval() in the comparison however I've used similar logic in the past without problems. Any help would be great. Thanks Jeff ~~ Jeffrey Sambells Director of Research and Development Zend Certified Engineer (ZCE) We-Create Inc. [EMAIL PROTECTED] email 519.745.7374 x103 office 519.897.2552 mobile ~~ Get Mozilla Firefox at http://spreadfirefox.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Bug in == comparison?
Jeffrey Sambells wrote: OK I have a very strange bug: In the middle of my script I have these two lines: var_dump($test,$test2); echo '$test'=='$test2' is .($test==$test2); which is giving: int(0) string(6) Points '0'=='Points' is 1 I understand that PHP is loose typed and automatically does type conversion but in the many years I've been using PHP (mostly v4) the comparison had always converted to 'string' and in the case above returned FALSE, not TRUE. It seems here they are comparing as integers thus 'Points' evaluates to 0 and the comparison is TRUE. I tried comparing in the reverse sequence ($test2==$test) and the same occurred. It does work as expected if I have === but the rest of the scirpt isn't type sensitive so I want NULL, 0, and empty string to still maintain equality. Any ideas why this is suddenly happening? I'm using PHP 5.1, and I realize I could use other functions such as strval() in the comparison however I've used similar logic in the past without problems. Any help would be great. Thanks Jeff No, the opposite is true; strings are always converted to integers in such comparisons, as stated in TFM: http://www.php.net/manual/en/language.operators.comparison.php I'll quote it here: If you compare an integer with a string, the string is converted to a number. If you compare two numerical strings, they are compared as integers. These rules also apply to the switch statement. In your case, it's a bug in your code; you should be using === to also verify type, or casting $var1 to a string in your comparison. Regards, Adam Zey. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Bug in == comparison?
I tried comparing in the reverse sequence ($test2==$test) and the same occurred. It does work as expected if I have === but the rest of the scirpt isn't type sensitive so I want NULL, 0, and empty string to still maintain equality. Wups, I missed the last part there. You want the empty() function: http://www.php.net/manual/en/function.empty.php It can do exactly what you want. Regards, Adam. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Bug in == comparison?
Jeffrey Sambells wrote: hrm.. It just seemed strange as the script I was working on is 3 years old and had worked flawlessly until today. Thanks. - Jeff ~~ Jeffrey Sambells Director of Research and Development Zend Certified Engineer (ZCE) We-Create Inc. [EMAIL PROTECTED] email 519.745.7374 x103 office 519.897.2552 mobile ~~ Get Mozilla Firefox at http://spreadfirefox.com On 21-Jul-06, at 12:45 PM, Adam Zey wrote: Jeffrey Sambells wrote: OK I have a very strange bug: In the middle of my script I have these two lines: var_dump($test,$test2); echo '$test'=='$test2' is .($test==$test2); which is giving: int(0) string(6) Points '0'=='Points' is 1 I understand that PHP is loose typed and automatically does type conversion but in the many years I've been using PHP (mostly v4) the comparison had always converted to 'string' and in the case above returned FALSE, not TRUE. It seems here they are comparing as integers thus 'Points' evaluates to 0 and the comparison is TRUE. I tried comparing in the reverse sequence ($test2==$test) and the same occurred. It does work as expected if I have === but the rest of the scirpt isn't type sensitive so I want NULL, 0, and empty string to still maintain equality. Any ideas why this is suddenly happening? I'm using PHP 5.1, and I realize I could use other functions such as strval() in the comparison however I've used similar logic in the past without problems. Any help would be great. Thanks Jeff No, the opposite is true; strings are always converted to integers in such comparisons, as stated in TFM: http://www.php.net/manual/en/language.operators.comparison.php I'll quote it here: If you compare an integer with a string, the string is converted to a number. If you compare two numerical strings, they are compared as integers. These rules also apply to the switch statement. In your case, it's a bug in your code; you should be using === to also verify type, or casting $var1 to a string in your comparison. Regards, Adam Zey. Since my other reply might have been overlooked as a double-reply, it bears repeating here; the empty() function is designed to do what you want (check empty strings, int(0), null, etc). Regards, Adam. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Bug in == comparison?
hrm.. It just seemed strange as the script I was working on is 3 years old and had worked flawlessly until today. Thanks. - Jeff ~~ Jeffrey Sambells Director of Research and Development Zend Certified Engineer (ZCE) We-Create Inc. [EMAIL PROTECTED] email 519.745.7374 x103 office 519.897.2552 mobile ~~ Get Mozilla Firefox at http://spreadfirefox.com On 21-Jul-06, at 12:45 PM, Adam Zey wrote: Jeffrey Sambells wrote: OK I have a very strange bug: In the middle of my script I have these two lines: var_dump($test,$test2); echo '$test'=='$test2' is .($test==$test2); which is giving: int(0) string(6) Points '0'=='Points' is 1 I understand that PHP is loose typed and automatically does type conversion but in the many years I've been using PHP (mostly v4) the comparison had always converted to 'string' and in the case above returned FALSE, not TRUE. It seems here they are comparing as integers thus 'Points' evaluates to 0 and the comparison is TRUE. I tried comparing in the reverse sequence ($test2==$test) and the same occurred. It does work as expected if I have === but the rest of the scirpt isn't type sensitive so I want NULL, 0, and empty string to still maintain equality. Any ideas why this is suddenly happening? I'm using PHP 5.1, and I realize I could use other functions such as strval() in the comparison however I've used similar logic in the past without problems. Any help would be great. Thanks Jeff No, the opposite is true; strings are always converted to integers in such comparisons, as stated in TFM: http://www.php.net/manual/en/language.operators.comparison.php I'll quote it here: If you compare an integer with a string, the string is converted to a number. If you compare two numerical strings, they are compared as integers. These rules also apply to the switch statement. In your case, it's a bug in your code; you should be using === to also verify type, or casting $var1 to a string in your comparison. Regards, Adam Zey. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Enterprise grade CMS+Ecomm
Larry Garfield mailto:[EMAIL PROTECTED] on Thursday, July 20, 2006 6:36 PM said: On Thursday 20 July 2006 11:30, Chris W. Parker wrote: Drupal has its own ecommerce suite that is reasonably robust all on its own. Yeah I saw that module. I think today I am going to try to set them both up. Thanks for your input. Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Cleaning bad characters from var
Dear All, I'm trying to set up an XML feed form our news articles. My XML is validating. The issue is some of the articles have a weird encoding. It seems to be single quotes. For example: the world92s largest live event producer Notice the 92. I already have this to clean vars but its not doing the trick: // clean bad chars for valid XML //$patterns[0] = '/=/'; $patterns[1] = '//'; $patterns[2] = '//'; $patterns[3] = '/\'/'; $patterns[4] = '/\/'; $patterns[5] = '//'; //$replacements[0] = '/eq/'; $replacements[1] = '/lt/'; $replacements[2] = '/gt/'; $replacements[3] = '/apos;/'; $replacements[4] = '/quot;/'; $replacements[5] = '/amp;/'; // chars to replace $badwordchars=array( \xe2\x80\x98, // left single quote \xe2\x80\x99, // right single quote \xe2\x80\x9c, // left double quote \xe2\x80\x9d, // right double quote \xe2\x80\x94, // em dash \xe2\x80\xa6 // elipses ); $fixedwordchars=array( #8216;, #8217;, '#8220;', '#8221;', 'mdash;', '#8230;' ); An thoughts would be very helpful. Thank You, -- Paul Nowosielski Webmaster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cleaning bad characters from var
Paul Nowosielski wrote: Dear All, I'm trying to set up an XML feed form our news articles. My XML is validating. The issue is some of the articles have a weird encoding. I wrote a function to do this for our product descriptions when sending them in a XML doc to certain vendors. It's old, crude, but you're welcome to it. function convertString ( $string, $reverse = false ) { $find_array = array ( /quot;/, /amp;/, /lt;/, /gt;/, /nbsp;/, /iexcl;/, /cent;/, /pound;/, /curren;/, /yen;/, /brvbar;/, /sect;/, /uml;/, /copy;/, /ordf;/, /laquo;/, /not;/, /shy;/, /reg;/, /macr;/, /deg;/, /plusmn;/, /sup2;/, /sup3;/, /acute;/, /micro;/, /para;/, /middot;/, /cedil;/, /sup1;/, /ordm;/, /raquo;/, /frac14;/, /frac12;/, /frac34;/, /iquest;/, /Agrave;/, /Aacute;/, /Acirc;/, /Atilde;/, /Auml;/, /Aring;/, /AElig;/, /Ccedil;/, /Egrave;/, /Eacute;/, /Ecirc;/, /Euml;/, /Igrave;/, /Iacute;/, /Icirc;/, /Iuml;/, /ETH;/, /Ntilde;/, /Ograve;/, /Oacute;/, /Ocirc;/, /Otilde;/, /Ouml;/, /times;/, /Oslash;/, /Ugrave;/, /Uacute;/, /Ucirc;/, /Uuml;/, /Yacute;/, /THORN;/, /szlig;/, /agrave;/, /aacute;/, /acirc;/, /atilde;/, /auml;/, /aring;/, /aelig;/, /ccedil;/, /egrave;/, /eacute;/, /ecirc;/, /euml;/, /igrave;/, /iacute;/, /icirc;/, /iuml;/, /eth;/, /ntilde;/, /ograve;/, /oacute;/, /ocirc;/, /otilde;/, /ouml;/, /divide;/, /oslash;/, /ugrave;/, /uacute;/, /ucirc;/, /uuml;/, /yacute;/, /thorn;/, /yuml;/ ); $replace_array = array ( '#034;', '#038;', '#060;', '#062;', '#160;', '#161;', '#162;', '#163;', '#164;', '#165;', '#166;', '#167;', '#168;', '#169;', '#170;', '#171;', '#172;', '#173;', '#174;', '#175;', '#176;', '#177;', '#178;', '#179;', '#180;', '#181;', '#182;', '#183;', '#184;', '#185;', '#186;', '#187;', '#188;', '#189;', '#190;', '#191;', '#192;', '#193;', '#194;', '#195;', '#196;', '#197;', '#198;', '#199;', '#200;', '#201;', '#202;', '#203;', '#204;', '#205;', '#206;', '#207;', '#208;', '#209;', '#210;', '#211;', '#212;', '#213;', '#214;', '#215;', '#216;', '#217;', '#218;', '#219;', '#220;', '#221;', '#222;', '#223;', '#224;', '#225;', '#226;', '#227;', '#228;', '#229;', '#230;', '#231;', '#232;',
[PHP] authorize.net
Hey all, Anybody on the list know authorize.net integration really well and would be interested in earning a few bucks consulting? I have a new install that has their tech support and myself stumped and I really want to get it going. If so, email me off-list with your level of experience and hourly rate. -- Skip Evans Big Sky Penguin, LLC 61 W Broadway Butte, Montana 59701 406-782-2240 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] search string
You can use a regular expressions with a function called preg_match to find the values. For example, (Assuming your sql statement is $sql) preg_match(/(tbl_chassis.chasis_model LIKE \'\%[a-zA-Z0-9-]+\%\'/), $sql, $matches); That will return $matches[0] with the matched data. Similarly, preg_match(/(AND lower\(country\) = lower\(trim\(\'(\w+)\'\)\))/, $sql, $matches); does the same thing, again in $matches[0]. The full description of preg_match can be found here: http://us2.php.net/manual/en/function.preg-match.php On 7/20/06, weetat [EMAIL PROTECTED] wrote: Hi all , I am using php4.3.2,MYSQL and RedHat I have a sql text as shown below: SELECT DISTINCT(tbl_chassis.serial_no),tbl_chassis.host_name,tbl_chassis.chasis_model,tbl_chassis.country,tbl_chassis.city,tbl_chassis.building, tbl_chassis.other,tbl_chassis.status,tbl_chassis.chasis_eos,tbl_chassis.chasis_eol,tbl_chassis.chasis_user_field_1,tbl_chassis.chasis_user_field_2,tbl_chassis.chasis_user_field_3 from tbl_chassis tbl_chassis,tbl_card tbl_card WHERE tbl_chassis.serial_no = tbl_card.serial_no AND tbl_chassis.chasis_model LIKE '%WS-C5500%' AND lower(country) = lower(trim('Malaysia')) ORDER BY country,city,building,other I need to extract the tbl_chassis.chasis_model LIKE '%WS-C5500%' and lower(country) = lower(trim('Malaysia')) and join them to new string. Anyone have any suggestion how to do this? Thanks -weetat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] session
I´ve got a big doubt abaout sessions and if someone help me in it, i´ll turn very happy. When i get in e.g. http://www.domain.com and it uses session, a session id will be generated and it´ll be used in whole site. My doubt is: if i´ve got a link that send to http://subdomain.domain.com in a new browser´s window it´ll give me a new session id or it´ll use the same session id that was created before? Thanks a lot. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cleaning bad characters from var
John Nichel wrote: Paul Nowosielski wrote: I wrote a function to do this for our product descriptions when sending them in a XML doc to certain vendors. It's old, crude, but you're welcome to it. snip function that uses regular expressions for simple string replacements Using regular expressions for that is a very bad idea. You're using regular expressions for simple string matches, which is going to be much slower than just using the simple string replace functions. It even warns you against doing what you're doing in the manual. Here's a function that demonstrates replacing several characters with something else function replaceChars($string) { $find_array = array(a, b, c); $replace_array = array(apple, banana, carambola); return str_replace($find_array, $replace_array, $string); } You can, of course, throw other string processing functions in there. Regards, Adam Zey. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session
By default it will give you a new session id. You can set the domain of your session cookie to .domain.com and it will be passed and read by both. I beleive the php.ini option is session.cookie_domain, check your ini file, it should be in there. Chris João Cândido de Souza Neto wrote: I´ve got a big doubt abaout sessions and if someone help me in it, i´ll turn very happy. When i get in e.g. http://www.domain.com and it uses session, a session id will be generated and it´ll be used in whole site. My doubt is: if i´ve got a link that send to http://subdomain.domain.com in a new browser´s window it´ll give me a new session id or it´ll use the same session id that was created before? Thanks a lot. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-DB] Restaurant menu
Hey Craig, Place all items whatever way you want in a table. Its while presenting the menu, you have the query the database like: $query = SELECT menu_id, menu_category, menu_item FROM $menu_name ORDER BY $menu_item_attribute ASC; You can choose multiple tables for menu_category, in which case you shall have to pull out a custom menu by 'joining tables'. Regrds KM On 7/22/06, Craig Hoffman [EMAIL PROTECTED] wrote: Hey there, I'm working on a menu system for a catering company. I'm having a difficult time sorting and grouping items together. For example, there may be three or four appetizers that should be group together. But I only want to display the category (appetizers) once and then the corresponding items (A, B, C,...). I'm drawing a blank on how to go about this. My DB consists of 4 tables (categories, items, item_attributes, menu) but the menu table is most the important. The menu schema is below. menu_id menu_name menu_category = pulls from the categories table (appetizers, starters, etc...) menu_item = pulls from the items table (Cherry Pie) menu_item_atttribute = pulls from the attribute table (Hot, cold, etc) Example: Menu Name: x Appetizers A B C D Desserts A B I'm open to all suggestions / ideas. Thanks - Craig -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php