php-general Digest 12 Oct 2007 03:21:17 -0000 Issue 5068
php-general Digest 12 Oct 2007 03:21:17 - Issue 5068 Topics (messages 263107 through 263130): Re: Filter input 263107 by: Manuel Vacelet Re: Classes - Dumb question 263108 by: Jay Blanchard Re: FileZilla Password Decoder --- $i think therefore $i am 263109 by: Amos Vryhof IIS vs Apache 263110 by: Philip Thompson Detect local or remote call? 263111 by: Anders Norrbring 263112 by: Nathan Nobbe 263114 by: Marcus Mueller 263115 by: Nathan Nobbe 263116 by: Robert Cummings 263117 by: Anders Norrbring Re: round() 263113 by: Jürgen Wind 263118 by: Jürgen Wind 263129 by: Instruct ICC Need help adding dBase support to PHP 263119 by: Jon Westcot 263120 by: Nathan Nobbe 263121 by: Jon Westcot 263122 by: Nathan Nobbe 263124 by: Jon Westcot 263125 by: Nathan Nobbe 263126 by: Jon Westcot 263127 by: Nathan Nobbe 263128 by: Nathan Nobbe preg_match_all Help 263123 by: admin.buskirkgraphics.com Re: Sessions running out of storage space - Increase memory? 263130 by: Matthew Powell 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: [EMAIL PROTECTED] -- ---BeginMessage--- On 10/11/07, Jim Lucas [EMAIL PROTECTED] wrote: What are you wanting to validate? Do you want a package/class/function set that when called will validate different types of input? Email, string, int, etc... Basically yes. I want to validate: - type: (string, int, float, ..) - characteristics (length, allowed characters, ...) - nature (email, ISBN, ...) I also want this lib. to let me define my own rules. For instance, I'm dealing with parameters that looks like 'field_33', 'field_1', 'label', 'title' I want to be able to tells: validate stuff that match: - (field_[0-9]+ or [a-z]+) and maybe in some cases - (field_[0-9]+ or label or title) The thing that remains not very clear to me is where validation stop and where application logic start. Example: A given 'item' (value = 7) have 3 'fields': - field_33 - field_5 - label When it comes to validate the fields value of the item '7' should I validate 'field' against - ('field_33', 'field_5', 'label') - I validate the data are well formed AND coherent. or -('field_[0-9]+', [a-z]+) - I only care about the form and I let the application part deal with coherency later. I don't know if I'm clear enough! ---End Message--- ---BeginMessage--- [snip] Not trying to hijack the thread... Hopefully this is related enough, if not I apologize. Would a good use of a class be to write a generic database connection script? and then feed in the different variables, such as customer login, database, stuff like that? something like class DBConnect { // Connect to database mysql_connect($server, $login, $password, $database); } or no? [/snip] I don't think so because it is inefficient...wrapping an existing stand-alone function is sort of redundant. If you were writing a database abstraction layer that would be a horse of a different color. ---End Message--- ---BeginMessage--- Thanks! That Helped Immensely. the final function is below (with a little documentation)... I'll post my final converter somewhere soon... it's done, and works. // Decodes a FileZilla 2 password function DecodePassword($strPass) { // The Encryption Salt for FileZilla 2 Passwords $strKey = FILEZILLA1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ; // Split the encrypted strings into chunks of 3 $passPieces = str_split($strPass,3); // How many characters in the final password $nPassLen = strlen($strPass) / 3; $nOffset = ($nPassLen % strlen($strKey)); // Clear the variable that holds the decoded password $strDecodedPass = ; // Step through each 3-character chunk foreach($passPieces as $i=$passPiece) { // this should not be needed, but it ensures the correct data type // I think it might be just a throwback from converting from the // Python script $c = intval($passPiece); // I don't rightly know what this does, but it seems to work. // Like I said, it was converted from a python script that worked. $c2 = ord($strKey[($i + $nOffset) % strlen($strKey)]); $c3 = chr(($c ^ $c2)); // Adds the decoded character to the final password String $strDecodedPass .= $c3; } // Spit back the whole collection of decoded characters return $strDecodedPass; } Jochem Maas wrote: Amos Vryhof wrote: Good Morning everyone, def DecodePassword( strPass): Decode a filezilla password strKey = FILEZILLA1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ nPassLen = len(strPass) / 3 nOffset = nPassLen % len(strKey) strDecodedPass =
Re: [PHP] Re: Something you can do with AJAX + PHP as well
tedd wrote: At 3:27 PM +0200 10/10/07, Per Jessen wrote: Colin Guthrie wrote: What do you think of this? http://webbytedd.com/b/timed-php/ It's a combination of using both ajax and php together. I'd say overkill for the end result (could be done in plain Javascript without any Ajax calls), That was my reaction too. I've used iframe/rpc for about three years - ajax doesn't improve on the basic functionality. /Per Jessen, Zürich The rotation of a graphic could be done in javascript, that's true. But, the process demonstrated goes a bit deeper than that. Hi Tedd, OK, what exactly have you demonstrated that could not have been done using javascript/iframe-rpc ? ajax is nothing but javascript, and in principle it is exactly the same as using iframe-rpc. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to decode the PHP Source Code
Hello Everyone, I have the source code of a php application I got from someone but it is encoded with IonCude. I would really appreciate if someone can send me any solution for that. Thank you, Javed From: [EMAIL PROTECTED] Date: Thu, 11 Oct 2007 08:40:22 +0200 To: php-general@lists.php.net Subject: Re: [PHP] Re: Something you can do with AJAX + PHP as well tedd wrote: At 3:27 PM +0200 10/10/07, Per Jessen wrote: Colin Guthrie wrote: What do you think of this? http://webbytedd.com/b/timed-php/ It's a combination of using both ajax and php together. I'd say overkill for the end result (could be done in plain Javascript without any Ajax calls), That was my reaction too. I've used iframe/rpc for about three years - ajax doesn't improve on the basic functionality. /Per Jessen, Zürich The rotation of a graphic could be done in javascript, that's true. But, the process demonstrated goes a bit deeper than that. Hi Tedd, OK, what exactly have you demonstrated that could not have been done using javascript/iframe-rpc ? ajax is nothing but javascript, and in principle it is exactly the same as using iframe-rpc. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Discover the new Windows Vista http://search.msn.com/results.aspx?q=windows+vistamkt=en-USform=QBRE
[PHP] Filter input
Hi all, I repeat the mantra 'filter input, escape output' every day before writing any line of code. About filter input I use to develop my own filter but I don't like this solution as it's error prone (my regexp may be wrong, I don't like to re-invent the wheel that much, ...). I'd like to know if there is a library that could help me. I identified: - PEAR Validate: * seems nice * but no activity since ~1year and still beta. - PEAR HTML_QuickForm: * validation is a part of its job. * not very usable if you only want to validate input (need to declare each element before, access to invalid element not easy). - PHP Filter: * Require php 5.2 * As it's embedded in the php core, if there is a security hole we need to wait for a new php version to fix the bug. Is there any other library I need to investigate ? What are you using for your own developments ? -- Manuel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Classes - Dumb question
Howdy fellas, okay, this is really (!) embarassing, but I have to ask: Why would I want to use classes in PHP? I have been using PHP for years now and writing the normal functions all the time. I have never even bothered working with classes, but now I would love to know what makes the classes so special... Please go easy on me ;o) Just trying to make another step :o) Cheerio, and thanks in advance for any answers. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Beginner Tutorials for using CLASSES in PHP4
[snip] What I was really illustrating is how interfaces are syntactic sugar only. In my above example what I've really shown is an implicit interface :) Since OOP is largely meant to model real world things, ask yourself this... when a doctor sews a pig's heart into a human, do you think there's an explicit interface someplace that checks for compatibility, or does it just work if the conditions are right. Food for thought, pork in fact ;) [/snip] No doubt they are syntactic sugar (and not needed for polymorphism), PHP and other languages are sprinkled with such spices. And just like spices these things have a proper place and usage. (Unless I am slow cooking my world famous brown sugar and cinnamon brisket.) Given the class brisket that extends meat I would likely use an interface to implement said world famous brisket just as others might implement an interface for their brisket. Of course my recipe could be a child of brisket, but may violate the IS_A relationship unless a recipe is implicitly implied for each brisket. Sometimes this syntactic sugar makes for cleaner code (especially when others who are not aware, sometimes folks do it just to do it. YMMV and I am now hungry. BTW, pigs hearts and other body parts are used extensively in research where human physiology is concerned because of their similarity. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How to decode the PHP Source Code
[snip] I have the source code of a php application I got from someone but it is encoded with IonCude. I would really appreciate if someone can send me any solution for that. [/snip] Please do not hijack threads. If you have a new subject create a new e-mail with said subject. This helps to maintain thread readability. http://www.qinvent.com/cyrj/deZender/index-en.php was revealed in the first item of the first page of a google search for decode IonCube. Google is your friend. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Best way to automatically get mySQL database.
hi guys. We've got a local system (PHP intranet) and we need to connect to a live mySQL server get some of the tables (contents) and overwrite the same tables in the local mySQL database. This needs to be done with PHP. Im wondering the best to do this. Is it to get all the information into result sets for each table and then delete the contents of each local table and then looping through the result sets just insert the information into the local tables? This seems like a good solution but I wonder if there are any out there before going ahead with development. Let me know your views etc... Thanks in advance -- Angelo Zanetti Systems developer *Telephone:* +27 (021) 552 9799 *Mobile:* +27 (0) 72 441 3355 *Fax:*+27 (0) 86 681 5885 * Web:* http://www.zlogic.co.za *E-Mail:* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Classes - Dumb question
[snip] okay, this is really (!) embarassing, but I have to ask: Why would I want to use classes in PHP? I have been using PHP for years now and writing the normal functions all the time. I have never even bothered working with classes, but now I would love to know what makes the classes so special... Please go easy on me ;o) Just trying to make another step :o) [/snip] Do not be embarrassed, this is a very good question. First of all what you call normal is procedural or functional programming. There is nothing wrong with doing things this way and may be especially quick and efficient when doing basic web sites and applications. Document well and you will have no problem maintaining your code. OOP (object oriented programming) is especially useful when the application you have created needs to scale. A quick example; you have sold your products to the consumer market for a long time but now the commercial market has become interested. Commercial customers are different than non-commercial customers, different data, different credit requirements, different shipping, etc. but they still have a lot in common, If you had a class Customer you could extended that class to include commercial customers and only have to code for the unique qualities of that kind of customer. Then if another type of customer crops up, say a military contract, you could extend again; class Customer { } class CommercialCustomer extends Customer { /* *only code unique to commercial customers * inherits from Customer other variables * and functions that are common */ } class MilitaryCustomer extends Customer { /* *only code unique to military customers * inherits from Customer other variables * and functions that are common */ } http://www.sitepoint.com/article/object-oriented-php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Best way to automatically get mySQL database.
[snip] We've got a local system (PHP intranet) and we need to connect to a live mySQL server get some of the tables (contents) and overwrite the same tables in the local mySQL database. This needs to be done with PHP. Im wondering the best to do this. Is it to get all the information into result sets for each table and then delete the contents of each local table and then looping through the result sets just insert the information into the local tables? This seems like a good solution but I wonder if there are any out there before going ahead with development. [/snip] TRUNCATE local_table; SELECT remote_stuff INTO local_table; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] FileZilla Password Decoder
Good Morning everyone, This week, I switched from FileZilla 2 to FileZilla 3, and much to my dismay the import function doesn't import the local and remote folders properly. Looking at the FZ2 and FZ3 XML files, it appears that it would be a simple task to write a converter that does. I have a good start on one, (so far it takes all of the parameters in the FZ2 lines and converts them into an array that I will just write back out in XML format) but FZ3 stores the passwords while FZ2 used encoded passwords. I found a Python script at http://www.petersblog.org/node/1152 that is supposed to decode the passwords to plain text - def DecodePassword( strPass): Decode a filezilla password strKey = FILEZILLA1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ nPassLen = len(strPass) / 3 nOffset = nPassLen % len(strKey) strDecodedPass = for i in range(nPassLen): c = int(strPass[i * 3:(i * 3) + 3]) c2 = ord(strKey[(i + nOffset) % len(strKey)]) c3 = chr((c ^ c2)) strDecodedPass += c3 return strDecodedPass ...and tried to convert it to PHP, but since I don't know Python and there is no documentation in the script to say what it's doing, my function doesn't spit out all of the right characters... (it does some though?? maybe coincidence) function DecodePassword($strPass) { $strKey = FILEZILLA1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ; $nPassLen = strlen($strPass) / 3; $nOffset = ($nPassLen % strlen($strKey)); $strDecodedPass = ; $passPieces = str_split($strPass,3); foreach($passPieces as $passPiece) { $c = intval($passPiece); $c2 = ord($strKey[($i + $nOffset) % strlen($strKey)]); $c3 = chr(($c ^ $c2)); $strDecodedPass .= $c3; } return $strDecodedPass; } I know I simplified quite a bit, but I might have done it wrong...I tried to convert line-for line, but I'm not sure what the stuff on Lines 10 to 13 do. (Lack of Perl knowledge) There are perl and Javascript functions to do the decoding at http://filezilla.sourceforge.net/forum/viewtopic.php?t=170 I'm not looking for a major undertaking, just something to do the conversion so I don't have to rebuild definitions for 200 and something websites If I can get it working properly, I'll probably put a version on my server so people can convert their files as well, as I can see this being a major PITA. Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Best way to automatically get mySQL database.
thanks thought there was something simpler Jay Blanchard wrote: [snip] We've got a local system (PHP intranet) and we need to connect to a live mySQL server get some of the tables (contents) and overwrite the same tables in the local mySQL database. This needs to be done with PHP. Im wondering the best to do this. Is it to get all the information into result sets for each table and then delete the contents of each local table and then looping through the result sets just insert the information into the local tables? This seems like a good solution but I wonder if there are any out there before going ahead with development. [/snip] TRUNCATE local_table; SELECT remote_stuff INTO local_table; -- Angelo Zanetti Systems developer *Telephone:* +27 (021) 552 9799 *Mobile:* +27 (0) 72 441 3355 *Fax:*+27 (0) 86 681 5885 * Web:* http://www.zlogic.co.za *E-Mail:* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Beginner Tutorials for using CLASSES in PHP4
On Thu, 2007-10-11 at 07:19 -0500, Jay Blanchard wrote: [snip] What I was really illustrating is how interfaces are syntactic sugar only. In my above example what I've really shown is an implicit interface :) Since OOP is largely meant to model real world things, ask yourself this... when a doctor sews a pig's heart into a human, do you think there's an explicit interface someplace that checks for compatibility, or does it just work if the conditions are right. Food for thought, pork in fact ;) [/snip] No doubt they are syntactic sugar (and not needed for polymorphism), PHP and other languages are sprinkled with such spices. And just like spices these things have a proper place and usage. (Unless I am slow cooking my world famous brown sugar and cinnamon brisket.) Given the class brisket that extends meat I would likely use an interface to implement said world famous brisket just as others might implement an interface for their brisket. Of course my recipe could be a child of brisket, but may violate the IS_A relationship unless a recipe is implicitly implied for each brisket. Sometimes this syntactic sugar makes for cleaner code (especially when others who are not aware, sometimes folks do it just to do it. YMMV and I am now hungry. BTW, pigs hearts and other body parts are used extensively in research where human physiology is concerned because of their similarity. And how do you think similarity was determined? Most likely by trying options until something worked :) Cheers, Rob. -- ... SwarmBuy.com - http://www.swarmbuy.com Leveraging the buying power of the masses! ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Something you can do with AJAX + PHP as well
At 8:40 AM +0200 10/11/07, Per Jessen wrote: tedd wrote: At 3:27 PM +0200 10/10/07, Per Jessen wrote: Colin Guthrie wrote: What do you think of this? http://webbytedd.com/b/timed-php/ It's a combination of using both ajax and php together. I'd say overkill for the end result (could be done in plain Javascript without any Ajax calls), That was my reaction too. I've used iframe/rpc for about three years - ajax doesn't improve on the basic functionality. /Per Jessen, Zürich The rotation of a graphic could be done in javascript, that's true. But, the process demonstrated goes a bit deeper than that. Hi Tedd, OK, what exactly have you demonstrated that could not have been done using javascript/iframe-rpc ? ajax is nothing but javascript, and in principle it is exactly the same as using iframe-rpc. I dunno -- I've never used iframe-rpc and I'm not commenting pro/con about it. I was just saying that my demo is a combination of using php and ajax to produce something. Now, maybe some people want to call it an overkill and say that *everything* could be done in javascript alone. That's fine, but they are missing the point I'm failing to make. My demo is just another (not unique) way to use both javascript and php to solve a problem. For example: If you have a process that is taking time server-side and want to let the user know in real time what the progress is, this is one way to do it. That's not something (by definition) you can do with javascript alone, right? There are other applications, but if you fail to see the basic concept, then you also fail to see the opportunity. 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] How to decode the PHP Source Code
On Thu, 2007-10-11 at 12:06 +, Javed Khan wrote: Hello Everyone, I have the source code of a php application I got from someone but it is encoded with IonCude. I would really appreciate if someone can send me any solution for that. There's a reason it's encoded with IonCube. Someone didn't want you to have access to plain source code. Cheers, Rob. -- ... SwarmBuy.com - http://www.swarmbuy.com Leveraging the buying power of the masses! ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] FileZilla Password Decoder --- $i think therefore $i am
Amos Vryhof wrote: Good Morning everyone, def DecodePassword( strPass): Decode a filezilla password strKey = FILEZILLA1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ nPassLen = len(strPass) / 3 nOffset = nPassLen % len(strKey) strDecodedPass = for i in range(nPassLen): c = int(strPass[i * 3:(i * 3) + 3]) c2 = ord(strKey[(i + nOffset) % len(strKey)]) c3 = chr((c ^ c2)) strDecodedPass += c3 return strDecodedPass ...and tried to convert it to PHP, but since I don't know Python and there is no documentation in the script to say what it's doing, my function doesn't spit out all of the right characters... (it does some though?? maybe coincidence) function DecodePassword($strPass) { $strKey = FILEZILLA1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ; $nPassLen = strlen($strPass) / 3; $nOffset = ($nPassLen % strlen($strKey)); $strDecodedPass = ; $passPieces = str_split($strPass,3); foreach($passPieces as $passPiece) { $c = intval($passPiece); $c2 = ord($strKey[($i + $nOffset) % strlen($strKey)]); ^ WHERE IS $i DEFINED? (hint: it's not :-) $c3 = chr(($c ^ $c2)); $strDecodedPass .= $c3; } return $strDecodedPass; } I know I simplified quite a bit, but I might have done it wrong...I tried to convert line-for line, but I'm not sure what the stuff on Lines 10 to 13 do. (Lack of Perl knowledge) There are perl and Javascript functions to do the decoding at http://filezilla.sourceforge.net/forum/viewtopic.php?t=170 I'm not looking for a major undertaking, just something to do the conversion so I don't have to rebuild definitions for 200 and something websites If I can get it working properly, I'll probably put a version on my server so people can convert their files as well, as I can see this being a major PITA. Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Classes - Dumb question
On Thu, 2007-10-11 at 07:36 -0500, Jay Blanchard wrote: [snip] okay, this is really (!) embarassing, but I have to ask: Why would I want to use classes in PHP? I have been using PHP for years now and writing the normal functions all the time. I have never even bothered working with classes, but now I would love to know what makes the classes so special... Please go easy on me ;o) Just trying to make another step :o) [/snip] Do not be embarrassed, this is a very good question. First of all what you call normal is procedural or functional programming. There is nothing wrong with doing things this way and may be especially quick and efficient when doing basic web sites and applications. Document well and you will have no problem maintaining your code. OOP (object oriented programming) is especially useful when the application you have created needs to scale. A quick example; you have sold your products to the consumer market for a long time but now the commercial market has become interested. Commercial customers are different than non-commercial customers, different data, different credit requirements, different shipping, etc. but they still have a lot in common, If you had a class Customer you could extended that class to include commercial customers and only have to code for the unique qualities of that kind of customer. Then if another type of customer crops up, say a military contract, you could extend again; class Customer { } class CommercialCustomer extends Customer { /* *only code unique to commercial customers * inherits from Customer other variables * and functions that are common */ } class MilitaryCustomer extends Customer { /* *only code unique to military customers * inherits from Customer other variables * and functions that are common */ } http://www.sitepoint.com/article/object-oriented-php Another good reason is for function/data grouping. By using a class you don't have to worry about name collisions for your functions, although you can still have class name collisions. Also, data related to any operations can be tracked via the object rather than cluttering the global namespace between function calls. Cheers, Rob. -- ... SwarmBuy.com - http://www.swarmbuy.com Leveraging the buying power of the masses! ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Classes - Dumb question
On Oct 11, 2007, at 8:36 AM, Jay Blanchard wrote: [snip] okay, this is really (!) embarassing, but I have to ask: Why would I want to use classes in PHP? I have been using PHP for years now and writing the normal functions all the time. I have never even bothered working with classes, but now I would love to know what makes the classes so special... Please go easy on me ;o) Just trying to make another step :o) [/snip] Do not be embarrassed, this is a very good question. First of all what you call normal is procedural or functional programming. There is nothing wrong with doing things this way and may be especially quick and efficient when doing basic web sites and applications. Document well and you will have no problem maintaining your code. OOP (object oriented programming) is especially useful when the application you have created needs to scale. A quick example; you have sold your products to the consumer market for a long time but now the commercial market has become interested. Commercial customers are different than non-commercial customers, different data, different credit requirements, different shipping, etc. but they still have a lot in common, If you had a class Customer you could extended that class to include commercial customers and only have to code for the unique qualities of that kind of customer. Then if another type of customer crops up, say a military contract, you could extend again; class Customer { } class CommercialCustomer extends Customer { /* *only code unique to commercial customers * inherits from Customer other variables * and functions that are common */ } class MilitaryCustomer extends Customer { /* *only code unique to military customers * inherits from Customer other variables * and functions that are common */ } http://www.sitepoint.com/article/object-oriented-php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Not trying to hijack the thread... Hopefully this is related enough, if not I apologize. Would a good use of a class be to write a generic database connection script? and then feed in the different variables, such as customer login, database, stuff like that? something like class DBConnect { // Connect to database mysql_connect($server, $login, $password, $database); } or no? -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave 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] How to decode the PHP Source Code
On 10/11/07, Javed Khan [EMAIL PROTECTED] wrote: Hello Everyone, I have the source code of a php application I got from someone but it is encoded with IonCude. I would really appreciate if someone can send me any solution for that. Thank you, Javed From: [EMAIL PROTECTED] Date: Thu, 11 Oct 2007 08:40:22 +0200 To: php-general@lists.php.net Subject: Re: [PHP] Re: Something you can do with AJAX + PHP as well tedd wrote: At 3:27 PM +0200 10/10/07, Per Jessen wrote: Colin Guthrie wrote: What do you think of this? http://webbytedd.com/b/timed-php/ It's a combination of using both ajax and php together. I'd say overkill for the end result (could be done in plain Javascript without any Ajax calls), That was my reaction too. I've used iframe/rpc for about three years - ajax doesn't improve on the basic functionality. /Per Jessen, Zürich The rotation of a graphic could be done in javascript, that's true. But, the process demonstrated goes a bit deeper than that. Hi Tedd, OK, what exactly have you demonstrated that could not have been done using javascript/iframe-rpc ? ajax is nothing but javascript, and in principle it is exactly the same as using iframe-rpc. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Discover the new Windows Vista http://search.msn.com/results.aspx?q=windows+vistamkt=en-USform=QBRE There are just way too many things wrong with this message. It would be fun to count them all together, wouldn't it? ;-P By the way, Tedd you alright there? Ya' kinda' got squashed. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 Give a man a fish, he'll eat for a day. Then you'll find out he was allergic and is hospitalized. See? No good deed goes unpunished -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Beginner Tutorials for using CLASSES in PHP4
On 10/11/07, Robert Cummings [EMAIL PROTECTED] wrote: On Thu, 2007-10-11 at 07:19 -0500, Jay Blanchard wrote: [snip] What I was really illustrating is how interfaces are syntactic sugar only. In my above example what I've really shown is an implicit interface :) Since OOP is largely meant to model real world things, ask yourself this... when a doctor sews a pig's heart into a human, do you think there's an explicit interface someplace that checks for compatibility, or does it just work if the conditions are right. Food for thought, pork in fact ;) [/snip] No doubt they are syntactic sugar (and not needed for polymorphism), PHP and other languages are sprinkled with such spices. And just like spices these things have a proper place and usage. (Unless I am slow cooking my world famous brown sugar and cinnamon brisket.) Given the class brisket that extends meat I would likely use an interface to implement said world famous brisket just as others might implement an interface for their brisket. Of course my recipe could be a child of brisket, but may violate the IS_A relationship unless a recipe is implicitly implied for each brisket. Sometimes this syntactic sugar makes for cleaner code (especially when others who are not aware, sometimes folks do it just to do it. YMMV and I am now hungry. BTW, pigs hearts and other body parts are used extensively in research where human physiology is concerned because of their similarity. And how do you think similarity was determined? Most likely by trying options until something worked :) im sure they chopped a few of them open; that is they analyzed the implementation directly, rather than looking at it as a black box and praying.. and i would still say the holes or openings the heart exposes are an explicit interface that the doctors do run a check against. namely, how many holes are there, and do they correspond to the same holes on the human heart. perhaps theres an implicit interface somewhere inside the implementation. the pig heart calls a method on a human blood cell that has to be there otherwise something doesnt happen and in the worst case a fatal error occurs and the person has a stroke. -nathan
Re: [PHP] round()
On 10/11/07, tedd [EMAIL PROTECTED] wrote: At 4:18 PM -0600 10/10/07, [EMAIL PROTECTED] wrote: I disagree. I will need to see an example where the round() is inaccurate. You may disagree if you wish, but the php function round() is inaccurate by definition -- all *rounding* algorithms are inaccurate. thats why i suggested the bcmath based algorithm, as bcmath supports arbitrary precision. i built a quick test script using the method from the top comment of the bcmath page, and round(). it allows for quick comparisons of the 2 algorithms and tells you if the results are the same. i messed around w/ it a little bit and the results were the same every time. [EMAIL PROTECTED] ~/working/www $ vim bcRound.php [EMAIL PROTECTED] ~/working/www $ ./bcRound.php 5.58635634564356 6 round result: 5.586356 roundbc result: 5.586356 the results are different [EMAIL PROTECTED] ~/working/www $ vim bcRound.php [EMAIL PROTECTED] ~/working/www $ ./bcRound.php 5.58635634564356 6 round result: 5.586356 roundbc result: 5.586356 the results are the same [EMAIL PROTECTED] ~/working/www $ ./bcRound.php 5.58635634564356 8 round result: 5.58635635 roundbc result: 5.58635635 the results are the same [EMAIL PROTECTED] ~/working/www $ ./bcRound.php 5.58635634564356 3 round result: 5.586 roundbc result: 5.586 the results are the same i dont know what the point of the toFixed() function is (posted earlier). round takes a second parameter that specifies the desired precision. #!/usr/bin/php ?php if($argc != 3) { die('Usage: rounder.php float precision' . PHP_EOL); } $float = $argv[1]; $precision = $argv[2]; $roundResult = round($float, $precision); $roundbcResult = roundbc($float, $precision); echo round result: $roundResult . PHP_EOL; echo roundbc result: $roundbcResult . PHP_EOL; if($roundResult !== $roundbcResult) { echo 'the results are the same' . PHP_EOL; } else { echo 'the results are different' . PHP_EOL; } /// borrowed from post on php.net function roundbc($x, $p) { $x = trim($x); $data = explode(.,$x); if(substr($data[1],$p,1) = 5) { //generate the add string. $i=0; $addString = 5; while($i $p) { $addString = 0 . $addString; $i++; }//end while. $addString = . . $addString; //now add the addString to the original fraction. $sum = bcadd($data[0] . . . $data [1],$addString,$p+1); //explode the result. $sumData = explode(.,$sum); //now, return the correct precision on the rounded number. return $sumData[0] . . . substr($sumData[1],0,$p); } else { //don't round the value and return the orignal to the desired //precision or less. return $data[0] . . . substr($data[1],0,$p); }//end if/else. }//end roundbc. ? -nathan
RE: [PHP] round()
At 4:18 PM -0600 10/10/07, [EMAIL PROTECTED] wrote: I disagree. I will need to see an example where the round() is inaccurate. You may disagree if you wish, but the php function round() is inaccurate by definition -- all *rounding* algorithms are inaccurate. My claim is the there are more accurate ways to round. 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] Filter input
Manuel Vacelet wrote: Hi all, I repeat the mantra 'filter input, escape output' every day before writing any line of code. About filter input I use to develop my own filter but I don't like this solution as it's error prone (my regexp may be wrong, I don't like to re-invent the wheel that much, ...). I'd like to know if there is a library that could help me. I identified: - PEAR Validate: * seems nice * but no activity since ~1year and still beta. - PEAR HTML_QuickForm: * validation is a part of its job. * not very usable if you only want to validate input (need to declare each element before, access to invalid element not easy). - PHP Filter: * Require php 5.2 * As it's embedded in the php core, if there is a security hole we need to wait for a new php version to fix the bug. Is there any other library I need to investigate ? What are you using for your own developments ? -- Manuel What are you wanting to validate? Do you want a package/class/function set that when called will validate different types of input? Email, string, int, etc... -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Something you can do with AJAX + PHP as well
tedd wrote: For example: If you have a process that is taking time server-side and want to let the user know in real time what the progress is, this is one way to do it. That's not something (by definition) you can do with javascript alone, right? Correct, but it doesn't require any ajax either. That was my main point. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Filter input
On 10/11/07, Jim Lucas [EMAIL PROTECTED] wrote: What are you wanting to validate? Do you want a package/class/function set that when called will validate different types of input? Email, string, int, etc... Basically yes. I want to validate: - type: (string, int, float, ..) - characteristics (length, allowed characters, ...) - nature (email, ISBN, ...) I also want this lib. to let me define my own rules. For instance, I'm dealing with parameters that looks like 'field_33', 'field_1', 'label', 'title' I want to be able to tells: validate stuff that match: - (field_[0-9]+ or [a-z]+) and maybe in some cases - (field_[0-9]+ or label or title) The thing that remains not very clear to me is where validation stop and where application logic start. Example: A given 'item' (value = 7) have 3 'fields': - field_33 - field_5 - label When it comes to validate the fields value of the item '7' should I validate 'field' against - ('field_33', 'field_5', 'label') - I validate the data are well formed AND coherent. or -('field_[0-9]+', [a-z]+) - I only care about the form and I let the application part deal with coherency later. I don't know if I'm clear enough! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] FileZilla Password Decoder --- $i think therefore $i am
Thanks! That Helped Immensely. the final function is below (with a little documentation)... I'll post my final converter somewhere soon... it's done, and works. // Decodes a FileZilla 2 password function DecodePassword($strPass) { // The Encryption Salt for FileZilla 2 Passwords $strKey = FILEZILLA1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ; // Split the encrypted strings into chunks of 3 $passPieces = str_split($strPass,3); // How many characters in the final password $nPassLen = strlen($strPass) / 3; $nOffset = ($nPassLen % strlen($strKey)); // Clear the variable that holds the decoded password $strDecodedPass = ; // Step through each 3-character chunk foreach($passPieces as $i=$passPiece) { // this should not be needed, but it ensures the correct data type // I think it might be just a throwback from converting from the // Python script $c = intval($passPiece); // I don't rightly know what this does, but it seems to work. // Like I said, it was converted from a python script that worked. $c2 = ord($strKey[($i + $nOffset) % strlen($strKey)]); $c3 = chr(($c ^ $c2)); // Adds the decoded character to the final password String $strDecodedPass .= $c3; } // Spit back the whole collection of decoded characters return $strDecodedPass; } Jochem Maas wrote: Amos Vryhof wrote: Good Morning everyone, def DecodePassword( strPass): Decode a filezilla password strKey = FILEZILLA1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ nPassLen = len(strPass) / 3 nOffset = nPassLen % len(strKey) strDecodedPass = for i in range(nPassLen): c = int(strPass[i * 3:(i * 3) + 3]) c2 = ord(strKey[(i + nOffset) % len(strKey)]) c3 = chr((c ^ c2)) strDecodedPass += c3 return strDecodedPass ...and tried to convert it to PHP, but since I don't know Python and there is no documentation in the script to say what it's doing, my function doesn't spit out all of the right characters... (it does some though?? maybe coincidence) function DecodePassword($strPass) { $strKey = FILEZILLA1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ; $nPassLen = strlen($strPass) / 3; $nOffset = ($nPassLen % strlen($strKey)); $strDecodedPass = ; $passPieces = str_split($strPass,3); foreach($passPieces as $passPiece) { $c = intval($passPiece); $c2 = ord($strKey[($i + $nOffset) % strlen($strKey)]); ^ WHERE IS $i DEFINED? (hint: it's not :-) $c3 = chr(($c ^ $c2)); $strDecodedPass .= $c3; } return $strDecodedPass; } I know I simplified quite a bit, but I might have done it wrong...I tried to convert line-for line, but I'm not sure what the stuff on Lines 10 to 13 do. (Lack of Perl knowledge) There are perl and Javascript functions to do the decoding at http://filezilla.sourceforge.net/forum/viewtopic.php?t=170 I'm not looking for a major undertaking, just something to do the conversion so I don't have to rebuild definitions for 200 and something websites If I can get it working properly, I'll probably put a version on my server so people can convert their files as well, as I can see this being a major PITA. Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Classes - Dumb question
[snip] Not trying to hijack the thread... Hopefully this is related enough, if not I apologize. Would a good use of a class be to write a generic database connection script? and then feed in the different variables, such as customer login, database, stuff like that? something like class DBConnect { // Connect to database mysql_connect($server, $login, $password, $database); } or no? [/snip] I don't think so because it is inefficient...wrapping an existing stand-alone function is sort of redundant. If you were writing a database abstraction layer that would be a horse of a different color. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] IIS vs Apache
From this article http://blogs.iis.net/bills/archive/2007/05/07/iis-vs-apache.aspx written in May of this year, the author makes this comment about IIS and PHP: [snippet] If you're worried about IIS performance and reliability when running PHP vs. running on Apache, you're concerns are definitely valid. Up until recently there were only two ways to run PHP: the slow way (CGI), and the unreliable way (ISAPI). :) This is primarily a result of the lack of thread-safety in some PHP extensions - they were originally written for the pre-fork Linux/Apache environment which is not multi-threaded. Running them on IIS with the PHP ISAPI causes them to crash, and take out the IIS process serving your application. Fortunately, the Microsoft / Zend partnership has brought about fixes to these issues with many performance and compatibility fixes by Zend, and a FastCGI feature for IIS which enables fast, reliable PHP hosting. FastCGI is available now in Tech Preview form, and has also been included in Windows Server Longhorn Beta 3. It will be included in Vista SP1 and Longhorn Server at RTM. [/snippet] This author (employed my M$) even says that PHP ISAPI can cause IIS to crash. Am I taking the one-liner out of context? Does this happen often? What are the conditions in which it would cause it to crash? What I am currently doing is some research to see if we want to move our web server from IIS 6 to Apache 2. We will still be running on a Windows 2k3 server. So, I wanted to query the list and see what you have to say about using IIS or Apache on a Windows server - we are a Windows environment (my hands are tied there =). Our development language is only PHP at this point. We are currently using MySQL, but my supervisor is considering moving to MS SQL Server (blegh!) - any issues with Apache there? Thanks in advance, ~Philip
[PHP] Detect local or remote call?
Is there a good way to detect in a script if it's called locally from command line, or via a remote browser? Anders. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Detect local or remote call?
On 10/11/07, Anders Norrbring [EMAIL PROTECTED] wrote: Is there a good way to detect in a script if it's called locally from command line, or via a remote browser? Anders maybe not the best, but works for linux: ?php if(isset($_SERVER['SHELL'])) { echo 'cli script' . PHP_EOL; } else { echo 'web script'; } ? -nathan
Re: [PHP] Detect local or remote call?
On 10/11/07, Marcus Mueller [EMAIL PROTECTED] wrote: Anders Norrbring wrote: Is there a good way to detect in a script if it's called locally from command line, or via a remote browser? Check out http://www.php.net/manual/en/function.php-sapi-name.php. much better:) php echo php_sapi_name(); cli -nathan
Re: [PHP] Detect local or remote call?
Anders Norrbring wrote: Is there a good way to detect in a script if it's called locally from command line, or via a remote browser? Check out http://www.php.net/manual/en/function.php-sapi-name.php. Greetings m. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: round()
I get correct results: 5.2.4 PHP_VERSION round(5.555,2):5.56 toFixed(5.555,2):5.56 admin-214 wrote: While we're entertaining algorithms, has anyone else noticed that php's round() isn't the most accurate algorithm to round? If you will refer to chafy's reply on 28-Feb-2007 06:13 http://us2.php.net/manual/en/function.round.php#73537 The function round numbers to a given precision. function toFixed($number, $round=2) { $tempd = $number*pow(10,$round); $tempd1 = round($tempd); $number = $tempd1/pow(10,$round); return $number; } echo toFixed(5.555,2); //return 5.56 If your rounding issue is passed 2 decimal places. I found this function covenant and problem solving. As for the accuracy of the algorithm I disagree. I will need to see an example where the round() is inaccurate. -- View this message in context: http://www.nabble.com/round%28%29-tf4602528.html#a13161858 Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Detect local or remote call?
On Thu, 2007-10-11 at 19:58 +0200, Anders Norrbring wrote: Is there a good way to detect in a script if it's called locally from command line, or via a remote browser? I've always used if( isset( $_SERVER['SERVER_PORT'] ) ) { return 'web'; } Cheers, Rob. -- ... SwarmBuy.com - http://www.swarmbuy.com Leveraging the buying power of the masses! ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Detect local or remote call?
Nathan Nobbe skrev: On 10/11/07, *Marcus Mueller* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Anders Norrbring wrote: Is there a good way to detect in a script if it's called locally from command line, or via a remote browser? Check out http://www.php.net/manual/en/function.php-sapi-name.php. much better:) php echo php_sapi_name(); cli -nathan Thanks, seems to be the easiest way.. ;) Anders. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: round()
well, seems to be OS dependent: PHP_OS:Linux (Suse 9.x 32bit) | PHP_VERSION:5.0.3 $t=1.255; round($t,2):1.26 $t += .0001; round($t,2):1.26 PHP_OS:WINNT (2000) | PHP_VERSION:5.2.4 $t=1.255; round($t,2):1.25 $t += .0001; round($t,2):1.26 -- View this message in context: http://www.nabble.com/round%28%29-tf4602528.html#a13164737 Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Need help adding dBase support to PHP
Hi all: I'm not versed at all with Linux, and I need some help in configuring PHP to allow me to use the dBase-related functions. From what I read in the help files, it seems that I need to recompile PHP with the --enable-dbase command, but I don't know how to do this. Can someone out there help me out? All help will be greatly appreciated! Thanks, Jon
Re: [PHP] Need help adding dBase support to PHP
On 10/11/07, Jon Westcot [EMAIL PROTECTED] wrote: Hi all: I'm not versed at all with Linux, and I need some help in configuring PHP to allow me to use the dBase-related functions. From what I read in the help files, it seems that I need to recompile PHP with the --enable-dbase command, but I don't know how to do this. Can someone out there help me out? All help will be greatly appreciated! what linux distribution are you using? -nathan
Re: [PHP] Need help adding dBase support to PHP
Hi Nathan: I have no idea. Where would I look to find this out? Will phpinfo() give me this? And, if so, where would I find it? Jon - Original Message - From: Nathan Nobbe To: Jon Westcot Cc: PHP General Sent: Thursday, October 11, 2007 5:00 PM Subject: Re: [PHP] Need help adding dBase support to PHP On 10/11/07, Jon Westcot [EMAIL PROTECTED] wrote: Hi all: I'm not versed at all with Linux, and I need some help in configuring PHP to allow me to use the dBase-related functions. From what I read in the help files, it seems that I need to recompile PHP with the --enable-dbase command, but I don't know how to do this. Can someone out there help me out? All help will be greatly appreciated! what linux distribution are you using? -nathan
Re: [PHP] Need help adding dBase support to PHP
On 10/11/07, Jon Westcot [EMAIL PROTECTED] wrote: Hi Nathan: I have no idea. Where would I look to find this out? Will phpinfo() give me this? And, if so, where would I find it? you might try uname -a from the command line; but theres no guarantee it will show the distribution. it will show the kernel, and sometime kernels are named after the distro since they are often modified by the distribution. -nathan
[PHP] preg_match_all Help
I have tried this many way and for some reason I cannot pull content between the 2 pattern options. function pullchannel($document) { preg_match_all('/div class=channel [^]*(.*)div class=channel [^]*/i',$document,$elements); $match = implode(\r\n,$elements[0]); $match = str_replace('',,$match); return $match; }
Re: [PHP] Need help adding dBase support to PHP
Hi again, Nathan: I'm not certain how to get to a command line. The server is a shared server provided by GoDaddy, if that's any help. They told me that I needed to change something in the .htaccess file, but that didn't sound right at all. Thanks again for your help. Jon - Original Message - From: Nathan Nobbe To: Jon Westcot Cc: PHP General Sent: Thursday, October 11, 2007 5:08 PM Subject: Re: [PHP] Need help adding dBase support to PHP On 10/11/07, Jon Westcot [EMAIL PROTECTED] wrote: Hi Nathan: I have no idea. Where would I look to find this out? Will phpinfo() give me this? And, if so, where would I find it? you might try uname -a from the command line; but theres no guarantee it will show the distribution. it will show the kernel, and sometime kernels are named after the distro since they are often modified by the distribution. -nathan
Re: [PHP] Need help adding dBase support to PHP
On 10/11/07, Jon Westcot [EMAIL PROTECTED] wrote: Hi again, Nathan: I'm not certain how to get to a command line. The server is a shared server provided by GoDaddy, if that's any help. They told me that I needed to change something in the .htaccess file, but that didn't sound right at all. they may be right. did they give you some sort of documentation you could point us to? also, to determine if you have command line access, look around and see if they provide ssh access to the machine. if so i can tell you how to ssh in, even if you have windows or mac. that will give you a command line prompt on the remote machine. -nathan
Re: [PHP] Need help adding dBase support to PHP
Hi again: Thanks for the info. From what I can see, GoDaddy does NOT provide access to ssh. Any other thoughts? Or is there some way to tell me, in general terms, how to configure PHP to allow the dbase functions to be used? Jon - Original Message - From: Nathan Nobbe To: Jon Westcot Cc: PHP General Sent: Thursday, October 11, 2007 5:34 PM Subject: Re: [PHP] Need help adding dBase support to PHP On 10/11/07, Jon Westcot [EMAIL PROTECTED] wrote: Hi again, Nathan: I'm not certain how to get to a command line. The server is a shared server provided by GoDaddy, if that's any help. They told me that I needed to change something in the .htaccess file, but that didn't sound right at all. they may be right. did they give you some sort of documentation you could point us to? also, to determine if you have command line access, look around and see if they provide ssh access to the machine. if so i can tell you how to ssh in, even if you have windows or mac. that will give you a command line prompt on the remote machine. -nathan
Re: [PHP] Need help adding dBase support to PHP
On 10/11/07, Jon Westcot [EMAIL PROTECTED] wrote: Hi again: Thanks for the info. From what I can see, GoDaddy does NOT provide access to ssh. Any other thoughts? Or is there some way to tell me, in general terms, how to configure PHP to allow the dbase functions to be used? if godaddy is recommending that you place values in a .htaccess file they probly mean you should upload a .htaccess file via ftp. im assuming thats how the give you access to the system (since there is no ssh access). im a bit unsure of the .htaccess setting, though i recently posted a small how-to on using .htaccess files to override settings in php.ini; this is common in shared hosting environments. http://gentoo-wiki.com/HOWTO_php.ini_overrides_w/_.htaccess basically, to have dbase support, php must be compiled w/ --enable-dbase, per the documentation. http://www.php.net/manual/en/rlef.dbase.php perhaps, it is compiled in and the php.ini settings are preventing you from using the functions (though that sounds hard to believe). you might try tossing a phpinfo script on the box and looking for dbase in the output; particularly look for --enable-dbase, or --disable-dbase. you should see a dbase section also, if its compiled in. if it is there we can get a better idea of what sort of values could be placed in the .htaccess file that would influence the behavior of the dbase component on that system. -nathan
Re: [PHP] Need help adding dBase support to PHP
On 10/11/07, Nathan Nobbe [EMAIL PROTECTED] wrote: On 10/11/07, Jon Westcot [EMAIL PROTECTED] wrote: Hi again: Thanks for the info. From what I can see, GoDaddy does NOT provide access to ssh. Any other thoughts? Or is there some way to tell me, in general terms, how to configure PHP to allow the dbase functions to be used? if godaddy is recommending that you place values in a .htaccess file they probly mean you should upload a .htaccess file via ftp. im assuming thats how the give you access to the system (since there is no ssh access). im a bit unsure of the .htaccess setting, though i recently posted a small how-to on using .htaccess files to override settings in php.ini; this is common in shared hosting environments. http://gentoo-wiki.com/HOWTO_php.ini_overrides_w/_.htaccess basically, to have dbase support, php must be compiled w/ --enable-dbase, per the documentation. http://www.php.net/manual/en/rlef.dbase.php perhaps, it is compiled in and the php.ini settings are preventing you from using the functions (though that sounds hard to believe). you might try tossing a phpinfo script on the box and looking for dbase in the output; particularly look for --enable-dbase, or --disable-dbase. you should see a dbase section also, if its compiled in. if it is there we can get a better idea of what sort of values could be placed in the .htaccess file that would influence the behavior of the dbase component on that system. -nathan oh, i just spent and extra second and discovered: (from documentation :) This extension has no configuration directives defined in php.ini. if dbase does not appear to be installed on the system when you look at phpifno output i would draft an email to them expressing that it doesnt appear to be compiled in and ask them if they can add it. -nathan
RE: [PHP] RE: round()
well, seems to be OS dependent: PHP_OS:Linux (Suse 9.x 32bit) | PHP_VERSION:5.0.3 $t=1.255; round($t,2):1.26 $t += .0001; round($t,2):1.26 PHP_OS:WINNT (2000) | PHP_VERSION:5.2.4 $t=1.255; round($t,2):1.25 $t += .0001; round($t,2):1.26 -- View this message in context: http://www.nabble.com/round%28%29-tf4602528.html#a13164737 Sent from the PHP - General mailing list archive at Nabble.com. First, you may have to be aware of floating point precision on your platform. http://php.he.net/manual/en/language.types.float.php The size of a float is platform-dependent What is $t after $t += .0001; ? Now I see why BCMath was mentioned. _ Windows Live Hotmail and Microsoft Office Outlook – together at last. Get it now. http://office.microsoft.com/en-us/outlook/HA102225181033.aspx?pid=CL100626971033
Re: [PHP] Sessions running out of storage space - Increase memory?
Dan wrote: I need to retrieve a huge amount of data form a database and do so many times. To eliminate the overhead of connecting to the database and pulling down all that info over and over, I'm trying to pull it down only once and stick it into a session. The problem is I get the first few results and everything works fine. But then after those first 5 or so I only get 0's. My first thought is that this is because of a limit on memory that sessions can take up or file size/space where the sessions are stored. I looked in the PHP.INI and I didn't find anything though. Any ideas on how to fix this problem or a more elegant solution to my huge data needs? - Dan APC? apc_store('some_array',serialize($some_array),86400); caches $some_array in RAM for 24 hours. $some_array = unserialize(apc_fetch('some_array')); brings it back out. Note - don't do this if you're dealing with massive amounts of data unique to each session_id, though. Come to think of it... if you're dealing with massive amounts of data for each session_id, that might be part of your problem. :) Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_match_all Help
[EMAIL PROTECTED] wrote: I have tried this many way and for some reason I cannot pull content between the 2 pattern options. function pullchannel($document) { preg_match_all('/div class=channel [^]*(.*)div class=channel [^]*/i',$document,$elements); $match = implode(\r\n,$elements[0]); $match = str_replace('',,$match); return $match; } Give us and example of the input data. And tell us from that example, what it is you are expecting to extract from it. Jim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Compose MP3 from a php enabled flash page.
I have an educational web site. I want to create an interface where my students can record their voices client side and then save messages server side. I thought Odeo would solve my problems. (The have their own problems now.) Then I tried: MyChingo and Mobasoft. COme on $6,000 for a site licence. Are there any php alternatives? Or do you know an flash code I can find in sourceforge, that I might hack, or combine PHP Flash so they can record me messages in mp3 and submit them? John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Classes - Dumb question
On Thursday 11 October 2007, Jay Blanchard wrote: [snip] okay, this is really (!) embarassing, but I have to ask: Why would I want to use classes in PHP? I have been using PHP for years now and writing the normal functions all the time. I have never even bothered working with classes, but now I would love to know what makes the classes so special... Please go easy on me ;o) Just trying to make another step :o) [/snip] Do not be embarrassed, this is a very good question. First of all what you call normal is procedural or functional programming. There is nothing wrong with doing things this way and may be especially quick and efficient when doing basic web sites and applications. Document well and you will have no problem maintaining your code. One correction. What is being described is procedural or imperative programming. Functional programming is another beast entirely (closures, first-class functions, immutable variables, etc.). PHP is not a functional language by any stretch of the imagination. For functional programming, see Erlang, Haskel, ML, LISP, and to a lesser extent Javascript. That's not a knock against PHP, mind you; I'm just pointing out that functional programming is something different than what you are describing. It's a common point of confusion because in a procedural language (traditional PHP, C, etc.) you do everything with functions, so it's functional. The difference is that a function is not a base data type, which is a key component of a functional language. /semantic nitpick -- Larry Garfield AIM: LOLG42 [EMAIL PROTECTED] ICQ: 6817012 If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it. -- Thomas Jefferson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php