Re: [PHP] the Y2K38 BUG
On Wed, May 7, 2008 at 12:48 AM, Kalle Sommer Nielsen <[EMAIL PROTECTED]> wrote: > Quoting "Jon L." <[EMAIL PROTECTED]>: > > Another possibility... >> Port the Date object implementation from ECMA/Javascript. >> It has a range of +/-8.64e15, or Tue, 20 Apr -271821 00:00:00 GMT to Sat, >> 13 >> Sep 275760 00:00:00 GMT. >> >> You know...just to have a little extra time to find something else. ;) >> >> - Jon L. >> > > That would be a quite interesting move, try propose it to Derick ;) looks like mine only goes to dec. 31, =/ php > echo date_create('-12-31')->format('M-d-Y'); Dec-31- php > echo date_create('1-1-01')->format('M-d-Y'); Jan-01-2000 -nathan
[PHP] Re: Handling Incoming Email Attachments
Hello, on 05/06/2008 06:36 AM Nirmal Jayasinghe said the following: > hello all, > > I'm trying to figure out a way to manipulate incoming email attachments with > PHP. There'll be a special email address to which the emails with the > attachments would be sent, with a number specified in the subject line. What > I need to do is to grab the attachment (a photo), rename it with the number > specified in the subject line, and move it onto a specific folder on the Web > server [which will be running LAMP]. > > I couldn't find any online material describing how to manipulate incoming > mail attachments. Can someone give an idea? You may want to try this MIME parser class. It can parse the e-mail messages of any size and optionally save the attachments to files in a directory of your choice. http://www.phpclasses.org/mimeparser If want to parse messages retrieved from a POP3 mailbox, you may also want to use in conjunction this POP3 class which comes with a stream wrapper that lets you access messages in the POP3 mailbox as if they were files. You can use file names like this: pop3://pop.server.com/1 . http://www.phpclasses.org/pop3class When used in conjunction, these two classes allow you to extract attachements from messages of any size without exceeding your PHP memory limits. -- Regards, Manuel Lemos PHP professionals looking for PHP jobs http://www.phpclasses.org/professionals/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] the Y2K38 BUG
On Tue, May 6, 2008 at 11:56 PM, Paul Scott <[EMAIL PROTECTED]> wrote: > > On Tue, 2008-05-06 at 23:50 -0600, Nathan Nobbe wrote: > > true-that ;) > > anyway, the DateTime class is implemented as a 64-bit unsigned (i think) > > value. so if you use it you should be good to go. > > > > php > echo date_create('2040-10-24')->format('M-d-Y'); > > Oct-24-2040 > > > > a 64bit unsigned int is best, but that would only work properly on 64bit > arch. For 32bit users, making it unsigned is the best option for now, > and I suppose that by 2038 there will be another option. i put "i think" only because im not 100% on the implementation, though i know it has something to do w/ 64-bits; and it does seem to support a massive range of dates on a 32-bit system. and also, there is good reason to use it, if for example you have dates that are prior to dec 13, 1901. the standard date() stuff chokes on anything earlier than that. and even now, i have dealt with applications doing date arithmetic that spilled over 2038, breaking existing logic. php > echo `uname -p` . PHP_EOL; AMD Athlon(tm) XP 1500+ php > echo date('M-d-Y', -50); Dec-13-1901 php > echo date_create('@-50')->format('M-d-Y'); Dec-14-1793 > As far as I am concerned, this discussion is a discussion for the sake > of discussion. If I am still using the same apps that I use today in > 2038, I will officially rethink my usefulness as a human being :) as far as im concerned ive committed to using DateTime ever since i learned of its superior internal implementation. that way i dont have to deal with silly bounds related limitations in my date time calcs, ever (practically speaking) :D except of course those introduced by umm, human error ;) -nathan
Re: [PHP] the Y2K38 BUG
Quoting "Jon L." <[EMAIL PROTECTED]>: Another possibility... Port the Date object implementation from ECMA/Javascript. It has a range of +/-8.64e15, or Tue, 20 Apr -271821 00:00:00 GMT to Sat, 13 Sep 275760 00:00:00 GMT. You know...just to have a little extra time to find something else. ;) - Jon L. That would be a quite interesting move, try propose it to Derick ;) On Wed, May 7, 2008 at 12:56 AM, Paul Scott <[EMAIL PROTECTED]> wrote: On Tue, 2008-05-06 at 23:50 -0600, Nathan Nobbe wrote: > true-that ;) > anyway, the DateTime class is implemented as a 64-bit unsigned (i think) > value. so if you use it you should be good to go. > > php > echo date_create('2040-10-24')->format('M-d-Y'); > Oct-24-2040 > a 64bit unsigned int is best, but that would only work properly on 64bit arch. For 32bit users, making it unsigned is the best option for now, and I suppose that by 2038 there will be another option. As far as I am concerned, this discussion is a discussion for the sake of discussion. If I am still using the same apps that I use today in 2038, I will officially rethink my usefulness as a human being :) --Paul All Email originating from UWC is covered by disclaimer http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Kalle Sommer Nielsen Danmarks Radio - www.dr.dk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] the Y2K38 BUG
Another possibility... Port the Date object implementation from ECMA/Javascript. It has a range of +/-8.64e15, or Tue, 20 Apr -271821 00:00:00 GMT to Sat, 13 Sep 275760 00:00:00 GMT. You know...just to have a little extra time to find something else. ;) - Jon L. On Wed, May 7, 2008 at 12:56 AM, Paul Scott <[EMAIL PROTECTED]> wrote: > > On Tue, 2008-05-06 at 23:50 -0600, Nathan Nobbe wrote: > > true-that ;) > > anyway, the DateTime class is implemented as a 64-bit unsigned (i think) > > value. so if you use it you should be good to go. > > > > php > echo date_create('2040-10-24')->format('M-d-Y'); > > Oct-24-2040 > > > > a 64bit unsigned int is best, but that would only work properly on 64bit > arch. For 32bit users, making it unsigned is the best option for now, > and I suppose that by 2038 there will be another option. > > As far as I am concerned, this discussion is a discussion for the sake > of discussion. If I am still using the same apps that I use today in > 2038, I will officially rethink my usefulness as a human being :) > > --Paul > > > All Email originating from UWC is covered by disclaimer > http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >
Re: [PHP] the Y2K38 BUG
On Tue, 2008-05-06 at 23:50 -0600, Nathan Nobbe wrote: > true-that ;) > anyway, the DateTime class is implemented as a 64-bit unsigned (i think) > value. so if you use it you should be good to go. > > php > echo date_create('2040-10-24')->format('M-d-Y'); > Oct-24-2040 > a 64bit unsigned int is best, but that would only work properly on 64bit arch. For 32bit users, making it unsigned is the best option for now, and I suppose that by 2038 there will be another option. As far as I am concerned, this discussion is a discussion for the sake of discussion. If I am still using the same apps that I use today in 2038, I will officially rethink my usefulness as a human being :) --Paul All Email originating from UWC is covered by disclaimer http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] the Y2K38 BUG
Seriously If your apps are still being used in 2038 ... WOW! This is an issue that will more then likely be well resolved LONG before 2038... On 5/6/08 10:50 PM, "Nathan Nobbe" <[EMAIL PROTECTED]> wrote: > On Tue, May 6, 2008 at 10:57 PM, Paul Scott <[EMAIL PROTECTED]> wrote: > >> >> On Wed, 2008-05-07 at 10:03 +0530, Chetan Rane wrote: >>> Have guys heard of the the Y2K38 Bug more details are on this link >>> >> >> Nope, but I can guess what its about. >> >>> Can there be a possible solution. As the system which I am developing >>> for my client uses Unix timestamp. >>> >> >> There are probably multiple solutions. AFAIK time is a 32 bit signed >> int, making it unsigned would add like 100 years onto your app. >> >>> This might effect my application in the future >>> >> >> If your app survives that long! Why not just maintain it and when times >> change, your app changes? :) >> >> Seriously, this is really not a big deal! > > > true-that ;) > anyway, the DateTime class is implemented as a 64-bit unsigned (i think) > value. so if you use it you should be good to go. > > php > echo date_create('2040-10-24')->format('M-d-Y'); > Oct-24-2040 > > -nathan -- Stephen Johnson The Lone Coder http://www.ouradoptionblog.com *Join us on our adoption journey* [EMAIL PROTECTED] http://www.thelonecoder.com *Continuing the struggle against bad code* -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] the Y2K38 BUG
On Tue, May 6, 2008 at 10:57 PM, Paul Scott <[EMAIL PROTECTED]> wrote: > > On Wed, 2008-05-07 at 10:03 +0530, Chetan Rane wrote: > > Have guys heard of the the Y2K38 Bug more details are on this link > > > > Nope, but I can guess what its about. > > > Can there be a possible solution. As the system which I am developing > > for my client uses Unix timestamp. > > > > There are probably multiple solutions. AFAIK time is a 32 bit signed > int, making it unsigned would add like 100 years onto your app. > > > This might effect my application in the future > > > > If your app survives that long! Why not just maintain it and when times > change, your app changes? :) > > Seriously, this is really not a big deal! true-that ;) anyway, the DateTime class is implemented as a 64-bit unsigned (i think) value. so if you use it you should be good to go. php > echo date_create('2040-10-24')->format('M-d-Y'); Oct-24-2040 -nathan
Re: [PHP] the Y2K38 BUG
On Wed, 2008-05-07 at 10:03 +0530, Chetan Rane wrote: > Have guys heard of the the Y2K38 Bug more details are on this link > Nope, but I can guess what its about. > Can there be a possible solution. As the system which I am developing > for my client uses Unix timestamp. > There are probably multiple solutions. AFAIK time is a 32 bit signed int, making it unsigned would add like 100 years onto your app. > This might effect my application in the future > If your app survives that long! Why not just maintain it and when times change, your app changes? :) Seriously, this is really not a big deal! > > > Thank you, in Advance. It's a pleasure my paranoid son... --Paul All Email originating from UWC is covered by disclaimer http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] the Y2K38 BUG
Hi all Have guys heard of the the Y2K38 Bug more details are on this link http://www.codeproject.com/KB/bugs/The-Year-2038-Bug.aspx Can there be a possible solution. As the system which I am developing for my client uses Unix timestamp. This might effect my application in the future Thank you, in Advance. With Regards Chetan Dattaram Rane Software Engineer <>
Re: [PHP] PHP Web Apps & OpenID
Joe Harman wrote: > Hey Ya'll! > > I am curious here if any of you are considering or already using > OpenID or Windows CardSpace? Does anyone see this being a big deal??? > from a users stand point it seems like a big hassle to get started > with it and I'm not sure if it would scare people away or not? any > thoughts > > I've been looking at some PHP scripts out there for OpenID... does > anyone have one to recommend??? I have not used this (yet) but the zend framework has support for it: http://framework.zend.com/manual/en/zend.openid.html You don't have to use the whole framework to use this bit, it's designed to allow you to only use the parts you need. -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Incorrect version shown in phpinfo() and phpversion() in 5.2.6
On Tue, May 06, 2008 at 02:00:33PM -0400, Scott Lerman wrote: > Yup, I restarted Apache several times. The httpd.conf line I have is > LoadModule php5_module "C:/Program > Files/PHP/php-5.2.6-Win32/php5apache2.dll". If nobody else has seen > this problem, I'll just assume it's some oddity on my system. I just > figured I'd mention it in case others were having the same problem. It's better to use a path without whitespaces, eg. c:\php instead of c:\program files\php. Have you copied some php5X.dlls from prior installations of php to windows's system folder? Greetings guenti -- -BEGIN GEEK CODE BLOCK- Version: 3.12 GCS/CM d- s++: a+ C>$ UBL*$ P++ L+++ E--- W+++ N+ o-- K- w O- M- V-- PS++ PE++ Y PGP+++ t--- 5 X R++ tv- b+++ DI D G++ e* h r+++ y --END GEEK CODE BLOCK-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Re[PHP] gex to catch s
$tag_regex=array( '/\(.*?)\<\/p\> /si' => "$1", '/\<(\s*)(*.?)class\=(*.?)\>(.*?)\<\/(*.?)\>/si' => "$3" ); $paragraphs=preg_replace(array_keys($tag_regex),array_values($tag_regex),$page); I am not sure what tag is that you mean on , but in this RE .. it should capture any tags (the first element of the array) and any tags (the second element of the array) that has attribute class on it. You can find another example of this kind of HTML parsing in the PHP... try googling it..:) HTH Ryan S-4 wrote: > > > > >> To say I suck at regex is an understatement so really need any help I >> can get on this, I have a page of text with different html tags in them, >> but each "block" of text has a or a < class="something"> tag... >> anybody have any regex that will catch each of these paragraphs and put >> then into an array > > > If you're using php5 you can use DOM's getElementsByTagName. > > If you still think you need to do some sort of regex it is possible > but it will be buggy at best. > > > > > Nope, need a regex... guess I have no choice, either chancy regex or > nothing... I know for a fact that the first paragraph tag wont contain a > class, and for the tags that contain a class="blah" does it matter > that i know exactly what the classname is? > > > > > > Be a better friend, newshound, and > know-it-all with Yahoo! Mobile. Try it now. > http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- View this message in context: http://www.nabble.com/Re%3A-Regex-to-catch-%3Cp%3Es-tp17075329p17089906.html 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] Regex to catch s
Ryan S wrote: To say I suck at regex is an understatement so really need any help I can get on this, I have a page of text with different html tags in them, but each "block" of text has a or a < class="something"> tag... anybody have any regex that will catch each of these paragraphs and put then into an array If you're using php5 you can use DOM's getElementsByTagName. If you still think you need to do some sort of regex it is possible but it will be buggy at best. Nope, need a regex... guess I have no choice, either chancy regex or nothing... I know for a fact that the first paragraph tag wont contain a class, and for the tags that contain a class="blah" does it matter that i know exactly what the classname is? Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ preg_match_all('|]*>(.*)|Ui', $myText, $myArray); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Incorrect version shown in phpinfo() and phpversion() in 5.2.6
Yup, I restarted Apache several times. The httpd.conf line I have is LoadModule php5_module "C:/Program Files/PHP/php-5.2.6-Win32/php5apache2.dll". If nobody else has seen this problem, I'll just assume it's some oddity on my system. I just figured I'd mention it in case others were having the same problem. On Tue, May 6, 2008 at 12:49 PM, Daniel Brown <[EMAIL PROTECTED]> wrote: > > On Tue, May 6, 2008 at 11:57 AM, Scott Lerman <[EMAIL PROTECTED]> wrote: > > Has anyone else seen incorrect information on a phpinfo() page on the > > Windows build of 5.2.6? The Apache log shows "Apache/2.0.63 (Win32) > > PHP/5.2.6 configured -- resuming normal operations", but phpinfo() and > > phpversion() still show 5.2.5. The CLI executable does show the > > correct version, though. > > Did you remember to restart Apache? I know the message you > printed above from the log would indicate such, but it never hurts to > double-check. > > Also, are you certain that it's using the correct DLL by > configuration in both httpd.conf and any .htaccess files? > > -- > > Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just > $59.99/mo. with no contract! > Dedicated servers, VPS, and hosting from $2.50/mo. > -- Scott Lerman -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Where to start!
On Tue, 2008-05-06 at 13:42 -0400, tedd wrote: > At 10:14 AM -0400 5/6/08, Andrew Ballard wrote: > >On Tue, May 6, 2008 at 9:21 AM, tedd <[EMAIL PROTECTED]> wrote: > >I will respectfully (though strongly) disagree here, tedd. If you are > >building a guest book and all you need is a place to "store and > >retrieve stuff," store it in a file rather than a database. If you > >only have one form to collect and store information, this will be more > >than sufficient. > > > >If you are doing something more complex where you need to relate > >information (say, for example, forum members <-> forum topics <-> > >forum messages, or customers <-> orders <-> items, etc.) then you are > >far better off to think about what you need to store and plan your > >database first. Doing that will make your data model much better from > >the start, and you can also start planning out what your HTML pages > >need to be collecting as it relates to how the data is stored. > > > >Andrew > > Andrew: > > Well, you can certainly disagree -- we all do things differently. > What works for me, doesn't work for you and vise versa -- but that's > the way of things. > > I understand relational dB's and how to use them, but I don't think > the OP was talking about that, but rather getting something much more > simple up and running. > > Rob, who I respect greatly, said that 90 percent of what you are > doing should be decided before you start programming. But, I never > work that way either. > > I always jump right in and use the computer to design stuff. I never > resort to making a story-book layout or poster board work-up or > anything like that. I just don't work that way. I don't do much of that either unless I want to sort some complex things out that aren't easy to visualize in my head. When I say 90% of your DB should be designed before you start writing code... well, I usually thinking about the create statements (I guess some people might call those code), not drawing charts :) Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Where to start!
At 10:14 AM -0400 5/6/08, Andrew Ballard wrote: On Tue, May 6, 2008 at 9:21 AM, tedd <[EMAIL PROTECTED]> wrote: I will respectfully (though strongly) disagree here, tedd. If you are building a guest book and all you need is a place to "store and retrieve stuff," store it in a file rather than a database. If you only have one form to collect and store information, this will be more than sufficient. If you are doing something more complex where you need to relate information (say, for example, forum members <-> forum topics <-> forum messages, or customers <-> orders <-> items, etc.) then you are far better off to think about what you need to store and plan your database first. Doing that will make your data model much better from the start, and you can also start planning out what your HTML pages need to be collecting as it relates to how the data is stored. Andrew Andrew: Well, you can certainly disagree -- we all do things differently. What works for me, doesn't work for you and vise versa -- but that's the way of things. I understand relational dB's and how to use them, but I don't think the OP was talking about that, but rather getting something much more simple up and running. Rob, who I respect greatly, said that 90 percent of what you are doing should be decided before you start programming. But, I never work that way either. I always jump right in and use the computer to design stuff. I never resort to making a story-book layout or poster board work-up or anything like that. I just don't work that way. Sure, people can criticize the way I do things if they want, but I still get things done that work and are usually under budget with respect to money and time -- so I must be doing something right. From my perspective, it's far better for a newbie to actually produce something than it is to get lost in the details and never see anything materialize. Besides, trial and error is a great way to learn. Oh, and I seldom use the file system for anything. MySQL works just fine for storing things. I'm even considering Stut's recommendation to use a dB rather than sessions -- I think there is real value there. In any event, different strokes for different folks -- happy coding. :-) 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] Incorrect version shown in phpinfo() and phpversion() in 5.2.6
On Tue, May 6, 2008 at 11:57 AM, Scott Lerman <[EMAIL PROTECTED]> wrote: > Has anyone else seen incorrect information on a phpinfo() page on the > Windows build of 5.2.6? The Apache log shows "Apache/2.0.63 (Win32) > PHP/5.2.6 configured -- resuming normal operations", but phpinfo() and > phpversion() still show 5.2.5. The CLI executable does show the > correct version, though. Did you remember to restart Apache? I know the message you printed above from the log would indicate such, but it never hurts to double-check. Also, are you certain that it's using the correct DLL by configuration in both httpd.conf and any .htaccess files? -- Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Incorrect version shown in phpinfo() and phpversion() in 5.2.6
Has anyone else seen incorrect information on a phpinfo() page on the Windows build of 5.2.6? The Apache log shows "Apache/2.0.63 (Win32) PHP/5.2.6 configured -- resuming normal operations", but phpinfo() and phpversion() still show 5.2.5. The CLI executable does show the correct version, though. -- Scott Lerman -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] GD - JPEG to PNG with transparency and color
Following files: bg.png - Clear Transparent Image 14416fed5d4f78.jpg - Normal Jpeg Image The Code: header('content-type: image/png'); $watermark = imagecreatefromjpeg('14416fed5d4f78.jpg'); $watermark_width = imagesx($watermark); $watermark_height = imagesy($watermark); $image = imagecreatetruecolor($watermark_width, $watermark_height); $image = imagecreatefrompng('bg.png'); $size = getimagesize('bg.png'); $dest_x = $size[0] - $watermark_width - 5; $dest_y = $size[1] - $watermark_height - 5; imagecopymerge($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, 100); imagepng($image); imagedestroy($image); imagedestroy($watermark); The Problem: The code above works fine in sense of syntax! bg.png acts as a transparent border for 14416fed5d4f78.jpg to keep the size of bg.png and not the size of 14416fed5d4f78.jpg so it doesn't blow up 14416fed5d4f78.jpg. However, the image comes out black/white and has lost its color! I looked all over Google and I've found nothing so far that's functional to give the new created png file the correct colors as the original 14416fed5d4f78.jpg. I figure that I'm missing some small elements to the process of creating the png... Anyone have any ideas, pointers, advice, or correct solution to make this possible? Sincerely, Travis L. Font Interactive Developer BSN 5901 Broken Sound Parkway NW 6th Floor Boca Raton, FL 33487 Main Ph.: 561-994-8335 Ext.737 Fax: 561-998-4635 Toll Free: 1-800-939-4071 Ext.737 http://www.bsnonline.net/ / http://www.endorush.com/ / http://www.tlfapparel.com/ The 27th Fastest Growing Private Company In America* The 2nd Fastest Growing Private Company In The Miami-Fort Lauderdale Metro Region* The 4th Fastest Growing Private Company In The Health Industry* [*Above Rankings Were Determined By Inc. 500/5,000] This e-mail, and any attachment, is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, re-transmission, copying, dissemination or other use of this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. The contents of this message may contain personal views which are not the views of BSN.
Re: [PHP] adding the results of mysql_query
On 6 May 2008, at 15:05, It Maq wrote: I need to add the result of 4 calls to mysql_query (4 different queries) to the same object so that i can mysql_fetch_object in the same loop. Is that possible? otherwise is there any other alternative? No, but you should be able to do it in one query... http://dev.mysql.com/doc/refman/5.0/en/union.html -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Web Apps & OpenID
Hey Ya'll! I am curious here if any of you are considering or already using OpenID or Windows CardSpace? Does anyone see this being a big deal??? from a users stand point it seems like a big hassle to get started with it and I'm not sure if it would scare people away or not? any thoughts I've been looking at some PHP scripts out there for OpenID... does anyone have one to recommend??? -- Joe Harman -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RES: [PHP] strange behavior, when converting float to int
There is a logical explanation. "[...] you need to be aware that the float data type is not always capable of representing numbers in the way you expect it to." And then follows a example: "Consider, for example this simple statement: echo (int) ((0.1 + 0.7) * 10); You would expect that the expression ((0.1 + 0.7) * 10) would evaluate to 8 (and, in fact, if you print it out without the integer conversion, it does). However the statement above outputs 7 instead. This happens because the result of this simple arithmetic expression is stored internally as 7.99 instead of 8; when the value is converted to int, PHP simply truncates away the fractional part, resulting in a rather significant error (12.5%, to be exact)." [manually typed] Zend PHP5 Certification Guide 2nd Edition, Chapter 1 - PHP Basics, page 9-10. SHAFIK, D., RAMSEY, B. Ed. php|architect nanobooks Not sure if this is what happening with you as I did not try to reproduce your error, but looks like it. This book is good, a lot of gotchas. You should get it :) Regards, Thiago Henrique Pojda Desenvolvimento Web +55 41 3033-7676 [EMAIL PROTECTED] ExcelĂȘncia em Softwares Financeiros -Mensagem original- De: Philip Thompson [mailto:[EMAIL PROTECTED] Enviada em: terça-feira, 6 de maio de 2008 11:34 Para: PHP-General List Assunto: Re: [PHP] strange behavior, when converting float to int On May 6, 2008, at 1:38 AM, Maxim Antonov wrote: > Hi, all! > > Is this a bug? > > [EMAIL PROTECTED]:~$ /usr/bin/php 1.php > 45 > 45 > float(46) > > > [EMAIL PROTECTED]:~$ /usr/bin/php -v > PHP 5.3.0-dev (cli) (built: Apr 4 2008 11:37:33) > Copyright (c) 1997-2008 The PHP Group > Zend Engine v2.3.0, Copyright (c) 1998-2008 Zend Technologies > > > [EMAIL PROTECTED]:~$ cat 1.php > $i = 10.35 + 20.76 + 5.80 + 5.80 + 3.29; > echo (int)$i; > echo "\n"; > echo intval($i); > echo "\n"; > var_dump($i); > > [EMAIL PROTECTED]:~$ I got the same results. I'm not exactly sure what's happening, but I'd be curious to see if there's anyone else who can shed some light. PHP Version 5.2.4. ~Philip -- 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
Re: [PHP] strange behavior, when converting float to int
On Tue, 2008-05-06 at 09:34 -0500, Philip Thompson wrote: > I got the same results. I'm not exactly sure what's happening, but > I'd > be curious to see if there's anyone else who can shed some light. > > PHP Version 5.2.4. Is this not coming from the underlying C libs that directly use the FP on the CPU? I would say that the compile flags, CPU settings etc would probably have an impact on accuracy. --Paul All Email originating from UWC is covered by disclaimer http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] strange behavior, when converting float to int
On May 6, 2008, at 1:38 AM, Maxim Antonov wrote: Hi, all! Is this a bug? [EMAIL PROTECTED]:~$ /usr/bin/php 1.php 45 45 float(46) [EMAIL PROTECTED]:~$ /usr/bin/php -v PHP 5.3.0-dev (cli) (built: Apr 4 2008 11:37:33) Copyright (c) 1997-2008 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2008 Zend Technologies [EMAIL PROTECTED]:~$ cat 1.php I got the same results. I'm not exactly sure what's happening, but I'd be curious to see if there's anyone else who can shed some light. PHP Version 5.2.4. ~Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Where to start!
On Tue, May 6, 2008 at 9:21 AM, tedd <[EMAIL PROTECTED]> wrote: > At 1:15 AM -0600 5/5/08, Jorge wrote: > > > First I would like to say that I have had PHP experience but not enough to > say I am a PHP developer. > > > > I want to use PHP to build a site that uses MySQL, I am building it from > scratch so I don't know where to start, should I start with PHP and design a > database around my code, or should I designs the db and design the site are > the db. > > > > is it just a matter of preference or is there a recommended way to do > this? > > > > > Contrary to all popular belief and religion -- start with an html page that > gathers the information you need/want. > > After you decide what you want to gather, then design a flat database to > store that information. A database is nothing more than a place to store and > retrieve stuff. > > Don't worry about the higher orders of database design just yet, get it to > work and understand what you are doing. > > If you want to better your design, then pick up a couple books on MySQL and > learn what people are arguing about. However, realize that you can get > something working quite well without being a database expert. > > It's easy to get it to work -- but, to get it to work well, takes a bit > more effort. > > Cheers, > > tedd I will respectfully (though strongly) disagree here, tedd. If you are building a guest book and all you need is a place to "store and retrieve stuff," store it in a file rather than a database. If you only have one form to collect and store information, this will be more than sufficient. If you are doing something more complex where you need to relate information (say, for example, forum members <-> forum topics <-> forum messages, or customers <-> orders <-> items, etc.) then you are far better off to think about what you need to store and plan your database first. Doing that will make your data model much better from the start, and you can also start planning out what your HTML pages need to be collecting as it relates to how the data is stored. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: adding the results of mysql_query
It Maq wrote: Hi, I need to add the result of 4 calls to mysql_query (4 different queries) to the same object so that i can mysql_fetch_object in the same loop. Is that possible? otherwise is there any other alternative? Thank you Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ use a UNION (look it up in the mysql manual) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] adding the results of mysql_query
Hi, I need to add the result of 4 calls to mysql_query (4 different queries) to the same object so that i can mysql_fetch_object in the same loop. Is that possible? otherwise is there any other alternative? Thank you Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Web page excerpt editor
-Original Message- From: tedd [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 06, 2008 3:02 PM To: php-general@lists.php.net Subject: Re: [PHP] Web page excerpt editor At 8:49 AM -0400 5/6/08, Jason Pruim wrote: >On May 6, 2008, at 8:41 AM, tedd wrote: >>My only quandary was -- do I allow them to input html or not. > >I misunderstood what you were going for... But this does give me >another idea... Why not give them very simple things like >[bold][/bold] and then you can control it all from css and they >don't need to understand much about HTML? > >In fact, if you are using variables in your css, you could set it so >that they could set what color they want [bold] to be. > >IE: .bold {font-weight: bold; color: $boldColor;} > >Or how ever you would have to define it so that it displayed >correctly.. :) Anyway, just the ideas of a dutch novice take them as >such :) You're making an honest effort to answer the question I posed, so it's not that novice. I've been using variable in css for years, see here: http://sperling.com/examples/pcss/ But it's a different problem when trying to guide a layman from what he imagines in his head to what can be done on the web (hey, that rhymes). :-) 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 Tedd, That is great information for a noob like me! Your page has just been printed and bookmarked :o) I have been thinking (not google-ing) about how to do that (CSS with variables) for some time now, without ever trying. Thanks mate !! Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Where to start!
At 1:15 AM -0600 5/5/08, Jorge wrote: First I would like to say that I have had PHP experience but not enough to say I am a PHP developer. I want to use PHP to build a site that uses MySQL, I am building it from scratch so I don't know where to start, should I start with PHP and design a database around my code, or should I designs the db and design the site are the db. is it just a matter of preference or is there a recommended way to do this? Contrary to all popular belief and religion -- start with an html page that gathers the information you need/want. After you decide what you want to gather, then design a flat database to store that information. A database is nothing more than a place to store and retrieve stuff. Don't worry about the higher orders of database design just yet, get it to work and understand what you are doing. If you want to better your design, then pick up a couple books on MySQL and learn what people are arguing about. However, realize that you can get something working quite well without being a database expert. It's easy to get it to work -- but, to get it to work well, takes a bit more effort. 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] Web page excerpt editor
At 8:49 AM -0400 5/6/08, Jason Pruim wrote: On May 6, 2008, at 8:41 AM, tedd wrote: My only quandary was -- do I allow them to input html or not. I misunderstood what you were going for... But this does give me another idea... Why not give them very simple things like [bold][/bold] and then you can control it all from css and they don't need to understand much about HTML? In fact, if you are using variables in your css, you could set it so that they could set what color they want [bold] to be. IE: .bold {font-weight: bold; color: $boldColor;} Or how ever you would have to define it so that it displayed correctly.. :) Anyway, just the ideas of a dutch novice take them as such :) You're making an honest effort to answer the question I posed, so it's not that novice. I've been using variable in css for years, see here: http://sperling.com/examples/pcss/ But it's a different problem when trying to guide a layman from what he imagines in his head to what can be done on the web (hey, that rhymes). :-) 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] Web page excerpt editor
At 11:19 AM -0400 5/5/08, Eric Butera wrote: On Mon, May 5, 2008 at 9:43 AM, tedd <[EMAIL PROTECTED]> wrote: FCKEditor and TinyMCE are impressive in what they do, but they produce a mix of css and html -- that's not good in my book. This is an interesting idea. Most clients don't want to see a text area to input raw html though. In the many years I've done this only 3 people have ever requested it specifically out of hundreds. You might want to look into shoving generated markup through ext/tidy. It might have some options to clean up all that embedded css. Maybe I'll have to look into it later when I have some free time. I'm tired of seeing those mso styles from Word. ;) You make a good point -- and I agree with the Word problem. I have clients who cut/paste from Word and then wonder why it don't look right in their web site? I have one client who likes using tags but doesn't know much about html -- plus, he's sloppy (lot's of errors). So, I'm not sure how I am going to handle that. Currently, my CMS for him is completely devoid of him entering any html, but that also means I have to program in options for linefeeds, bold/italic text, font size, and other such things. It's difficult to pin down all the different combinations of those things. 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] Web page excerpt editor
On May 6, 2008, at 8:41 AM, tedd wrote: At 9:52 AM -0400 5/5/08, Jason Pruim wrote: On May 5, 2008, at 9:43 AM, tedd wrote: Hey tedd, Just as an idea, would it be alot of work to do a "basic" editor, and then have an "advanced" button? That way, for the people who don't know as much they can just stay in the basic part that lets them pretty much type in the info and the editor changes it into HTML and advanced basically gives them a blank slate to work with? Just a thought.. My idea was to have various web templates set up for the clients to chose from (my example was one) and then they could edit the text and images as they wanted. My only quandary was -- do I allow them to input html or not. I misunderstood what you were going for... But this does give me another idea... Why not give them very simple things like [bold][/ bold] and then you can control it all from css and they don't need to understand much about HTML? In fact, if you are using variables in your css, you could set it so that they could set what color they want [bold] to be. IE: .bold {font-weight: bold; color: $boldColor;} Or how ever you would have to define it so that it displayed correctly.. :) Anyway, just the ideas of a dutch novice take them as such :) -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424-9337 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Web page excerpt editor
At 9:52 AM -0400 5/5/08, Jason Pruim wrote: On May 5, 2008, at 9:43 AM, tedd wrote: I've been trying to come up with an alternative -- here's my twist: http://www.webbytedd.com/a/easy-page-db Please note the [Edit Mode] link on the top right of the page. I'm not willing to share the code at this point because I haven't worked out all the bugs, but I'm sure the demo expresses my idea. My quandary is how much freedom do I give the client in allowing them to use html tags? The client is not going to deliberately try to mess up their own site, but not having well formed html can create problems. I am open to comments and suggestions. Hey tedd, Just as an idea, would it be alot of work to do a "basic" editor, and then have an "advanced" button? That way, for the people who don't know as much they can just stay in the basic part that lets them pretty much type in the info and the editor changes it into HTML and advanced basically gives them a blank slate to work with? Just a thought.. My idea was to have various web templates set up for the clients to chose from (my example was one) and then they could edit the text and images as they wanted. My only quandary was -- do I allow them to input html or not. 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] Handling Incoming Email Attachments
For handling e-mail in all their sorts (believe me, it is hell), I found the PECL mailparse the best solution. It can find the attachments and their MIME-types in a snap. And all the headers are separated too. You only have to wrap functions around it to do what you want to do. Be sure to validate the attachments and do not rely on the MIME-type only. People can spoof that kind of files. There's also the PEAR mimeDecode class as well. A PHP solution so it won't require you to reconfigure/compile anything. -- Richard Heyes ++ | Access SSH with a Windows mapped drive | |http://www.phpguru.org/sftpdrive| ++ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] getting iostat -x %b with php
What is the best way to extract just the drive load information (%b column) from "iostat -x" (on FreeBSD)? I imagine to exec() the "iostat -x" and then process the result with regex, but I am not sure if this is the best way - for instance, is %b is aways the Nth column in the returned value? Iv -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Handling Incoming Email Attachments
Nirmal Jayasinghe wrote: hello all, I'm trying to figure out a way to manipulate incoming email attachments with PHP. There'll be a special email address to which the emails with the attachments would be sent, with a number specified in the subject line. What I need to do is to grab the attachment (a photo), rename it with the number specified in the subject line, and move it onto a specific folder on the Web server [which will be running LAMP]. I couldn't find any online material describing how to manipulate incoming mail attachments. Can someone give an idea? Hi, For handling e-mail in all their sorts (believe me, it is hell), I found the PECL mailparse the best solution. It can find the attachments and their MIME-types in a snap. And all the headers are separated too. You only have to wrap functions around it to do what you want to do. Be sure to validate the attachments and do not rely on the MIME-type only. People can spoof that kind of files. -- Aschwin Wesselius /'What you would like to be done to you, do that to the other'/
[PHP] Handling Incoming Email Attachments
hello all, I'm trying to figure out a way to manipulate incoming email attachments with PHP. There'll be a special email address to which the emails with the attachments would be sent, with a number specified in the subject line. What I need to do is to grab the attachment (a photo), rename it with the number specified in the subject line, and move it onto a specific folder on the Web server [which will be running LAMP]. I couldn't find any online material describing how to manipulate incoming mail attachments. Can someone give an idea? Thanks, Chuck Finster
Re: [PHP] Regex to catch s
Aschwin Wesselius wrote: Aschwin Wesselius wrote: Ryan S wrote: Hey all! To say I suck at regex is an understatement so really need any help I can get on this, I have a page of text with different html tags in them, but each "block" of text has a or a < class="something"> tag... anybody have any regex that will catch each of these paragraphs and put then into an array example: array[0]=" first block "; array[1]=" block X"; Thanks! R Hi, Maybe the example is overkill, but I give you a quick setup that can save you some time finding HTML tags with a certain attribute. Hi, I'm sorry. I didn't read your request properly. Below you'll have a correct solution: Hi, It is obvious I haven't had my caffeine yet. This is my last try to get the pattern straight: hello hello those hello hello this rose hello nose hello that hello END_OF_HTML; $tags = array(); $tags[] = 'p'; $tags[] = 'a'; $attr = array(); $attr[] = 'class'; $attr[] = 'href'; $vals = array(); $vals[] = 'blah'; $vals[] = 'url'; $vals[] = 'yo'; $text = array(); $text[] = 'hello'; $text[] = 'this'; $text[] = 'that'; $tags = implode('|', $tags); $attr = implode('|', $attr); $vals = implode('|', $vals); $text = implode('|', $text); $pattern = '/<('.$tags.')[^>]*('.$attr.')?[^>]*('.$vals.')?[^>]*>('.$text.')[^<\/]*<\/\1>/i'; echo $pattern."\n"; echo "\n"; preg_match_all($pattern, $html, $matches); var_dump($matches); ?> -- Aschwin Wesselius /'What you would like to be done to you, do that to the other'/
[PHP] Difference between imagegif/imagejpeg sending to browser <-> saving to file?
Hello together, I stumbled onto a curious problem: i am generating a jpeg/gif with the imagejpeg/imagegif functions (type does not alter the result). Example color "#ff": The hexToRGB coversion etc is all working fine. The image (if its send directly to the browser via header and imagegif/imagejpeg) is displayed 100% correctly. But if i save it to a file on the servers file system, the red above gets lime green. And not only those two colors are bugged: It looks like the whole palette gets scrambled up ??? So my question: Is there a-n-y difference between sending and saving the image? Or do I have to do some additional work before an image can be saved correctly? php func reference says something about using imagecolortransparent() on the image first to achieve the 89a format (in case of gif) but again: This does not alter the result either. Also, transparency is not needed at this point but used in images that are merged (gifs) to achieve the final result. Another interesting point: - generated image sent to browser, properties: ~3kb - generated image, saved in filesys, properties: ~15kb What explains that diff in filesize? Thanks for your help, greets, zyro -- View this message in context: http://www.nabble.com/Difference-between-imagegif-imagejpeg-sending-to-browser-%3C-%3E-saving-to-file--tp17078670p17078670.html 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] Regex to catch s
Aschwin Wesselius wrote: Ryan S wrote: Hey all! To say I suck at regex is an understatement so really need any help I can get on this, I have a page of text with different html tags in them, but each "block" of text has a or a < class="something"> tag... anybody have any regex that will catch each of these paragraphs and put then into an array example: array[0]=" first block "; array[1]=" block X"; Thanks! R Hi, Maybe the example is overkill, but I give you a quick setup that can save you some time finding HTML tags with a certain attribute. Hi, I'm sorry. I didn't read your request properly. Below you'll have a correct solution: hello hello hello hello hello this hello hello hello hello that hello END_OF_HTML; $tags = array(); $tags[] = 'p'; $tags[] = 'a'; $attr = array(); $attr[] = 'class'; $attr[] = 'href'; $vals = array(); $vals[] = 'blah'; $vals[] = 'url'; $vals[] = 'yo'; $text = array(); $text[] = 'hello'; $text[] = 'this'; $text[] = 'that'; $tags = implode('|', $tags); $attr = implode('|', $attr); $vals = implode('|', $vals); $text = implode('|', $text); $pattern = '/<('.$tags.')[^>]*('.$attr.')[^>]*('.$vals.')[^>]*>('.$text.')[^<\/]*<\/\1>/i'; echo $pattern."\n"; echo "\n"; preg_match_all($pattern, $html, $matches); var_dump($matches); ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex to catch s
Ryan S wrote: Hey all! To say I suck at regex is an understatement so really need any help I can get on this, I have a page of text with different html tags in them, but each "block" of text has a or a < class="something"> tag... anybody have any regex that will catch each of these paragraphs and put then into an array example: array[0]=" first block "; array[1]=" block X"; Thanks! R Hi, Maybe the example is overkill, but I give you a quick setup that can save you some time finding HTML tags with a certain attribute. hello hello hello hello hello hello END_OF_HTML; $tags = array(); $tags[] = 'p'; $tags[] = 'a'; $tags = implode('|', $tags); $pattern = '/<('.$tags.')[^>]*>/i'; echo $pattern."\n"; preg_match_all($pattern, $html, $matches); var_dump($matches); ?> I'm not an expression guru either, but I think it works OK. I had to find 'link', 'img', 'a' and other tags in HTML and used a more complex expression for it which worked like a charm. It's just an example. For you, you have to leave away the 'a' tag in the $tags array, to get what you want. Hope it helps! -- Aschwin Wesselius /'What you would like to be done to you, do that to the other'/