[PHP] Re: debugging remote PHP code in eclipse
I haven't tested yet but I've found yesterday some good tips that maybe could work. 1) Xdebug wizard. Simple paste there the output of phpinfo() and follow the steps. http://xdebug.org/wizard.php If you find problems with phpize, remember to run it inside the inner xdebug folder. 2) Go to your /etc/php5/apache2/php.ini and add the zend_extension for xdebug and its configuration. This is the post I've been following: http://www.cleancode.co.nz/blog/724/remote-php-debugging-eclipse-php-xdebug It's possible (I don't know it for sure) that you may have to activate in Eclipse one specific option about Jit: http://bogdan-albei.blogspot.com.es/2010/06/php-remote-debugging-with-xdebug-and.html Hope this helps! El 12/06/13 18:01, Rafnews escribió: Hi everybody, I have big trouble to correctly configure Eclipse/Xdebug to remotely debug a PHP website. When web server is local i have no problem, it works like a charm...but in case webserver is not local, that's a real nightmare. till now everything what i found on internet was about settings for a local debugging. few are about remote debugging... and after reading them i still have trouble it's like something is missing...an important step... so i would like to know if someone could help me. If you already successfully setup eclipse/xdebug for a remote debugging, please let me know. i feel like a local copy of website root folder must exist on my client computer but is it true ? how to configure eclipse to be sure it will run code with PHP server ? so please, contact me if you already did it. thx a lot -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ZF developers in Spain
Hi people! I'm doing a personal research of Spanish freelancers and agencies that use ZF in his projects, version 2 preferably. My summer purpose is to learn the basics of the new framework and I would like to find people using it to simply interchange knowledge or job opportunities ;) Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mac 10.7 Install/Copy fresh PHP over Pre-Installed PHP
On Jul 30, 2012, at 12:01 PM, JeffPGMT jeffp...@gmail.com wrote: Thanks All, now I have to tell the business owner to let the IT guy update to 10.8 if he likes, which will buy me time to sort out all of what you folks contributed. I wasn't aware that Mamp free installed anything more than basic and Yes, setup so that Apache, MySql and PHP work well together was what I had wanted to learn using the stock install and was able to do w/exception of imap being available. Perhaps I will install XCode as it's the law of worst case probably will occur if I don't, that is I'll need it in a pinch later on. JeffPGMT... Hey Jeff, Unless its changed in mt lion, you will need to install Xcode to use make or any other program assembler... O -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mac 10.7 Install/Copy fresh PHP over Pre-Installed PHP
Look for software called mamp. It's independent installs of apache, MySQL, php, all for the mac.. They might have it enabled with what you need... I can tell you though if you can handle writing php code.. Installing with the developer tools is a piece of cake :) its not as hard as it sounds.. Lots of examples on the net for what need to be put into the command line. Jason Pruim On Jul 27, 2012, at 3:56 PM, JeffPGMT jeffp...@gmail.com wrote: Please correct me if I'm wrong and IMAP is available (maybe a known config issue?) Mac OSX 10.7, Using the pre-installed Apache Php, IMAP is not installed, pulled out my Apple for this server OS. $ php -v PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20090626/php_imap.dll' - dlopen(/usr/lib/php/extensions/no-debug-non-zts-20090626/php_imap.dll, 9): image not found in Unknown on line 0 PHP 5.3.10 with Suhosin-Patch (cli) (built: Feb 20 2012 22:55:53) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies Because Mac choose to not include make or IMAP (c-client 2007e or f) support in the pre-installed PHP... Can I install PHP into another folder and then copy it over the pre-installed location/folder? As I understand it Make requires the developer tools which I'm reluctant to install as I'm not IT and this is not a dev box. So, where can I find a version of PHP that does not require make which is not included in 10.7 nor to my knowledge 10.8? -- 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] What's happened to our newsgroup?
On Jun 26, 2012, at 4:15 PM, Jen Rasmussen j...@cetaceasound.com wrote: LOL -Original Message- From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] Sent: Tuesday, June 26, 2012 3:13 PM To: Marc Guay Cc: php-general@lists.php.net Subject: Re: [PHP] What's happened to our newsgroup? On Tue, 2012-06-26 at 15:42 -0400, Marc Guay wrote: Everyone switched to PCP? I wonder if the thing that happened to your newsgroup has also happened to this mailing list? :p We can't talk like this! It's not even Friday yet!!! ;) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Happy Diamond Jubilee everyone!
And this is when I realize that I still have so much to learn Looks amazing ash! Jason Pruim 352.234.3175 Google Voice 352.682.1073 Cell On Jun 1, 2012, at 1:44 PM, Ashley Sheridan a...@ashleysheridan.co.uk wrote: This is a bit of a shameless plug, but it is a Friday and a pretty special weekend over here. I recently got to work on something a bit fun at work in my spare time and they liked it so much that it got used internally to celebrate the jubilee weekend. This is the result http://jubilee.themlondon.com For those of you interested, the leg-work is done by a bunch of PHP scripts run in the background via cron, split into 3 tasks: 1. A script goes out and searches Twitter for tweets that mention the jubilee, one instance per keyword and records those to a DB to limit the draw on the Twitter API 2. A second script goes over those tweets and pulls in all the non-default profile images for each unique user 3. Lastly, the image is built as 12 separate tiles every half hour, using PHP and GD to match the average colour of each profile pic to a spot on the image, and then these are stitched together for the final image Anyway, hope you guys all have a great weekend, more so if you're unlucky enough to be working over the whole 4 days :-/ -- Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] openssl_sign() openssl_verify() discrepancy
On 05/23/2012 01:05 PM, Matijn Woudt wrote: On Wed, May 23, 2012 at 8:29 PM, jasjason.ger...@utah.edu wrote: I have run into a problem that I am altogether unfamiliar with. A scenario. I retrieve a users private key from a database. I then use the openssl_pkey_get_private() function to load it as a resource object and proceed to call the openssl_sign() function to obtain a digital signature of a string. No problem, I get a valid signature which I then base64 encode and store in a database. Now lets say a couple of days from now I load up the public key which corresponds to the private key which was used to originally sign the data to verify it and it does not work. The kicker is if I perform the very same routine without saving the signature and attempting to verify it it works without problems. Have you checked what $signed looks like after running the script? Compare it to $signature. Most likely you corrupted your date elsewhere, maybe when inserting it into the database. - Matijn The example that accompanies the post shows two examples, one works one does not. Neither however use any type of database, as both simply assign or use the valid signature stored within either the $signature or $signed variables. I wish I could say that is the problem, I took care to properly encode/decode when saving or retrieving the information and as well in the original post I removed this as a possible cause by simply defining the $signature variable and assigning a valid signature to it for testing. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] openssl_sign() openssl_verify() discrepancy
On 05/23/2012 01:26 PM, Matijn Woudt wrote: On Wed, May 23, 2012 at 9:12 PM, Jason Gerfenjason.ger...@utah.edu wrote: On 05/23/2012 01:05 PM, Matijn Woudt wrote: On Wed, May 23, 2012 at 8:29 PM, jasjason.ger...@utah.eduwrote: I have run into a problem that I am altogether unfamiliar with. A scenario. I retrieve a users private key from a database. I then use the openssl_pkey_get_private() function to load it as a resource object and proceed to call the openssl_sign() function to obtain a digital signature of a string. No problem, I get a valid signature which I then base64 encode and store in a database. Now lets say a couple of days from now I load up the public key which corresponds to the private key which was used to originally sign the data to verify it and it does not work. The kicker is if I perform the very same routine without saving the signature and attempting to verify it it works without problems. Have you checked what $signed looks like after running the script? Compare it to $signature. Most likely you corrupted your date elsewhere, maybe when inserting it into the database. - Matijn The example that accompanies the post shows two examples, one works one does not. Neither however use any type of database, as both simply assign or use the valid signature stored within either the $signature or $signed variables. I wish I could say that is the problem, I took care to properly encode/decode when saving or retrieving the information and as well in the original post I removed this as a possible cause by simply defining the $signature variable and assigning a valid signature to it for testing. First of all, it seems $signature is in base64 format, so I think you should base64_decode that one first. Then it appears to me that $signature is not the same as $signed, on my system. If I base64_encode $signed, save it by copying it from my browser, and then enter it as $signature, and then use base64_decode on $signature it works fine. - Matijn Those are the same steps I just mentioned. The base64_decoding is a typo on the second example. It should read openssl_verify($unsigned, base64_decode($signature), $id); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php books
On Apr 8, 2012, at 8:53 PM, Kirk Bailey kbai...@howlermonkey.net wrote: Revisiting said dead horse, it's interesting there is no clear consensus of opinion about what is the best book to use to learn php. Generally, you get several people chiming in talking about the website. Now the website is the bomb indeed, BUT IT'S NOT A BOUND BOOK! So that's a terrific answer to a totally different question. It's interesting really; it suggests there is a wide range of perspectives and mindsets about wha is the best way to come to understand php. Possibly this suggests something about the general mindset of the php community- wide ranging individualism? By our nature as programmers we all have very different ways to look at things. And if we don't like the way things are being done with the current tools we change it... We fix it That being said I've been considering a project that would take sample code and explain why it dos what it does... Make it reviewed by the big wigs here and possibly go as far as printing it... But definitely an ebook type thing. Anyone interested in helping on a project like that? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php books
On Apr 8, 2012, at 9:15 PM, Jason Pruim li...@pruimphotography.com wrote: On Apr 8, 2012, at 8:53 PM, Kirk Bailey kbai...@howlermonkey.net wrote: Revisiting said dead horse, it's interesting there is no clear consensus of opinion about what is the best book to use to learn php. Generally, you get several people chiming in talking about the website. Now the website is the bomb indeed, BUT IT'S NOT A BOUND BOOK! So that's a terrific answer to a totally different question. It's interesting really; it suggests there is a wide range of perspectives and mindsets about wha is the best way to come to understand php. Possibly this suggests something about the general mindset of the php community- wide ranging individualism? By our nature as programmers we all have very different ways to look at things. And if we don't like the way things are being done with the current tools we change it... We fix it That being said I've been considering a project that would take sample code and explain why it dos what it does... Make it reviewed by the big wigs here and possibly go as far as printing it... But definitely an ebook type thing. Anyone interested in helping on a project like that? And I just realized I hijacked your thread... I apologize! My brain has not started up from the weekend yet If there is interest I'll start a specific thread for it! :) *slaps his own wrist* -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Got HTML5 History API + caching LICKED, I think, grin
Just tried to load it up on my iPad and the load time was okay... Little slow. But your navigation is completely non functional on my iPad... Might want to look into that since mobile devices are becoming more and more common. Jason Pruim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Got HTML5 History API + caching LICKED, I think, grin
On Mar 18, 2012, at 8:34 AM, rene7705 rene7...@gmail.com wrote: On Sun, Mar 18, 2012 at 1:24 PM, Jason Pruim li...@pruimphotography.comwrote: Just tried to load it up on my iPad and the load time was okay... Little slow. But your navigation is completely non functional on my iPad... Might want to look into that since mobile devices are becoming more and more common. Jason Pruim I wish I had the money for an real iPad, so I could test it properly. What part of the navigation doesn't work? Do the links in the content work? From what I can tell its the links on the top... The ones in the Content seem to work but I didn't check all of them. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Got HTML5 History API + caching LICKED, I think, grin
On Mar 18, 2012, at 8:54 AM, rene7705 rene7...@gmail.com wrote: On Sun, Mar 18, 2012 at 1:41 PM, Jason Pruim li...@pruimphotography.comwrote: On Mar 18, 2012, at 8:34 AM, rene7705 rene7...@gmail.com wrote: On Sun, Mar 18, 2012 at 1:24 PM, Jason Pruim li...@pruimphotography.com wrote: Just tried to load it up on my iPad and the load time was okay... Little slow. But your navigation is completely non functional on my iPad... Might want to look into that since mobile devices are becoming more and more common. Jason Pruim I wish I had the money for an real iPad, so I could test it properly. What part of the navigation doesn't work? Do the links in the content work? From what I can tell its the links on the top... The ones in the Content seem to work but I didn't check all of them. It won't be easy for me to debug the menu and button components (links on the top), as I have no friends or family with an iPad i think. But i'll ask around. One piece of advice that I have been given is to make everything work at its most basic structure first... Then add the fancy stuff to make it be what you want. That way as you develop and grow with what you know you can add features but your site will work fine without The fancy stuff. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Test
Nope doesn't work, ;) On Feb 20, 2012, at 1:57 PM, Jay Blanchard jay.blanch...@sigmaphinothing.org wrote: Does this work? -- 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] Test
Someone finally got off their butt and got some work done? ;) And I have today off for Washingtons birthday! On Feb 20, 2012, at 2:59 PM, Jay Blanchard jay.blanch...@sigmaphinothing.org wrote: I'll be darned - it finally works. What's up with that? On Feb 20, 2012, at 1:49 PM, Daniel Brown wrote: On Mon, Feb 20, 2012 at 14:40, Bastien phps...@gmail.com wrote: Definitely doesn't work The list works just fine, it's you goofs who need to work now! ;-P -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Numeric help needed
Sent from my iPhone On Jan 15, 2012, at 8:25 PM, Christopher J Payne oxygene...@gmail.com wrote: Hi everyone, I am having a hard time with a numerical problem. I need to round some numbers up and I've tried $round($number) and it doesn't work so I'm misunderstanding something. For example, if a user inputs 685000 I need it to round up to 69 or if they input 149560 I need it to round up to 15. What is the correct way to do this as everything I have tried doesn't seem to affect the user inputted figure at all. Anyway help would REALLY be appreciated, I'm sure it's really simple but for the life of me I'm stumped on why it's not working. Maybe it's just a typo in your email but you put a $ infront of round() try removing that and see if it helps. If not are there any error messages that are showing up? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Virus warning
Hey Ash, I didn't get anything... I'm guessing the list did it's thing and blocked it unless someone else got it! Jason Pruim li...@pruimphotography.com On Dec 11, 2011, at 10:03 AM, Ashley Sheridan wrote: Did anyone else receive an odd message today about a message to the list bouncing back because of a virus warning? From the looks of it someone spoofed an email to the list from my address, which meant I got the warning email, but I wondered if anyone else was having the same issue? -- Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Frivolous Friday Fun!
The wife of a programmer to his husband: Quote: Darling, I'm starting to get a little worried about your work; you work too much... you spend more time with your CPU than with me... You program too much... Her husband answers, to calm her: Code: !Honey; if(you.IsThinking(this)) !Worry; CLove* myself = new CLove; //I love you darling while(world.DoExist()) { myself-m_bLoveForYou++; if(!myself-IsTrue()) { delete myself; _exit(-1); } } And on a serious note... To any Past, Present, Or Future service man (Or woman) Thank you for your sacrifice in defending our ability to send out these Frivolous Friday emails! :) Jason Pruim li...@pruimphotography.com
Re: [PHP] Exporting large data from mysql to html using php
Jason Pruim li...@pruimphotography.com On Oct 31, 2011, at 7:52 PM, Ashley Sheridan wrote: On Mon, 2011-10-31 at 19:29 -0400, Jason Pruim wrote: Jason Pruim li...@pruimphotography.com On Oct 31, 2011, at 7:11 PM, Jim Lucas wrote: On 10/24/2011 5:50 PM, Jason Pruim wrote: Now that I've managed to list 3 separate programming languages and somewhat tie it back into php here's the question... I have about 89 million records in mysql... the initial load of the page takes 2 to 3 minutes, I am using pagination, so I have LIMIT's on the SQL query's... But they just aren't going fast enough... What I would like to do, is pull the data out of MySQL and store it in the HTML files, and then update the HTML files once a day/week/month... I can figure most of it out... BUT... How do I automatically link to the individual pages? I have the site working when you pull it from MySQL... Just the load time sucks... Any suggestions on where I can pull some more info from? :) Thanks in advance! Jason Pruim li...@pruimphotography.com Jason, How large a data set are you starting with? How many records in all. Will you show us your DB schema? Hey Jim, I am working with 89 Million records right now... Going to be expanding to a much larger dataset as the site expands. Here is the main table that I am using: mysql describe main; ++-+--+-+-++ | Field | Type| Null | Key | Default | Extra | ++-+--+-+-++ | areacode | int(3) | NO | MUL | NULL|| | exchange | int(3) | NO | | NULL|| | subscriber | char(4) | NO | | NULL|| | id | int(11) | NO | PRI | NULL| auto_increment | | state | varchar(20) | YES | | NULL|| | config | text| YES | | NULL|| ++-+--+-+-++ config is just going to contain varius settings for commenting on records, and future expansion. State will actually be the state spelled out. Thanks for taking a looking! I'd put the spelling of the state in another table and just include the reference to it in this table, it will save a lot on storage and it's easy to do a join to get it. That way, it's also much faster to look up entries by state, as a numerical index is quicker that a string index. On the subject of indexes, what other ones do you have apart from the primary key there? -- Thanks, Ash http://www.ashleysheridan.co.uk Hey Ash, Sorry for the delay... Had a sick kid at home which kept me very busy and away from the computer! You think putting the spelling of the state in another table with some kind of a reference code (such as 1, 2, 3, 4, etc etc ) would be faster then searching based on some spelling of the name? I am using the state name in the URL that I'm referencing... So something like: www.example.com/new-york/212/314 would bring up the entire 10,000 records for 212-314- Trying to avoid the normal index.php?vars=blahyou=Blah type stuff... Indexes... I'm still learning about those... I created a index based on the areacode, and exchange fields... But more reading is needed to figure out just how to use it properly :) Thanks Ash!
Re: [PHP] Exporting large data from mysql to html using php
Jason Pruim li...@pruimphotography.com On Oct 31, 2011, at 7:11 PM, Jim Lucas wrote: On 10/24/2011 5:50 PM, Jason Pruim wrote: Now that I've managed to list 3 separate programming languages and somewhat tie it back into php here's the question... I have about 89 million records in mysql... the initial load of the page takes 2 to 3 minutes, I am using pagination, so I have LIMIT's on the SQL query's... But they just aren't going fast enough... What I would like to do, is pull the data out of MySQL and store it in the HTML files, and then update the HTML files once a day/week/month... I can figure most of it out... BUT... How do I automatically link to the individual pages? I have the site working when you pull it from MySQL... Just the load time sucks... Any suggestions on where I can pull some more info from? :) Thanks in advance! Jason Pruim li...@pruimphotography.com Jason, How large a data set are you starting with? How many records in all. Will you show us your DB schema? Hey Jim, I am working with 89 Million records right now... Going to be expanding to a much larger dataset as the site expands. Here is the main table that I am using: mysql describe main; ++-+--+-+-++ | Field | Type| Null | Key | Default | Extra | ++-+--+-+-++ | areacode | int(3) | NO | MUL | NULL|| | exchange | int(3) | NO | | NULL|| | subscriber | char(4) | NO | | NULL|| | id | int(11) | NO | PRI | NULL| auto_increment | | state | varchar(20) | YES | | NULL|| | config | text| YES | | NULL|| ++-+--+-+-++ config is just going to contain varius settings for commenting on records, and future expansion. State will actually be the state spelled out. Thanks for taking a looking!
Re: [PHP] Exporting large data from mysql to html using php
Jason Pruim li...@pruimphotography.com On Oct 27, 2011, at 2:44 PM, Tommy Pham wrote: On Wed, Oct 26, 2011 at 5:47 PM, Jason Pruim li...@pruimphotography.com wrote: Jason Pruim li...@pruimphotography.com The server that's running it is a home computer with a VPS installed... It's not my dev environment :) Home computer used for a production environment? Wow.. I'm speechless. Ummm... No... Home computer for a dev environment... The final product will be moved to a better host. This is temporary... And actually isn't a bad idea... If you get it running good on a cheap home computer, why wouldn't it run *BETTER* on the high-end production server? The information being searched is specifically phone numbers, and the bosses want to provide the public away to browse them, hence the pagination... Once I removed a COUNT from mysql it started working alot better... So I still need to provide a better pagination system, but it's working. If just showing phone numbers only and no other information, what's the point since there are already several other white and yellow pages on the net? There's even a reverse number look-up too. There's also a well known paid service for getting a DB of contacts (name, address, phone numbers of persons and businesses). Just out of curiosity, what is it that your boss intend to offer that would stand out for already existing services? I doubt anyone would be sane enough to sit there and just browse through phone numbers only. Even if it does show the owner's name of the registered number, I highly doubt anyone sane would browse unless you provide some kind of filter/search. I'm not expecting people to look at every single page... But I need away to allow curious people the ability to page through results if they want. Oh, and the 89 million is just for one state :) We are talking the possibility of I believe 10 billion numbers to cover the US, not to mention Canada which I believe uses the same numbering system as we do so that could be another 10 billion... As I've mentioned, something of this magnitude is better to leave it to the DBA and work together with that DBA. Either hire/contract one or become one :) I'm working on becoming one ontop of web designer and programmer :) Good luck, that's a LOT of reading. I'd estimate that's about 3k+ pages of reading. :) I've always been a fan of reading :) Just wish I had more time to do it! :)
Re: [PHP] Exporting large data from mysql to html using php
Jason Pruim li...@pruimphotography.com On Oct 27, 2011, at 4:08 PM, Nathan Nobbe wrote: On Mon, Oct 24, 2011 at 6:50 PM, Jason Pruim li...@pruimphotography.com wrote: Now that I've managed to list 3 separate programming languages and somewhat tie it back into php here's the question... I have about 89 million records in mysql... the initial load of the page takes 2 to 3 minutes, I am using pagination, so I have LIMIT's on the SQL query's... But they just aren't going fast enough... What I would like to do, is pull the data out of MySQL and store it in the HTML files, and then update the HTML files once a day/week/month... I can figure most of it out... BUT... How do I automatically link to the individual pages? I have the site working when you pull it from MySQL... Just the load time sucks... Any suggestions on where I can pull some more info from? :) Thanks in advance! dial in the db schema (think keys) and queries; then investigate a reverse proxy like varnish to cache the generated html. you'll be able to handle a couple thousand requests per second against the proxy in no time. might be worth pre-generating some of the pages if they are still really slow after db optimization. Would it make sense that COUNT()'ing 89 million records would kill the performance? Once that was gone... It worked perfectly!
Re: [PHP] Help with redeclare error
Jason Pruim li...@pruimphotography.com On Oct 27, 2011, at 7:55 PM, Jack wrote: Hello All, I have some code that just broke with a PHP upgrade, the error says: PHP Fatal error: Cannot redeclare date_diff() the line of the error is the close bracket of the function which is below. Any ideas what's going on, I'm stuck? Most likely you have in included in 2 files... Look into it from that angle... It only needs to be included in 1 file to work throughout all the files. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Exporting large data from mysql to html using php
Jason Pruim li...@pruimphotography.com On Oct 26, 2011, at 6:23 AM, Tommy Pham wrote: On Wed, Oct 26, 2011 at 1:40 AM, Lester Caine les...@lsces.co.uk wrote: Tommy Pham wrote: I wonder ... The real question is what's the purpose of the DB? Is it for OLAP or OLTP? ;) As for dealing with DB having millions of rows, you're crossing over into DBA area. Many of my customers have coming up on 20 years of data available. There has been a debate on transferring historic data to a separate database, but having it available is not causing a problem, except for some counts and larger search actions, and being able to see how long a client has been visiting is often useful. Statistical analysis is always done on a separate machine, with a replicated copy of the data, so as not to affect the active users ... What kind of counts/filters? What kind of RAID subsystem is the storage? What's the total size of the DB? Up to 20 years of data should be in the peta range. In that peta range, if you're not having performance issue and not using either RAID 0, 0+1, 10, 50, or 60, I'd love to hear about the application and database design in details. :) That said, we are now using the much more detailed LLPG address data rather than simple postcode, and that has added another order of magnitude to data that is being searched live ... -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/wiki/?page=**contacthttp://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/**index.phphttp://www.firebirdsql.org/index.php Since Jason didn't disclose sufficient information, I suggested that RAID storage based on the worst case scenario being this: as a business analyst, I'd want to do drill-downs, filters, counts of a the following for an up-coming marketing campaign: * county(ies) * city(ies) * zip code(s) * address type (business and/or residential) * of business (commercial, industrial/manufacturing, etc) * of residential ( homes - single/townhouses - or apartments/condos ) The filters and counts will any combinations of the above, ie: 5 random zip codes within the given state that lists all other criteria and break down. As Jason mention having 89million rows for a given state, how long would it take to run the drill-downs if the DB isn't sitting on a fast storage medium? That 89 million is the most likely the average count in the USA. For California and New York, the number can double that easily. That's only the basic filtering. What of a specific business industry such as landscaping? What of the filtering by yearly income and/or real estate value? BTW, as a business analyst, I don't want to wait hours for the info to update every time I change a criteria/filter to get the counts before I look into a few random individual records from the results. The server that's running it is a home computer with a VPS installed... It's not my dev environment :) The information being searched is specifically phone numbers, and the bosses want to provide the public away to browse them, hence the pagination... Once I removed a COUNT from mysql it started working alot better... So I still need to provide a better pagination system, but it's working. Oh, and the 89 million is just for one state :) We are talking the possibility of I believe 10 billion numbers to cover the US, not to mention Canada which I believe uses the same numbering system as we do so that could be another 10 billion... As I've mentioned, something of this magnitude is better to leave it to the DBA and work together with that DBA. Either hire/contract one or become one :) I'm working on becoming one ontop of web designer and programmer :) Regards, Tommy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Exporting large data from mysql to html using php
Jason Pruim li...@pruimphotography.com On Oct 26, 2011, at 9:09 PM, Jim Giner wrote: Your boss wants to give access to phone numbers to the public in general? Then what? Glad mine's unlisted. There's no identifying information on the phone numbers... Simply just the phone number... Eventually maybe some info about who owns the phone line... And a few other things. The rest is covered under an NDA until the site goes live :) but there shouldn't be any privacy related issues... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Exporting large data from mysql to html using php
Jason Pruim li...@pruimphotography.com On Oct 25, 2011, at 10:51 AM, Jim Giner wrote: I disagree. It's not about tuning the queries, it is more about the appl. design that currently thinks it SHOULD do such huge queries. My approach would be to prompt the user for filtering criteria that automatically would reduce the result set size. Although at this time I believe the OP mentioned that the db is just telephone numbers so that doesn't leave much room for filter-criteria. Yes it is just phone numbers... The only select that I'm running on the entire site is related to the pagination... A simple: $sqlCount = SELECT COUNT(*) FROM main WHERE state = '{$state}'; which limits it to everything inside the state... Unfortunately if you look at the possibilities, it's still quite a large dataset... 89 million :) The rest of the query's will be much more limited to areacode, exchange, and in some cases the full phone number... Maybe the better way to do it would be not to count the records But set a variable with the total count... That way I don't have to load all the data... The data amount won't change alot... Easy enough to set a variable... Just need to see if I can integrate that with the pagination... Back to the drawing board! :) -- 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] Exporting large data from mysql to html using php
Jason Pruim li...@pruimphotography.com On Oct 25, 2011, at 6:35 PM, Jim Giner wrote: Again why even do a detail query? Nobody is going to examine pages and pages and etc. Do a summary qry if u just need a count - no pagination there jg The bosses wanted them to be able to page through the results... But I might bring that up to them again... Working with 89 million records (With the number going up and expanding in the future) could cause lots of issues in the long run... On Oct 25, 2011, at 6:26 PM, Jason Pruim li...@pruimphotography.com wrote: Jason Pruim li...@pruimphotography.com On Oct 25, 2011, at 10:51 AM, Jim Giner wrote: I disagree. It's not about tuning the queries, it is more about the appl. design that currently thinks it SHOULD do such huge queries. My approach would be to prompt the user for filtering criteria that automatically would reduce the result set size. Although at this time I believe the OP mentioned that the db is just telephone numbers so that doesn't leave much room for filter-criteria. Yes it is just phone numbers... The only select that I'm running on the entire site is related to the pagination... A simple: $sqlCount = SELECT COUNT(*) FROM main WHERE state = '{$state}'; which limits it to everything inside the state... Unfortunately if you look at the possibilities, it's still quite a large dataset... 89 million :) The rest of the query's will be much more limited to areacode, exchange, and in some cases the full phone number... Maybe the better way to do it would be not to count the records But set a variable with the total count... That way I don't have to load all the data... The data amount won't change alot... Easy enough to set a variable... Just need to see if I can integrate that with the pagination... Back to the drawing board! :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Exporting large data from mysql to html using php
Jason Pruim li...@pruimphotography.com On Oct 25, 2011, at 9:58 PM, Jim Giner wrote: David Robley robl...@aapt.net.au wrote in message news:49.50.34068.1b567...@pb1.pair.com... Consider running EXPLAIN on all your queries to see if there is something Mysql thinks could be done to improve performance. Why do so many responders seem to think the problem here is in the preparation of the query? It is the Approach that it is the problem. It needs to re-addressed, not simply tinkered with. I don't care if someone figures out how to spew out 89M+ records in 5 seconds flat. What are you doing pulling up that many detail records at one time for? Who is going to look at them? You? If so, see my previous post on how long that is going to take you just to examine (!) the first million alone. This problem needs a re-working of the data processing and user interfaces to allow for the selection of an appropriate amount of individual records in any result set, otherwise simply preparing a summary of some sort. It turns out the issue was actually in the pagination... I'm reworking the whole thing and stream lining it... But in the pagination that I found on the internet it used a SELECT COUNT(*) WHERE state='{$state}'; and the COUNT was killing the time... Once that was removed, I was displaying records faster then I could imagine... So it's off to pagination land to fix it! And possibly redo the entire thing! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Exporting large data from mysql to html using php
Jason Pruim li...@pruimphotography.com On Oct 25, 2011, at 10:10 PM, Jim Giner wrote: - Original Message - From: Jason Pruim li...@pruimphotography.com To: Jim Giner jim.gi...@albanyhandball.com Cc: php-general@lists.php.net Sent: Tuesday, October 25, 2011 10:06 PM Subject: Re: [PHP] Exporting large data from mysql to html using php It turns out the issue was actually in the pagination... I'm reworking the whole thing and stream lining it... But in the pagination that I found on the internet it used a SELECT COUNT(*) WHERE state='{$state}'; and the COUNT was killing the time... Once that was removed, I was displaying records faster then I could imagine... So it's off to pagination land to fix it! And possibly redo the entire thing! So you're still going to generate pages and pages of an un-manageable volume of data? Sorry, but I offer my congratulations on producing a technically marvelous solution, and my condolences for a completely worthless application. It's walking the fine line between what I want, and what the people who are paying for it want... What I always try and do is give them what they ask for, but also give them what they want... because what they ask for != what they want MOST of the time... So most likely I will end up pulling the pagination and really limiting the searching... But until I convince the right people... I go on as planned. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Exporting large data from mysql to html using php
Now that I've managed to list 3 separate programming languages and somewhat tie it back into php here's the question... I have about 89 million records in mysql... the initial load of the page takes 2 to 3 minutes, I am using pagination, so I have LIMIT's on the SQL query's... But they just aren't going fast enough... What I would like to do, is pull the data out of MySQL and store it in the HTML files, and then update the HTML files once a day/week/month... I can figure most of it out... BUT... How do I automatically link to the individual pages? I have the site working when you pull it from MySQL... Just the load time sucks... Any suggestions on where I can pull some more info from? :) Thanks in advance! Jason Pruim li...@pruimphotography.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Exporting large data from mysql to html using php
On Oct 24, 2011, at 10:44 PM, Jim Giner wrote: Why would any user need to have access to 89M records? They don't need access to it to edit it... Just to be able to view it... Also, it will be expanding in the future to include alot more data. Jason Pruim li...@pruimphotography.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Exporting large data from mysql to html using php
Jason Pruim li...@pruimphotography.com On Oct 24, 2011, at 9:20 PM, Bastien wrote: On 2011-10-24, at 8:50 PM, Jason Pruim li...@pruimphotography.com wrote: Now that I've managed to list 3 separate programming languages and somewhat tie it back into php here's the question... I have about 89 million records in mysql... the initial load of the page takes 2 to 3 minutes, I am using pagination, so I have LIMIT's on the SQL query's... But they just aren't going fast enough... What I would like to do, is pull the data out of MySQL and store it in the HTML files, and then update the HTML files once a day/week/month... I can figure most of it out... BUT... How do I automatically link to the individual pages? I have the site working when you pull it from MySQL... Just the load time sucks... Any suggestions on where I can pull some more info from? :) Thanks in advance! Jason Pruim li...@pruimphotography.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php That's a ton of data. So there are a couple of questions: 1. Is the data ordered in any way? Data is in numeric order in the database, but not specifing a ORDER BY on the SELECT.. The issue is that you might need to regenerate the files if new data needs to be interspersed. Indexes are freshly done... I might need to tweak them and learn more about them... Working on that right now! 2. Why is pagination slow? Pagination isn't all that slow... Just the initial load of the site... The rest of it works fairly well... But the guys with the paychecks aren't going for a 2-3 minute initial load time on a public website A LIMIT with an OFFSET should be very quick if the table is properly indexed. Is there any tuning that you can do to further filter the results? Say by date or some other criteria? Have you run an EXPLAIN plan on the db to show how the queries are being run? Other thoughts: - are your indexes up to date? Have you optimized those index to be clean, not fragmented, and therefore fast? Just generated the indexes so it should be completely perfect. - can you organize the data by some criteria to better show the results? Like by date? Or by starting alpha character? Or by category? Trying to split up the data some... It's phone numbers... So I have the area code, exchange, and the subscriber number stored in 3 separate fields... But that doesn't seem any faster then when I had it all in one field I think I just need to rethink the design a little bit, and optimize the entire app... But I think that will hit tomorrow. Thanks for your suggestions! Bastien Koert 905-904-0334 -- 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] Processing newlines in a text area field
Answer below! Jason Pruim li...@pruimphotography.com On Oct 13, 2011, at 10:49 PM, Stephen wrote: I have a web page with a form with a text area. I enter: foo bar PHP processes the POST and inserts the record into MySQL. The database field is text. I use PDO For testing I have removed any processing of the text area content. Now, no matter how many blank rows I have between foo and bar, in the database record, I always get a single newline character. I am using Firefox 7.0.1. Is this normal behaviour? I want to be able to enter more than 1 newline. It could possibly be just not displaying it properly in the webpage... try running the output through: nl2br(); and see if that helps. Thanks Stephen -- 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] Decoding Barcode Images
Jason Pruim li...@pruimphotography.com On Oct 10, 2011, at 2:42 PM, Floyd Resler wrote: I've been trying to find a solution for decoding barcode images in PHP but haven't had much luck so far. Does anyone have any suggestions? Thanks! Floyd Hi Floyd, What kind of barcodes are you wanting to work with? 2D? Postnet? IMB? QRCodes? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with code...
Hi everyone, Have a question about this block of code ?PHP //SETUP VARIABLES $mailTo = li...@pruimphotography.com; $mailFrom = li...@pruimphotography.com; //These 2 can be changed IF you know what you are doing and why! $returnPath = $mailFrom; $replyTo = $mailFrom; $mailSubject = New Convention registration!; $message = ; //DO NOT CHANGE UNDER PENALITY OF BEING SLAPPED WITH A WET NOODLE!!! $headers = From: .$mailFrom.\n; $headers .= Return-Path: .$returnPath.\n; $headers .= Reply-To: .$replyTo.\n; function send_email($mailTo, $mailSubject, $mailMessage, $headers) { if(mail( $mailTo, $mailSubject, $mailMessage, $headers )) { $message = Thank you for registering!; }else { echo There was an issue with your registration.. Please try again later; } }//Close Function if(!empty($errorCount)) { }else { //Build Email message $mailmessage = Full Name: . $_POST['firstname'] . . $_POST['lastname'] . \n\n; $mailmessage .= Address: . $_POST['address'] . \n\n; $mailmessage .= City, State, Zip: . $_POST['city'] . . $_POST['state'] . . $_POST['zip'] . \n\n; $mailmessage .= Phone: . $_POST['phone'] . \n\n; $mailmessage .= Email address: . $_POST['email'] . \n\n; if($_POST['affiliation'] == NFBOther) { $mailmessage .= Chapter Affiliation: . $_POST['other'] . \n\n; }else{ $mailmessage .= Chapter Affiliation: . $_POST['affiliation'] . \n\n; } if($_POST['person'] ==Other){ $mailmessage .= Who will pick up the ticket? . $_POST['Pfirstname'] . . $_POST['Llastname'] . \n\n; }else{ $mailmessage .= Who will pick up the ticket? I will pick it up my self! \n\n; } $mailmessage .= Payment Method: . $_POST['paymentMethod']; send_email($mailTo, $mailSubject, $mailmessage, $headers); } ? Sometimes... It is dropping the last $mailmessage line... The payment method in the actual email it sends... Anyone have any ideas? I'm stumped Jason Pruim li...@pruimphotography.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with code...
Jason Pruim li...@pruimphotography.com On Oct 6, 2011, at 9:04 PM, George Langley wrote: On 2011-10-06, at 6:28 PM, Jason Pruim wrote: ?PHP //SETUP VARIABLES $mailTo = li...@pruimphotography.com; $mailFrom = li...@pruimphotography.com; //These 2 can be changed IF you know what you are doing and why! $returnPath = $mailFrom; $replyTo = $mailFrom; $mailSubject = New Convention registration!; $message = ; //DO NOT CHANGE UNDER PENALITY OF BEING SLAPPED WITH A WET NOODLE!!! $headers = From: .$mailFrom.\n; $headers .= Return-Path: .$returnPath.\n; $headers .= Reply-To: .$replyTo.\n; function send_email($mailTo, $mailSubject, $mailMessage, $headers) { if(mail( $mailTo, $mailSubject, $mailMessage, $headers )) { $message = Thank you for registering!; }else { echo There was an issue with your registration.. Please try again later; } }//Close Function if(!empty($errorCount)) { }else { //Build Email message $mailmessage = Full Name: . $_POST['firstname'] . . $_POST['lastname'] . \n\n; $mailmessage .= Address: . $_POST['address'] . \n\n; $mailmessage .= City, State, Zip: . $_POST['city'] . . $_POST['state'] . . $_POST['zip'] . \n\n; $mailmessage .= Phone: . $_POST['phone'] . \n\n; $mailmessage .= Email address: . $_POST['email'] . \n\n; if($_POST['affiliation'] == NFBOther) { $mailmessage .= Chapter Affiliation: . $_POST['other'] . \n\n; }else{ $mailmessage .= Chapter Affiliation: . $_POST['affiliation'] . \n\n; } if($_POST['person'] ==Other){ $mailmessage .= Who will pick up the ticket? . $_POST['Pfirstname'] . . $_POST['Llastname'] . \n\n; }else{ $mailmessage .= Who will pick up the ticket? I will pick it up my self! \n\n; } $mailmessage .= Payment Method: . $_POST['paymentMethod']; send_email($mailTo, $mailSubject, $mailmessage, $headers); } ? Sometimes... It is dropping the last $mailmessage line... The payment method in the actual email it sends... Anyone have any ideas? I'm stumped Hi there. First thought is perhaps it is not getting a value for paymentMethod and if it doesn't exist, will the line still get added? I would always check to see if every post variable isset, before adding the line. Can write a default line in its place if missing. The variable is being set with a default value of nothing else... But for some reason it's not bringing it through when the form is submitted... Any other ideas? hehe :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP installations, usage, and popularity
Sent from my iPhone On Sep 19, 2011, at 5:08 PM, Tedd Sperling tedd.sperl...@gmail.com wrote: Hi gang: I need information to convince administrators in management that PHP is a viable subject that should be taught in college with credits going toward a Degree or Certification. Would another college already doing that help or hurt? Full sail university does just that both online and in person if you're local. Almost took the program but ran out of money to quickly... They aren't cheap but they are good! You see, I am pushing for a Web Development Certification program that would include PHP/MySQL as well as several other Web Languages (i.e., html, css, javascript, ajax). Currently the college teaches ASP in a regular course toward a IT Certification, but class attendance has dropped considerably -- no one wants to take the course. However, My PHP class has been maxed out. But my class is a special topic class and not part of the regular coursework that would go towards a Degree or Certification -- and that's where I would like this to go. As such, I need information regarding how wide-spread PHP is (i.e., number of installations), who's using it (i.e., companies, organizations), and how it compares with other Web Languages (i.e., ASP, Ruby, etc.). So, what say you? References will work. Thanks, tedd _ t...@sperling.com http://sperling.com -- 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] Re: Repetitive answers . . .
Jason Pruim li...@pruimphotography.com On Sep 15, 2011, at 3:22 AM, Nathan Nobbe wrote: On Wed, Sep 14, 2011 at 10:06 PM, Joshua Stoutenburg jehoshu...@gmail.comwrote: On Wed, Sep 14, 2011 at 11:59 AM, Govinda govinda.webdnat...@gmail.com wrote: As for duplicate answers..., [snip] Also newbies may tend to like the multiples answers.. for the different perspectives, as Dan said, but also when they are exact dupe answers - because then the newbie knows the answer is definitive.. and then stops asking the list.. and starts doing what work is called for. -Govinda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php That's a good point. The absence of objection to a provided answer doesn't necessarily make it definitive since it could just be the masses passed over the conversation. Therefore, yes, duplicate answers are a good thing. Thanks everybody for your patience in helping this mailing list newcomer understand how things work. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php wait, it sounds like we could use another answer .., yes ppl like to answer things many times here, often with almost identical suggestions, and many spins on how to approach the problem, including alternative perspectives on life..; the ebb--flow of php-general ;) I've always thought that getting a couple fairly similar answers to the same question helped to validate the answer for someone who is in the early process of learning ;) -nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Code should be selv-maintaining!
On Aug 30, 2011, at 6:25 PM, Richard Quadling wrote: On 30 August 2011 20:09, Robert Cummings rob...@interjinn.com wrote: You're just saying that so Tedd will be your friend!! Come now, let's be honest with everyone... Whitesmith's is -GLEE! ;) Beauty is in the eye of the beholder. I always thought that was beer holder? Is it friday yet? ;) Jason Pruim li...@pruimphotography.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Dealing with multiple form submissions
Hey Everyone, Wondering what everyone does to prevent multiple form submissions? My form is simply getting emailed to my email, and it redirects to a success page when submitted... Would it be as simple as doing something with the cache control? Basically I'm trying to avoid someone submitting a form... Then hitting back, and submitting again, then hitting back I think you get the idea... What do you all do? Thanks! Jason Pruim li...@pruimphotography.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with inserting numbers...
Replies below Jason Pruim li...@pruimphotography.com On Aug 10, 2011, at 11:08 PM, Ken Robinson wrote: At 09:22 PM 8/10/2011, Jason Pruim wrote: So here I am attempting to generate some numbers to be inserted into a database... eventually they will make up a phone number (Which I've emailed about before and know about the bad ideas with it.. But it's the customer :)) Here is the code I am working with: ?PHP function number_pad($number,$n) { return str_pad((int) $number,$n,0,STR_PAD_LEFT); } $SQL = SELECT * FROM Test WHERE `areacode` = '907' AND `prefix` = '200' LIMIT 5; $result = mysql_query($SQL); while ($num != 1) { while($row = mysql_fetch_assoc($result)) { $padnum = number_pad($num, 4); echo $row['areacode'] . - . $row['prefix'] . - . $padnum . BR; $num++; } } ? Try to avoid putting a database query in a loop. But that's exactly what I need to do... onceI have the code working with the echo I need to update the database with the numbers being displayed... $fullnumber = $row['areacode'].$row['prefix'].$padnum; $SQL = INSERT INTO Test ('fullnumber'( VALUES($fullnumber); So I want that to be in a loop since it will be inserting roughly 10,000 records for every areacode/prefix combination :) In the query only ask for the fields you are going to use, it's faster. Why use your own function to pad a string, when there is a built-in function? Because when I was doing my searching I came across the function I'm using before I saw the range function :) Try this code (untested): ?php $nums = range(0,); $q = SELECT areacode, prefix FROM Test WHERE `areacode` = '907' AND `prefix` = '200' LIMIT 5; $rs = mysql_query($q); while ($row = mysql_fetch_assoc($rs)) { foreach ($nums as $n) { echo sprintf('%03d-%03d-%04d',$row['areacode'],$row['prefix'],$n) br\n; } } ? I will try this later today after the day job gets done... Thanks for the help! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with inserting numbers...
Jason Pruim pru...@gmail.com On Aug 11, 2011, at 9:35 AM, Andrew Ballard wrote: On Wed, Aug 10, 2011 at 9:22 PM, Jason Pruim pru...@gmail.com wrote: So here I am attempting to generate some numbers to be inserted into a database... eventually they will make up a phone number (Which I've emailed about before and know about the bad ideas with it.. But it's the customer :)) Here is the code I am working with: ?PHP function number_pad($number,$n) { return str_pad((int) $number,$n,0,STR_PAD_LEFT); } $SQL = SELECT * FROM Test WHERE `areacode` = '907' AND `prefix` = '200' LIMIT 5; $result = mysql_query($SQL); //$num = ; //foreach ($result as $key = $value) { //echo $key . - . $value . - . number_pad($num, 4) . BR; //$num++; //} while ($num != 1) { while($row = mysql_fetch_assoc($result)) { $padnum = number_pad($num, 4); echo $row['areacode'] . - . $row['prefix'] . - . $padnum . BR; $num++; } } ? basically all I'm trying to do is generate the last 4 digits starting at and going up to . for testing purposes I'm just echoing back but will eventually insert the complete number back into the database as a 7 digit string. The error I'm getting is: Fatal error: Maximum execution time of 30 seconds exceeded in /home/pruimpho/public_html/jason/dev/clients/flewid/Phone/config/phoneareacodes.php on line25 which is where the second while starts... Does anyone know a better way to do this? I'm off to finish searching google while waiting for some good news :) Thanks Everyone! Jason Pruim pru...@gmail.com You could always push it off to MySQL. I don't have a MySQL instance available to test right now, but I ran this on SQL Server and it should be generic enough to port without much change. Basically, you just load a table with a single tinyint column with the digits between 0 and 9, and then allow the database to cross join that table 4 times to get 1 resulting rows numbered through . The cross join on this database server executes in around 44ms. -- Create a temporary table containing the digits 0 through 9 CREATE TABLE Digits ( n tinyint NOT NULL PRIMARY KEY CHECK (n BETWEEN 0 AND 9) ) INSERT INTO Digits VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9) -- Cross join the digits table 4 times to load into a table called numbers. SELECT CONVERT(char(1), Thousands.n) + CONVERT(char(1), Hundreds.n) + CONVERT(char(1), Tens.n) + CONVERT(char(1), Ones.n) AS Number INTONumbers FROMDigits AS Thousands, Digits AS Hundreds, Digits AS Tens, Digits AS Ones ORDER BY Thousands.n, Hundreds.n, Tens.n, Ones.n SELECT * FROMNumbers -- Drop the temporary digits table DROP TABLE Digits Andrew Hey Andrew, Interesting idea... I'm so used to doing it all from PHP that I forget a database can be more then just a storage engine sometimes :) I'll definitely give it a try tonight! Thanks Andrew! -- 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] Problem with inserting numbers...
Jason Pruim pru...@gmail.com On Aug 11, 2011, at 11:52 AM, Jim Lucas wrote: On 8/10/2011 6:22 PM, Jason Pruim wrote: So here I am attempting to generate some numbers to be inserted into a database... eventually they will make up a phone number (Which I've emailed about before and know about the bad ideas with it.. But it's the customer :)) Here is the code I am working with: ?PHP function number_pad($number,$n) { return str_pad((int) $number,$n,0,STR_PAD_LEFT); } $SQL = SELECT * FROM Test WHERE `areacode` = '907' AND `prefix` = '200' LIMIT 5; $result = mysql_query($SQL); //$num = ; //foreach ($result as $key = $value) { //echo $key . - . $value . - . number_pad($num, 4) . BR; //$num++; //} while ($num != 1) { while($row = mysql_fetch_assoc($result)) { $padnum = number_pad($num, 4); echo $row['areacode'] . - . $row['prefix'] . - . $padnum . BR; $num++; } } ? basically all I'm trying to do is generate the last 4 digits starting at and going up to . for testing purposes I'm just echoing back but will eventually insert the complete number back into the database as a 7 digit string. The error I'm getting is: Fatal error: Maximum execution time of 30 seconds exceeded in /home/pruimpho/public_html/jason/dev/clients/flewid/Phone/config/phoneareacodes.php on line25 which is where the second while starts... Does anyone know a better way to do this? I'm off to finish searching google while waiting for some good news :) Thanks Everyone! Jason Pruim pru...@gmail.com Jason, Here is my rendition of what you should do. ?PHP $SQL = SELECT areacode, prefix FROMTest WHERE `areacode` = '907' AND `prefix` = '200'; $result = mysql_query($SQL); $values = ''; while( $row = mysql_fetch_assoc($result) ) { foreach ( range(0, ) AS $n ) { $values .= $row['areacode'] . '-' . $row['prefix'] . '-' . str_pad($n, 4, '0', STR_PAD_LEFT); } } echo $values; ? It will be much faster if you build the complete string in memory then echo out the built string. Hey Jim, Would that still hold true with inserting into a database which is the true end of it? This is going to be a one time thing I'm doing and I'm trying to make it a learning experience as I go since that's what everything should be right? Jim Lucas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with inserting numbers...
So here I am attempting to generate some numbers to be inserted into a database... eventually they will make up a phone number (Which I've emailed about before and know about the bad ideas with it.. But it's the customer :)) Here is the code I am working with: ?PHP function number_pad($number,$n) { return str_pad((int) $number,$n,0,STR_PAD_LEFT); } $SQL = SELECT * FROM Test WHERE `areacode` = '907' AND `prefix` = '200' LIMIT 5; $result = mysql_query($SQL); //$num = ; //foreach ($result as $key = $value) { //echo $key . - . $value . - . number_pad($num, 4) . BR; //$num++; //} while ($num != 1) { while($row = mysql_fetch_assoc($result)) { $padnum = number_pad($num, 4); echo $row['areacode'] . - . $row['prefix'] . - . $padnum . BR; $num++; } } ? basically all I'm trying to do is generate the last 4 digits starting at and going up to . for testing purposes I'm just echoing back but will eventually insert the complete number back into the database as a 7 digit string. The error I'm getting is: Fatal error: Maximum execution time of 30 seconds exceeded in /home/pruimpho/public_html/jason/dev/clients/flewid/Phone/config/phoneareacodes.php on line25 which is where the second while starts... Does anyone know a better way to do this? I'm off to finish searching google while waiting for some good news :) Thanks Everyone! Jason Pruim pru...@gmail.com
Re: [PHP] Problem with inserting numbers...
On Aug 10, 2011, at 9:36 PM, MUAD SHIBANI wrote: Basically you can increase time limit for this file to handle your request by using set_time_limit function ... Hi Maud, Looked into set_time_limit and even tried running it with a value of 120 but it didn't help... I'm affraid I have a problem with the way the 2 while loops are interacting and creating a infinite loop... BUT... I'm thinking there must be a better way... Maybe a while with a foreach? Now I'm just thinking outloud :) Jason Pruim pru...@gmail.com
[PHP] Problem with header(Location: )...
So I'm attempting to redirect back to the main site of a page after a successful insert into a database... Here's my code: ?PHP if (!$resp-is_valid) { // What happens when the CAPTCHA was entered incorrectly die (The reCAPTCHA wasn't entered correctly. Go back and try it again. . (reCAPTCHA said: . $resp-error . )); } else { $name = mysql_real_escape_string($_POST['txtName']); $comment = mysql_real_escape_string($_POST['areaComment']); $phonelink = mysql_real_escape_string($_POST['phonelink']); $SQL = INSERT INTO comments (name, comment, phonelink) VALUES ('$name', '$comment', '$phonelink'); mysql_query($SQL) or die(Unable to insert at this time. Sorry for the inconvience); //echo Insert successful!; header(Location: HTTP://jason.pruimphotography.com/dev/clients/flewid/Phone/); // Your code here to handle a successful verification } ? The insert happens, BUT it won't redirect back to the site There isn't any reason I should be able to do a header() redirect at that point is there? Or is there a better way to do it? Thanks Everyone! Jason Pruim li...@pruimphotography.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with header(Location: )...
Jason Pruim li...@pruimphotography.com On Jul 31, 2011, at 2:50 PM, Dajka Tamas wrote: Try lowercase 'http'. Anything in error log? Try turning on display_errors. Tried both, upper and lower case http nothing changed... And nothing in the error log... I try a simple echo with a link and that works just fine... Starting to get frustrated with it -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Phone numbers....
No I'm not looking for your phone number... Or for the guy/girl whose number you thought you got last night at the bar but turned out to be the information number... I'm working on a project for a client that I need to represent all the possible phone numbers in the US and Canada... Which thankfully use the same format (10 digits) but if my math and searching are correct... I'm looking at a possibility of 10 BILLION possible numbers... I can think of away to program the insert of all 10 billion possible entries, but not really formatted properly... Does any one have a database that they could send me like that? :) Or any tips on phone numbers? Thanks again! :) Jason Pruim li...@pruimphotography.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Phone numbers....
On Jul 31, 2011, at 4:14 PM, Alex Nikitin wrote: There are databases with area codes for the first 3, so you only have to generate 1 million. Why do you need to store all of them again? I don't necessarily need to store it... BUT I do need to be able to represent all the numbers somehow... The site is a Find out who called me and why type of site... So some of the numbers will have comments on them other won't... But I need to be able to show all the possibilities so they can add their comment to it Unless I grab the area code, the first 3 of the phone number, and then just randomly generate the last 4? Might be a little easier that way And then only store it once they comment on it...
Re: [PHP] Problem with header(Location: )...
On Jul 31, 2011, at 6:23 PM, Tamara Temple wrote: On Jul 31, 2011, at 1:40 PM, Jason Pruim wrote: So I'm attempting to redirect back to the main site of a page after a successful insert into a database... Here's my code: ?PHP if (!$resp-is_valid) { // What happens when the CAPTCHA was entered incorrectly die (The reCAPTCHA wasn't entered correctly. Go back and try it again. . (reCAPTCHA said: . $resp-error . )); } else { $name = mysql_real_escape_string($_POST['txtName']); $comment = mysql_real_escape_string($_POST['areaComment']); $phonelink = mysql_real_escape_string($_POST['phonelink']); $SQL = INSERT INTO comments (name, comment, phonelink) VALUES ('$name', '$comment', '$phonelink'); mysql_query($SQL) or die(Unable to insert at this time. Sorry for the inconvience); //echo Insert successful!; header(Location: HTTP://jason.pruimphotography.com/dev/clients/flewid/Phone/); // Your code here to handle a successful verification } ? The insert happens, BUT it won't redirect back to the site There isn't any reason I should be able to do a header() redirect at that point is there? Since the echo is commented out, there shouldn't be any output if that is sum total of the code executing on the http request. If this file is called from some other script, you might check to see if any output is sent from there. If display_errors is on, you should be getting something like Unable to send headers after output or some such (I can't offhand think of the actual error message). You can keep the error successful message for verification if you write it directly to the error log, via: error_log(Insert successful.PHP_EOL); Sometimes, it's also nice to insert markers to let you know where the log is emanating from: error_log(__FILE__.'@'.__LINE__.': '.Insert successful.PHP_EOL); Sometimes, a vexing sort of error is a blank line at the top or bottom of a file, outside the ?..? Just before I got your e-mail, I found there were 3 spaces at the very top of the file in front of my ?PHP I was fit to be tied as they say in the south... But it is up and working properly now! Thank you all for your help with this! :) Jason Pruim li...@pruimphotography.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PayPal IPN
Hey everyone, So I know this is related pretty strictly to paypal... But I also know that you all most likely use it :) So with that said... Has anyone successfully setup the IPN with paypal? I'm trying to figure out to get it up and working and can't seem to wrap my head around it... But then again, I've been at it for a few hours so I'm hoping in the morning it gets more clear! Here is the test code that I am working with: ?PHP error_reporting(E_ALL ^ E_NOTICE); $email = $_GET['ipn_email']; $header = ; $emailtext = testing 123; // Read the post from PayPal and add 'cmd' $req = 'cmd=_notify-validate'; if(function_exists('get_magic_quotes_gpc')) { $get_magic_quotes_exits = true; } foreach ($_POST as $key = $value) // Handle escape characters, which depends on setting of magic quotes { if($get_magic_quotes_exists == true get_magic_quotes_gpc() == 1){ $value = urlencode(stripslashes($value)); } else { $value = urlencode($value); } $req .= $key=$value; } // Post back to PayPal to validate $header .= POST /cgi-bin/webscr HTTP/1.0\r\n; $header .= Content-Type: application/x-www-form-urlencoded\r\n; $header .= Content-Length: . strlen($req) . \r\n\r\n; $fp = fsockopen ('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30);//Test //$fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);// Live // Process validation from PayPal // TODO: This sample does not test the HTTP response code. All // HTTP response codes must be handles or you should use an HTTP // library, such as cUrl if (!$fp) { // HTTP ERROR } else { // NO HTTP ERROR fputs ($fp, $header . $req); while (!feof($fp)) { $res = fgets ($fp, 1024); if (strcmp ($res, VERIFIED) == 0) { // TODO: // Check the payment_status is Completed // Check that txn_id has not been previously processed // Check that receiver_email is your Primary PayPal email // Check that payment_amount/payment_currency are correct // Process payment // If 'VERIFIED', send an email of IPN variables and values to the // specified email address foreach ($_POST as $key = $value){ $emailtext .= $key . = .$value .\n\n; } mail(pru...@gmail.com, Live-INVALID IPN, $emailtext . \n\n . $req); //removed for testing //mail($email, Live-VERIFIED IPN, $emailtext . \n\n . $req); } else if (strcmp ($res, INVALID) == 0) { // If 'INVALID', send an email. TODO: Log for manual investigation. foreach ($_POST as $key = $value){ $emailtext .= $key . = .$value .\n\n; } mail(pru...@gmail.com, Live-INVALID IPN, $emailtext . \n\n . $req); //Removed for testing //mail($email, Live-INVALID IPN, $emailtext . \n\n . $req); } } } fclose ($fp); ? Thanks everyone! Hoping to find a easy fix to it! Jason Pruim pru...@gmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Submit Using An Image Form Processing
On Jun 18, 2011, at 7:34 PM, Shawn McKenzie wrote: On 06/18/2011 11:06 AM, Jason Pruim wrote: On Jun 18, 2011, at 11:54 AM, Ron Piggott ron.pigg...@actsministries.org wrote: INPUT TYPE=image SRC=http://www.theverseoftheday.info/store-images/trash_can.png; WIDTH=20 HEIGHT=20 style=float: right;boarder: 0; alt=Remove Product From Shopping Cart name=remove_product value=1 / I would wrap the image in a link like so: a href=mypage.php?id={$autoincrementnum}img src=blah/a And then have a get look for that variable: $id=$_get[id]; If (isset($id)) { //delete code here } Check all that before you run it I'm writing from my smart phone and it's all untested. Hopefully it gives you a start though. Jason Pruim Get method is for retrieval only. It is not for anything that has a consequence (insert, update, delete, send email, etc.). Use only post for those. I've actually used $_GET in the way I described because then it doesn't require submitting a form to be able to delete something from a list. with $_POST you would have to submit the form, so you would need to build an array of check boxes to store what ones you want to delete, and then go through and process the array to remove all the proper items. But with the $_GET you can process it one at a time. I had a system up and working for maintaining a address database for quite awhile and it worked great for me. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Submit Using An Image Form Processing
On Jun 18, 2011, at 11:54 AM, Ron Piggott ron.pigg...@actsministries.org wrote: INPUT TYPE=image SRC=http://www.theverseoftheday.info/store-images/trash_can.png; WIDTH=20 HEIGHT=20 style=float: right;boarder: 0; alt=Remove Product From Shopping Cart name=remove_product value=1 / I would wrap the image in a link like so: a href=mypage.php?id={$autoincrementnum}img src=blah/a And then have a get look for that variable: $id=$_get[id]; If (isset($id)) { //delete code here } Check all that before you run it I'm writing from my smart phone and it's all untested. Hopefully it gives you a start though. Jason Pruim
RE: [PHP] What do you get for ...
-Original Message- From: Richard Quadling [mailto:rquadl...@gmail.com] Sent: 07 June 2011 11:35 To: PHP General list Subject: [PHP] What do you get for ... Hi. What do you get for ... php -r var_dump(realpath(null)); I'm wondering if the result should be a boolean false. But I'm getting very different results for different versions of PHP for Windows. For PHP5+ (upto lastest 5.3.7-dev), the output is always the same as getcwd() [snip] I get the following in Win7 Pro x64 SP1 running PHP 5.3.6: --- BEGIN OUTPUT --- Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved. D:\php -r var_dump(realpath(null)); string(3) D:\ D:\ -- END OUTPUT --- HTH J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Filtering data not with mysql...
Hey Everyone, Probably a simple question but I wanted to make sure I was right before I got to far ahead of my self I have a form that I am working on and this form will be emailed to the recipient for processing (Not stored in a database). When I store in a database, I simply run all the data through mysql_real_escape_string() and it's all good... Without the database, is it just as easy as addslashes($var)? or is there more that needs to be done? In the end, the info will be echoed back out to the user to be viewed but not edited and emailed to someone to add the registration collect money, etc etc. Am I on the right track or do I need to rethink my whole process? :) Thanks Everyone! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] filter_var using regex
On 05/04/2011 03:10 PM, Ashley Sheridan wrote: On Wed, 2011-05-04 at 13:46 -0600, Jason Gerfen wrote: On 05/04/2011 01:27 PM, Ashley Sheridan wrote: On Wed, 2011-05-04 at 13:20 -0600, Jason Gerfen wrote: I am running into a problem using the REGEXP option with filter_var(). The string I am using: 09VolunteerApplication.doc The PCRE regex I am using: /^[a-z0-9]\.[doc|pdf|txt|jpg|jpeg|png|docx|csv|xls]{1,4}$/Di The function in it's entirety: return (!filter_var('09VolunteerApplication.doc', FILTER_VALIDATE_REGEXP, array('options'=array('regexp'='/^[a-z0-9]\.[doc|pdf|txt|jpg|jpeg|png|docx|csv|xls]{1,4}$/Di' ? false : true; Anyone have any insight into this? You missed a + in your regex, at the moment you're only checking to see if a file starts with a single a-z or number and then is followed by the period. Then you're checking for oddly for one to four extensions in the list, are you sure you want to do that? And the square brackets are used to match characters, not strings, use the standard brackets to allow from a choice of strings Try this: '/^[a-z0-9]+\.(doc|pdf|txt|jpg|jpeg|png|docx|csv|xls)$/Di' One other thing you should be aware of maybe, filenames won't always consist of just the letters a-z and numbers 0-9, they may contain accented or foreign letters, hyphens, spaces and a number of other characters depending on the client machines OS. Windows allows very few characters for example compared to the Unix-like OS's like MacOS and Linux. Both are valid PCRE regex's. However the rules regarding usage of parenthesis for an XOR string does not explain a similar regex being used with the filter_var() like so: return (filter_var('kc-1', FILTER_VALIDATE_REGEXP, array('options'=array('regexp'='/^[kc\-1|kc\-color|gr\-1|fa\-1|un\-1|un\-color|ben\-1|bencolor|sage\-1|sr\-1|st\-1]{1,8}$/Di'))) ? true : false; The above returns string(4) kc-1 Another test using the following works similarly: return (filter_var('u0368839', FILTER_VALIDATE_REGEXP, array('options'=array('regexp'='/^[gp|u|gx]{1,2}[\d+]{6,15}$/Di'))) ? true : false; The above returns string(8) u0368839 And return (filter_var('u0368839', FILTER_VALIDATE_REGEXP, array('options'=array('regexp'='/^[gp|u|gx]{1,2}[\d+]{6,15}$/Di'))) ? true : false; returns string(8) gp123456 As you can see these three examples use the start [] as XOR conditionals for multiple strings as prefixes. Not quite, you think they match correctly because that's all you're testing for, and you're not looking for anything that might disprove that. Using your last example, it will also match these strings: gu0368839 xx0368839 p0368839 I tested your first regex with '09VolunteerApplication.doc' and it doesn't work at all until you add in that plus after the basename match part of the regex: ^[a-z0-9]+\.[doc|pdf|txt|jpg|jpeg|png|docx|csv|xls]{1,4}$ However, your regex (with the plus) also matches these strings: 09VolunteerApplication.docp 09VolunteerApplication.docj 09VolunteerApplication.doc|-- note it's matching the literal bar character Making the changes I suggested (^[a-z0-9]+\.(doc|pdf|txt|jpg|jpeg|png| docx|csv|xls)$) means the regex works as you expect. Square brackets in a regex match a range, not a literal string, and without any sort of modifier, match only a single instance of that range. So in your example, you're matching a 4 character extension containing any of the following characters '|cdfgjlnopstx', and a basename containing only 1 character that is either an a-z or a number. You are right, after a few other tests I stand corrected. My apologies. However according to the documentation for filter_var() and the PCRE regexp option if it returns false, which it is, this is indicating an error with the regex. Here are the changes I have made: print_r(var_dump(filter_var('09VolunteerApplication.doc', FILTER_VALIDATE_REGEXP, array('options'=array('regexp'='/^[a-z0-9]+\.(doc|pdf|txt|jpg|jpeg|png|docx|csv|xls){1,4}$/Di'); I appreciate your assistance and insights. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: iPhone apology - was Re: [PHP] Re: Installing on a Mac: include_path issues
Jason Pruim On May 5, 2011, at 12:29 PM, Ken Kixmoeller phph...@comcast.net wrote: On Thu, May 5, 2011 at 9:52 AM, Richard Quadling rquadl...@gmail.com wrote: On 5 May 2011 15:08, Mike Mackintosh mike.mackint...@angrystatic.com wrote: Sent from my iPhone Why do all iPhone users apologize for sending mail from their iPhone? 1. Apparently, iphone software top-posts replies. For some people, that alone constitutes a federal (if not intergalactic) crime. Very true... 2. This signature addition seems to have started with the Blackberry. Some people got upset with concise replies (like fine) thinking them to be snippy, when they were due to limited typing capabilities. The signature can be set/moved on the iPhone depending on where you want it. 3. Advertising for Apple. Like they need more? Hehe Btw... Sent this from my iPhone :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] filter_var using regex
On 05/04/2011 03:10 PM, Ashley Sheridan wrote: On Wed, 2011-05-04 at 13:46 -0600, Jason Gerfen wrote: On 05/04/2011 01:27 PM, Ashley Sheridan wrote: On Wed, 2011-05-04 at 13:20 -0600, Jason Gerfen wrote: I am running into a problem using the REGEXP option with filter_var(). The string I am using: 09VolunteerApplication.doc The PCRE regex I am using: /^[a-z0-9]\.[doc|pdf|txt|jpg|jpeg|png|docx|csv|xls]{1,4}$/Di The function in it's entirety: return (!filter_var('09VolunteerApplication.doc', FILTER_VALIDATE_REGEXP, array('options'=array('regexp'='/^[a-z0-9]\.[doc|pdf|txt|jpg|jpeg|png|docx|csv|xls]{1,4}$/Di' ? false : true; Anyone have any insight into this? You missed a + in your regex, at the moment you're only checking to see if a file starts with a single a-z or number and then is followed by the period. Then you're checking for oddly for one to four extensions in the list, are you sure you want to do that? And the square brackets are used to match characters, not strings, use the standard brackets to allow from a choice of strings Try this: '/^[a-z0-9]+\.(doc|pdf|txt|jpg|jpeg|png|docx|csv|xls)$/Di' One other thing you should be aware of maybe, filenames won't always consist of just the letters a-z and numbers 0-9, they may contain accented or foreign letters, hyphens, spaces and a number of other characters depending on the client machines OS. Windows allows very few characters for example compared to the Unix-like OS's like MacOS and Linux. Both are valid PCRE regex's. However the rules regarding usage of parenthesis for an XOR string does not explain a similar regex being used with the filter_var() like so: return (filter_var('kc-1', FILTER_VALIDATE_REGEXP, array('options'=array('regexp'='/^[kc\-1|kc\-color|gr\-1|fa\-1|un\-1|un\-color|ben\-1|bencolor|sage\-1|sr\-1|st\-1]{1,8}$/Di'))) ? true : false; The above returns string(4) kc-1 Another test using the following works similarly: return (filter_var('u0368839', FILTER_VALIDATE_REGEXP, array('options'=array('regexp'='/^[gp|u|gx]{1,2}[\d+]{6,15}$/Di'))) ? true : false; The above returns string(8) u0368839 And return (filter_var('u0368839', FILTER_VALIDATE_REGEXP, array('options'=array('regexp'='/^[gp|u|gx]{1,2}[\d+]{6,15}$/Di'))) ? true : false; returns string(8) gp123456 As you can see these three examples use the start [] as XOR conditionals for multiple strings as prefixes. Not quite, you think they match correctly because that's all you're testing for, and you're not looking for anything that might disprove that. Using your last example, it will also match these strings: gu0368839 xx0368839 p0368839 I tested your first regex with '09VolunteerApplication.doc' and it doesn't work at all until you add in that plus after the basename match part of the regex: ^[a-z0-9]+\.[doc|pdf|txt|jpg|jpeg|png|docx|csv|xls]{1,4}$ However, your regex (with the plus) also matches these strings: 09VolunteerApplication.docp 09VolunteerApplication.docj 09VolunteerApplication.doc|-- note it's matching the literal bar character Making the changes I suggested (^[a-z0-9]+\.(doc|pdf|txt|jpg|jpeg|png| docx|csv|xls)$) means the regex works as you expect. Square brackets in a regex match a range, not a literal string, and without any sort of modifier, match only a single instance of that range. So in your example, you're matching a 4 character extension containing any of the following characters '|cdfgjlnopstx', and a basename containing only 1 character that is either an a-z or a number. You are right, after a few other tests I stand corrected. My apologies. However according to the documentation for filter_var() and the PCRE regexp option if it returns false, which it is, this is indicating an error with the regex. In addition to this I would like to point out that the same regex using the older preg_match() function works as it should while the character class following by the pattern (+) fails the validation portion of the regex. print_r(var_dump(filter_var('09VolunteerApplication.doc', FILTER_VALIDATE_REGEXP, array('options'=array('regexp'='/^[a-z0-9]+\.(doc|pdf|txt|jpg|jpeg|png|docx|csv|xls){1,4}$/Di'); returns false (invalid regex) when using the character matching class [a-z0-9]+ with the filter_var() function with the FILTER_VALIDATE_REGEXP option print_r(var_dump(preg_match('/^[a-z0-9]+\.(doc|pdf|txt|jpg|jpeg|png|docx|csv|xls){1,4}$/i', '09VolunteerApplication.doc'))); return int(1) indicating a valid regex as well as a valid match. I believe this should be reported as a bug but I appreciate your assistance and insights. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] filter_var using regex
I am running into a problem using the REGEXP option with filter_var(). The string I am using: 09VolunteerApplication.doc The PCRE regex I am using: /^[a-z0-9]\.[doc|pdf|txt|jpg|jpeg|png|docx|csv|xls]{1,4}$/Di The function in it's entirety: return (!filter_var('09VolunteerApplication.doc', FILTER_VALIDATE_REGEXP, array('options'=array('regexp'='/^[a-z0-9]\.[doc|pdf|txt|jpg|jpeg|png|docx|csv|xls]{1,4}$/Di' ? false : true; Anyone have any insight into this? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] filter_var using regex
On 05/04/2011 01:27 PM, Ashley Sheridan wrote: On Wed, 2011-05-04 at 13:20 -0600, Jason Gerfen wrote: I am running into a problem using the REGEXP option with filter_var(). The string I am using: 09VolunteerApplication.doc The PCRE regex I am using: /^[a-z0-9]\.[doc|pdf|txt|jpg|jpeg|png|docx|csv|xls]{1,4}$/Di The function in it's entirety: return (!filter_var('09VolunteerApplication.doc', FILTER_VALIDATE_REGEXP, array('options'=array('regexp'='/^[a-z0-9]\.[doc|pdf|txt|jpg|jpeg|png|docx|csv|xls]{1,4}$/Di' ? false : true; Anyone have any insight into this? You missed a + in your regex, at the moment you're only checking to see if a file starts with a single a-z or number and then is followed by the period. Then you're checking for oddly for one to four extensions in the list, are you sure you want to do that? And the square brackets are used to match characters, not strings, use the standard brackets to allow from a choice of strings Try this: '/^[a-z0-9]+\.(doc|pdf|txt|jpg|jpeg|png|docx|csv|xls)$/Di' One other thing you should be aware of maybe, filenames won't always consist of just the letters a-z and numbers 0-9, they may contain accented or foreign letters, hyphens, spaces and a number of other characters depending on the client machines OS. Windows allows very few characters for example compared to the Unix-like OS's like MacOS and Linux. Both are valid PCRE regex's. However the rules regarding usage of parenthesis for an XOR string does not explain a similar regex being used with the filter_var() like so: return (filter_var('kc-1', FILTER_VALIDATE_REGEXP, array('options'=array('regexp'='/^[kc\-1|kc\-color|gr\-1|fa\-1|un\-1|un\-color|ben\-1|bencolor|sage\-1|sr\-1|st\-1]{1,8}$/Di'))) ? true : false; The above returns string(4) kc-1 Another test using the following works similarly: return (filter_var('u0368839', FILTER_VALIDATE_REGEXP, array('options'=array('regexp'='/^[gp|u|gx]{1,2}[\d+]{6,15}$/Di'))) ? true : false; The above returns string(8) u0368839 And return (filter_var('u0368839', FILTER_VALIDATE_REGEXP, array('options'=array('regexp'='/^[gp|u|gx]{1,2}[\d+]{6,15}$/Di'))) ? true : false; returns string(8) gp123456 As you can see these three examples use the start [] as XOR conditionals for multiple strings as prefixes. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newsgroup status
It used to be alot busier. But lately it has slowed down... It's up to us though to fix that! It's time for the next generation to start picking up the slack and helping out and asking questions :) Jason Pruim On Apr 27, 2011, at 11:54 AM, Joshua Kehn josh.k...@gmail.com wrote: If this is the PHP list thinking of it's moderately active. I sometimes forget which ones I'm subscribed to. Regards, -Josh___ Joshua Kehn | josh.k...@gmail.com http://joshuakehn.com On Wednesday, April 27, 2011 at 11:52 AM, Al wrote: Is this group off the air or just no topics being posted? I've not seen it so quiet in years. Al. -- 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] files outside of the web tree
Jason Pruim On Apr 27, 2011, at 1:11 PM, Joshua Kehn josh.k...@gmail.com wrote: On Wednesday, April 27, 2011 at 1:08 PM, Jim Giner wrote: I have managed to build include files and store them above my public folder and the called pages manage to find them from the public folder and properly include them. My problem is with the html src= attribute. I have uploaded photos to be included in my web pages and I didn't want them in the web tree so I moved them above it also. I use php to get the root folder's name and then I add ../photos/ to the filename's path, but now my tags can't find them. Can I not do this? Nope, static elements need to be stored in a web accessible directory. If you could access things by saying `../` then that would defeat the purpose of storing things where they aren't accessible. Actually it is possible but not the way he was doing it... Look at dispatch model scripts I believe. Those (if my memory is correct) will allow you to serve files the way you are wanting to. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Flattery will get you nowhere
On Apr 27, 2011, at 4:58 PM, Robert Cummings wrote: On 11-04-27 04:47 PM, HallMarc Websites wrote: I just googled up php tedd form validation and can't find a single reference. What does this mean, that I respect tedd's skills or that he needs better SEO? OOH!! I KNOW! I KNOW! PICK ME! PICK ME! Um Both? No wait, maybe Tedd doesn't want his stuff found? Tedd who? ;) This tedd right? http://www.tednugent.com/ ;) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] XML... Useful or another layer of complexity?
So the subject says it all... And yes I know this isn't related to PHP but it's the weekend and I trust the opinions on this list more then any other list I have seen. I've been doing alot of reading on XML and honestly it looks pretty cool... BUT the question is... Is it truly useful or is it just another layer that we have to write? From what I can tell it looks like it could stabilize some of my programming in regards to databases, and possibly if I have to move information from one application to another. But is it worth the added coding or should I just interact with the pieces directly? Thoughts? Questions? Flames? :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XML... Useful or another layer of complexity?
On Apr 3, 2011, at 3:31 PM, mrfroasty wrote: On 04/03/2011 08:41 PM, Jason Pruim wrote: So the subject says it all... And yes I know this isn't related to PHP but it's the weekend and I trust the opinions on this list more then any other list I have seen. I've been doing alot of reading on XML and honestly it looks pretty cool... BUT the question is... Is it truly useful or is it just another layer that we have to write? From what I can tell it looks like it could stabilize some of my programming in regards to databases, and possibly if I have to move information from one application to another. But is it worth the added coding or should I just interact with the pieces directly? Thoughts? Questions? Flames? :) Not sure about specific situations, but if I have to write my own application to application data transfer i wouldnt add such a complexity.I would just create my own data like objects/arrays serialized and send them over via http post or any easy means.And i will be done in few minutes, problem solved!. I have once created orders in xml for myself and send over via ftp to another application.But this was just due to a fact that I had the scripts in place to do the job.It looks much matured though, than if I had transfer the orders in text format. But as I said, this depends on particular situations and problem on the table.All cases where I worked with xml, were me receiving data from client either via soap,xml files etc.Here I have no choice I have to work with xml ofcourse. P:S **How could you stabilize your scripts by adding xml ? I was thinking along the lines of using it as a intermediary.. Basically make a system that would take my raw data, throw it into XML, and then out to the web, database, or something else I haven't thought of.. If I was going into database I could create an abstraction layer using XML and format all the data before inserting it into specific fields... Now that I typed it I'm not sure it would work like I want it to But that was my thinking at the time. Although I could write a system that would generate the XML from content in a database and then parse it as an rss feed, and insert it into a calendar system... (If that was needed) Right now the question is purely academic so I'm coming up with this stuff as I'm typing hehe :)
Re: [PHP] Design question
On Feb 5, 2011, at 11:19 AM, Ashley Sheridan wrote: On Sat, 2011-02-05 at 11:11 -0500, li...@pruimphotography.com wrote: Morning everyone! I have a design question... No it's not about the interior of my house... although I could use some help with that as well... I am working on a framework for my own use (And maybe one day will beat out the popular frameworks! Hey I can dream right? :)) and to increase my knowledge. Here's my current index page: DJ_doctype(HTML4S); DJ_head(Double J FrameWork, $cfgCss, $cfgMeta); DJ_modules(navigation, option); DJ_page(main_content.html, mainContent); DJ_dbconnect($cfgDatabase); DJ_footer(copywrite, Double J Web Design); It all works perfectly but I'm starting to question having a bunch of function calls like that or should I simply have a big master DJ_displayPage() call? or should I have my framework create the html files? Has anyone gone down this road before? any pitfalls I should watch out for that aren't in google yet? :) Thanks everyone! Jason Pruim I guess it all depends on what you need. A little while back there was a discussion on the list about whether or not to leave all content dynamic or have the PHP CMS create the various .html pages required. There are pros and cons to each method. I'll definitely be looking that thread up! I got a little behind in my reading and must have missed it. As for the various calls vs a single call to display the page, that depends on how you will be using it. Personally, I'd prefer using one call to something like your call to DJ_displayPage() which itself can accept various parameters or an array of parameters that then makes the more individual calls to the other functions. Anything to reduce typing while still being maintainable is never a bad thing in my book, unless it becomes a crazy long list of chained calls! That last sentence is the kicker... That's where it gets hard hehe. When is too much too much? And I am guessing that is a decision that only I as the programmer can make... At least until someone uses my framework and complains about it! :) Thanks Ash! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Design question
On Feb 5, 2011, at 6:46 PM, Paul M Foster wrote: On Sat, Feb 05, 2011 at 11:11:57AM -0500, li...@pruimphotography.com wrote: Morning everyone! I have a design question... No it's not about the interior of my house... although I could use some help with that as well... I am working on a framework for my own use (And maybe one day will beat out the popular frameworks! Hey I can dream right? :)) and to increase my knowledge. Here's my current index page: DJ_doctype(HTML4S); DJ_head(Double J FrameWork, $cfgCss, $cfgMeta); DJ_modules(navigation, option); DJ_page(main_content.html, mainContent); DJ_dbconnect($cfgDatabase); DJ_footer(copywrite, Double J Web Design); Copywrite should be copyright in this context. It all works perfectly but I'm starting to question having a bunch of function calls like that or should I simply have a big master DJ_displayPage() call? Is this index page a front controller, or are there separate page controllers? If the calls are all *identical*, then you can stuff them into a single function call. The biggest problem with this is variable visibility. You'll have to monitor that and decide if it's worth it. In my case, I use page controllers where all the important variables are declared. If I put a render() function at the bottom, I'd have to pass in all those variables (on the stack) rather than simply have them visible to the template page that I include() at the bottom of the page controller. Right now in my simple test pages the variables are very standard but I will keep an eye on it to see if I need to change to a different system. I'm leaning more towards doing a page controller. I've always liked the way that I can simplify the display of pages especially with regards to updates in the layout by just having a index page that controls the entire site. or should I have my framework create the html files? Has anyone gone down this road before? any pitfalls I should watch out for that aren't in google yet? :) Some of this depends on your overall application architecture, which is where the front contoller/page controller question above comes from. Thanks for the insight! I'll be keeping these points in mind in my work! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Hot Topics
Jason Pruim On Dec 30, 2010, at 12:36 AM, Daniel Brown danbr...@php.net wrote: On Dec 29, 2010 11:48 PM, Jason Pruim li...@pruimphotography.com wrote: Weren't you playing with the possibility of including the amount of actual code written as well? Yeah, that was in for a few weeks, but I believe it was Robert Cummings who went out of his way to show its imperfections. Maybe we should incorporate a syntax checker to show parse errors for the week, too. ;-P Always thought that would be pretty cool :) And as someone who is married as well I agree with what you said. Sometimes it's easier to just say you're sorry then fighting even when you know you're right. Or when you top-post. Prune, Prune, Prune /me shakes head. Hey it was late last night and I was responding from my iPod :P I seem to remember you doing the same thing from your phone Mr. Brown :P -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Hot Topics
Weren't you playing with the possibility of including the amount of actual code written as well? Always thought that would be pretty cool :) And as someone who is married as well I agree with what you said. Sometimes it's easier to just say you're sorry then fighting even when you know you're right. Jason Pruim On Dec 29, 2010, at 9:22 PM, Daniel Brown danbr...@php.net wrote: First, I have to admit that what I did was wrong. I had assumed (ASS-umed) that the other party in a discussion under a different thread would understand and appreciate the irony of my email in reply to his inappropriate message. Those of you who were barraged with the fallout know what I mean. Unfortunately, it was not well-received by the other person, which led to even further flaming and trolling. While I had tried both on- and off-list to urge the other party to move the discussion from the public forum to a private, one-on-one conversation, it was ignored and actually seemed to exacerbate the situation. For my part in that, I just wanted to send my general apologies to those bombarded with an unnecessary and somewhat illogical series of emails. If being married has taught me anything, it's that it's better to just apologize and move on, regardless of who's right or wrong. And if being married has taught me anything else, it's that, at least in this house, I'm always wrong. So sorry for the unnecessary banter. Moving on, those of you who have been on the list for several years may recall when I was running the ListWatch and PostTrack system, which would send a weekly summary of the list's activities at the time. Before stopping it (it was on a server that burned out, and I just never put it back online), I had added a topic tracker as well, which would give the percentage of activity for a given topic, as well as the ratio of its discussion versus all messages to the list. Several people have asked if/when it would be coming back online, so I'm contemplating bringing it back beginning with the first week of January (next week). Does anyone have any thoughts on that, or any ideas for other interesting metrics they'd like to see? I'm particularly interested in the opinions of folks who recall the old system, but any opinions and ideas are more than welcome. If you'd rather send it to me directly instead of on the list, feel free. Happy early New Year, all. -- /Daniel P. Brown Network Infrastructure Manager Documentation, Webmaster Teams http://www.php.net/ -- 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] Barcode Reader
What kind of barcode? Most of the barcodes I work with only store text that doesn't mean much unless you have the decode algorithm... In other words you need to know where the info is coming from to be able to determine what is stored in the barcode. Jason Pruim On Dec 6, 2010, at 11:21 AM, Floyd Resler fres...@adex-intl.com wrote: Does anyone know of a class that can extract information from a barcode image? Thanks! Floyd -- 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] Problem with functions and arrays...
On Nov 21, 2010, at 4:57 PM, Tamara Temple wrote: On Nov 20, 2010, at 5:31 PM, Jason Pruim wrote: ?PHP function ddbYear($name, $message, $_POST, $option){ Maybe it's just me, but using the name of a global as a function parameter just seems like a bad idea. Yes, you can do it. Should you? I think not. Especially, as, you are passing it a scalar below and treating it here like the global array. It was there as a hold over from when I originally made the functions which just had to deal with getting variables from the $_POST global. //Make sure to post form start/stop OUTSIDE of this function... //It's not meant to be a one size fits all function! echo NAME: . $name . BR; echo MESSAGE: . $message . BR; echo POST: . $_POST . BR; echo OPTION: . $option . BR; $sticky = ''; if(isset($_POST['submit'])) { Check the error messages -- since you're passing in $startYear as a scalar below, you shouldn't be able to access $_POST as an associative array. ini_set(display_errors, 1); error_reporting(-1); were both on and were not complaining about anything... $sticky = $_POST[{$name}]; echo STICKY: . $sticky; } //echo OPTION: ; //print_r($option); echo HTML select name={$name} option value=0{$message}/option HTML; foreach ($option as $key = $value){ if($key == $sticky) { echo 'option value=' . $key .' selected' . $value . '/option'; }else{ echo 'option value=' . $key .'' . $value . '/option'; } } echo HTML /select HTML; unset($value); return; } ? One for Month, Day Year... All the same exact code... When I get brave I'll combine it into 1 functions :) Now... What it's trying to do.. It's on a update form on my website. Basically pulls the info from the database and displays it in the form again so it can be edited and resubmitted... As I'm sure you can tell from the function it checks to see if the a value has been selected in the drop down box and if it has then set the drop down box to that value. I call the function like this: ?PHP $startYear = date(Y, $row['startdate']); //Actual DBValue: 1265000400 You're setting $startYear as a scalar value here. $optionYear = array(2010 = 2010, 2011 = 2011, 2012 = 2012, 2013 = 2013, 2014 = 2014); ddbYear(startYear, Select Year, $startYear, $optionYear); And passing it in to the $_POST variable in your function. Then you treat the $_POST variable as an associative array (seemingly much like the global $_POST array). ? The output I'm getting is: THESE ARE THE ACTUAL UNPROCESSED (OTHER THEN SEPARATING) VALUES FROM THE DATABASE startmonth: 2 startday: 1 startYear: 2010 endmonth: 11 endDay: 30 endYear: 1999 THESE ARE THE VALUES INSIDE THE FUNCTION NAME: startYear MESSAGE: Select Year POST: 2010 OPTION: Array STICKY: 2 Now... The problem is that $sticky get set to 2 instead of 2010... But I can't figure out why... Anyone have any ideas? And just incase I didn't provide enough info here's a link that shows it happening: HTTP://jason.pruimphotography.com/dev/cms2/events/update_form.php?id=62 Again, I will reiterate that taking the name of a global variable and using it as a parameter in a function is a bad idea. It can be done, and my in some cases have some uses, but I don't think the way you're using it is a good idea, and looks wrong to me as well. Turns out it was a conflict with the $_POST global.. Or my misunderstanding inside the functions... I changed that to another name and now it works fine... Thanks Tamara! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Procedural Autoloader?
Hey Everyone! Fresh off my problem with functions and arrays I come across something that I can't seem to find currently... The autoloader function that is in PHP 5+ works on classes... But I'm not finding anything that would do the same thing on the procedural end... Such as I have a folder typically called includes in my projects where I place all my function files... I would LOVE to use the autoloader to be able to just load them on demand... But in my quick searching/thinking I haven't found away too... So I thought I would see if anyone had invented that wheel yet before I go and try and do it my self :) I may also have a misunderstanding of how it is supposed to work since I don't truly understand OOP I've always done procedural... Any help on this one would be greatly appreciated it! :) Jason Pruim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Procedural Autoloader?
On Nov 22, 2010, at 4:24 PM, Daniel P. Brown wrote: On Mon, Nov 22, 2010 at 15:37, Jason Pruim li...@pruimphotography.com wrote: Hey Everyone! Fresh off my problem with functions and arrays I come across something that I can't seem to find currently... The autoloader function that is in PHP 5+ works on classes... But I'm not finding anything that would do the same thing on the procedural end... Such as I have a folder typically called includes in my projects where I place all my function files... I would LOVE to use the autoloader to be able to just load them on demand... But in my quick searching/thinking I haven't found away too... So I thought I would see if anyone had invented that wheel yet before I go and try and do it my self :) I may also have a misunderstanding of how it is supposed to work since I don't truly understand OOP I've always done procedural... Any help on this one would be greatly appreciated it! :) There's no such thing, Prune. Autoloaders are for classes, and the only way you could have it work for functions would be to catch the error in the core and handle it at a lower level than your scripts (modified core or extension), because the error generated for an undefined function isn't a catchable fatal. Alternatively, you *could* write a function wrapper that utilizes function_exists() and the like, then rewrite all of your code to use that wrapper but how much sense does that make? ;-P How much sense do I ever make? :P Maybe it's time to get a book on OOP and start learning the concept.. Or find a better way to load my functions so I don't have to have 1 huge functions file or tons of includes if I have them all separate... Or maybe I can just bastardize classes enough to make something work :P I think most of my functions border on classes anyway... Off to google to see if I'm right! :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with functions and arrays...
Hey Everyone! So I came across a problem that I don't know how to fix... I have searched and thought and just not having anything click as to where I am messing up... I have a few functions as follows: ?PHP function ddbYear($name, $message, $_POST, $option){ //Make sure to post form start/stop OUTSIDE of this function... //It's not meant to be a one size fits all function! echo NAME: . $name . BR; echo MESSAGE: . $message . BR; echo POST: . $_POST . BR; echo OPTION: . $option . BR; $sticky = ''; if(isset($_POST['submit'])) { $sticky = $_POST[{$name}]; echo STICKY: . $sticky; } //echo OPTION: ; //print_r($option); echo HTML select name={$name} option value=0{$message}/option HTML; foreach ($option as $key = $value){ if($key == $sticky) { echo 'option value=' . $key .' selected' . $value . '/option'; }else{ echo 'option value=' . $key .'' . $value . '/option'; } } echo HTML /select HTML; unset($value); return; } ? One for Month, Day Year... All the same exact code... When I get brave I'll combine it into 1 functions :) Now... What it's trying to do.. It's on a update form on my website. Basically pulls the info from the database and displays it in the form again so it can be edited and resubmitted... As I'm sure you can tell from the function it checks to see if the a value has been selected in the drop down box and if it has then set the drop down box to that value. I call the function like this: ?PHP $startYear = date(Y, $row['startdate']); //Actual DBValue: 1265000400 $optionYear = array(2010 = 2010, 2011 = 2011, 2012 = 2012, 2013 = 2013, 2014 = 2014); ddbYear(startYear, Select Year, $startYear, $optionYear); ? The output I'm getting is: THESE ARE THE ACTUAL UNPROCESSED (OTHER THEN SEPARATING) VALUES FROM THE DATABASE startmonth: 2 startday: 1 startYear: 2010 endmonth: 11 endDay: 30 endYear: 1999 THESE ARE THE VALUES INSIDE THE FUNCTION NAME: startYear MESSAGE: Select Year POST: 2010 OPTION: Array STICKY: 2 Now... The problem is that $sticky get set to 2 instead of 2010... But I can't figure out why... Anyone have any ideas? And just incase I didn't provide enough info here's a link that shows it happening: HTTP://jason.pruimphotography.com/dev/cms2/events/update_form.php?id=62 Thanks for looking and for your answers in advance! :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: My truth comes out [1]
-Original Message- From: Gary [mailto:php-gene...@garydjones.name] Sent: 21 October 2010 11:39 To: php-general@lists.php.net Subject: [PHP] Re: My truth comes out [1] Russell Dias wrote: preg_match(/false/i, $string) ? false : true; , | $foo = (strcmp('true', $string) == 0); ` works as well :) I don't like those kinds of things for this purpose because it takes longer for people new to the code to read and understand it than, say , | (boolean) $string; ` (which in my case does a pretty meaningless conversion) No, I was just wondering whether I had missed some construct in the language that might the conversion for me, and be obvious to PHP-heads. No problem that there doesn't seem to be. What about something simple and readable like: ($string==true) ? true : false; J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reminder On Mailing List Rules
On Oct 21, 2010, at 10:47 AM, Daniel Brown danbr...@php.net wrote: On Thu, Oct 21, 2010 at 10:41, Robert Cummings rob...@interjinn.com wrote: I can't speak for everyone here (or who is no longer here)... but my posts have dwindled significantly due to work and family time constraints :| Same here, but isn't it a bit eerie that many of us hit that same point almost simultaneously? Richard Lynch, Lester Caine, Jochem Maas, Jim Lucas, the Nathans (Rixham and Nobbe), yourself, myself - even Tedd Sperling and Jason Pruim, among many others - seemed to all fall off the face of the virtual earth at about the same moment. Then again, I suppose that's how generations work. I know I disappeared but it involved a move across country. :) Also... For anyone with an iPhone/iPod touch you can post how ever you want from it just like normal. The only thing that can not be moved is your signature but the rest is moveable. For that is how I did this reply... All typed in the exact place you see it. Hoping to be able to contribute more though in the near future. -- /Daniel P. Brown Network Infrastructure Manager Documentation, Webmaster Teams http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] odd while behavior...
Okay so I'm just playing around with some stuff trying to learn more and expand my knowledge and I ran into something I don't understand... Take the following code: ?PHP echo select; $i =0; while($i =12) { $dateformat = date(M, mktime(0,0,0, $i,0,0)); $month = mktime(0,0,0, $i,0,0); //echo date(M, mktime(0,0,0, $i,0,0)); //echo brinside whilebr; echo HTML option value={$i}{$dateformat} {$i}/option HTML; $i++; } echo /select; ? which does display a select drop down box with the month's in it... But on my test server it starts the display at december... With setting $i = 1 i would have thought it should start at january? Any ideas on what I missed? :) Thanks for looking! :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: Fw: [PHP] Connecting to MySql with PHP
-Original Message- From: Steve Staples [mailto:sstap...@mnsi.net] Sent: 05 October 2010 13:55 To: php-general Subject: Re: Fw: [PHP] Connecting to MySql with PHP On Tue, 2010-10-05 at 13:35 +0100, sueandant wrote: - Original Message - From: sueandant To: a...@ashleysheridan.co.uk Sent: Monday, October 04, 2010 10:29 PM Subject: Re: [PHP] Connecting to MySql with PHP Thanks Ash Where do I find the PHP mysql module? I have uncommented both the extensions php-mysql.dll and php-mysqli.dll; do I need to do more? Just curious... BUT Did you restart apache (or your webserver software) ? Also, did you configure the windows firewall to allow connections into the MySQL server? J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Since it is friday.... :)
Anyone know of a good and active general web design list? Looking for somewhere that I can post about javascript specifically :) And happy friday to you all! :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Standalone WebServer for PHP
On Sep 12, 2010, at 1:33 PM, tedd wrote: At 5:57 PM +0100 9/12/10, Ashley Sheridan wrote: On Sun, 2010-09-12 at 12:55 -0400, tedd wrote: Can a business have a server connected to the Internet but limit access to just their employees? I don't mean a password protected scheme, but rather the server being totally closed to the outside world other than to their internal employees? Or is this something that can only be provided by a LAN with no Internet connection? Not entirely sure what you're asking, but could you maybe achieve something like this with a WAN using a VPN? Thanks, Ash Ash: I'm sure this is an obvious question for many on this list, but I'm not above showing my ignorance. I guess what I am asking -- if a client wanted an application written (in web languages) so that their employees could link all their different computers together and share/use information using browsers, is that possible using a server that is not connected to the Internet? Look, I know that I can solve my clients problems by finding a host and writing scripts to do what they want -- that's not a problem. But everything I do is open to the world. Sure I can provide some level of security, but nothing like the security that can be provided behind closed and locked doors. So, can I do what I do (i.e., programming) without having a host? Can I install a local server at my clients location and interface all their computers to use the server without them ever being connected to the Internet? Maybe I should ask my grandson. :-) Hi tedd, I may not know all the possibilities but the only way I can think of to accomplish that would be to have a server setup in their office with a bank of modems and have everyone call into the server. Basically like an old school internet provider. If the main server can be secured to your clients liking there are ways that it can be on the net and still as safe as possible... But obviously not as safe as hard lines being dialed in... You'ld also have to take into account possibly long distance charges if everyone wasn't local... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Elegance is the goal... Sticky form submit help
Hey everyone! Hope you are having a great weekend, and I'm hoping someone might be coherent enough to help me find a more elegant solution to a problem that I have... I have a form for submitting an event to a website, and if the form is not submitted successfully (such as they didn't fill out a required field) I want it to redisplay the form with inline errors as to what happened and display the values they selected... I have a working solution but was hoping for something a little more elegant. And something that would work better for a month selector as well... Here is the relevant code that I have that works: ?PHP if ($_POST['hidSubmit'] ==TRUE $_POST['type'] == meeting): echo HTML select name=type id=type option value=0-- select type --/option option value=meeting selectedMeeting/option option value=event Event/option /select HTML; elseif ($_POST['hidSubmit'] == TRUE $_POST['type'] == event): //if ($_POST['hidSubmit'] == TRUE $_POST['type'] == event) { echo HTML select name=type id=type option value=0-- select type --/option option value=meetingMeeting/option option value=event selectedEvent/option /select HTML; else: //if ($_POST['hidSubmit'] != TRUE): echo HTML select name=type id=type option value=0 selected-- select type --/option option value=meetingMeeting/option option value=eventEvent/option /select HTML; endif; ? which works BUT I don't want to have to have that for a month selector or a day selector :) Any ideas what I'm missing? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Elegance is the goal... Sticky form submit help
On Sep 11, 2010, at 11:55 AM, tedd wrote: At 9:49 AM -0400 9/11/10, Jason Pruim wrote: Hey everyone! Hope you are having a great weekend, and I'm hoping someone might be coherent enough to help me find a more elegant solution to a problem that I have... I have a form for submitting an event to a website, and if the form is not submitted successfully (such as they didn't fill out a required field) I want it to redisplay the form with inline errors as to what happened and display the values they selected... -snip- Any ideas what I'm missing? Jason: I think what you are missing is that this data collection should be split between client-side and server-side operations. Hey tedd, Thanks for the response but for this particular project I'm avoiding using anything but standard HTML since it will be used almost exclusively by people using screen readers and other assistive technology so I'm going a little old school with it to make sure it all works for everyone else first. For client-side simply use javascript to monitor what they user enters and then immediately respond to the requirements imposed upon the user. After the user fills out the information correctly and clicks submit, then have your server-side scripts check the data again and respond accordingly. Here are a couple of examples: http://webbytedd.com/c/form-calc/ http://webbytedd.com/c/form-submit/ I will definitely be checking out your examples though! Some of the cleanest, well documented, and easiest to read code I have seen in a long time! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Elegance is the goal... Sticky form submit help
Hey Ash, On Sep 11, 2010, at 10:58 AM, a...@ashleysheridan.co.uk wrote: For a month selector, using a loop to output the months is good, as you can then within the loop check for that value sent and set the selected html attribute for that select element. that's what I was thinking too... Now just to work out the logic :) I should warn you that your code will throw a warning when no data has been posted to it. Consider using isset() instead to check for posted values rather than comparing a value (which might not exist) with true. I have other code that will catch it if it's empty but a good suggestion none the less! If I stick with that code for some reason I'll be updating it to use isset() Thanks Ash! Thanks, Ash http://www.ashleysheridan.co.uk - Reply message - From: Jason Pruim li...@pruimphotography.com Date: Sat, Sep 11, 2010 14:49 Subject: [PHP] Elegance is the goal... Sticky form submit help To: PHP-General list php-general@lists.php.net Hey everyone! Hope you are having a great weekend, and I'm hoping someone might be coherent enough to help me find a more elegant solution to a problem that I have... I have a form for submitting an event to a website, and if the form is not submitted successfully (such as they didn't fill out a required field) I want it to redisplay the form with inline errors as to what happened and display the values they selected... I have a working solution but was hoping for something a little more elegant. And something that would work better for a month selector as well... Here is the relevant code that I have that works: ?PHP if ($_POST['hidSubmit'] ==TRUE $_POST['type'] == meeting): echo HTML select name=type id=type option value=0-- select type --/option option value=meeting selectedMeeting/option option value=event Event/option /select HTML; elseif ($_POST['hidSubmit'] == TRUE $_POST['type'] == event): //if ($_POST['hidSubmit'] == TRUE $_POST['type'] == event) { echo HTML select name=type id=type option value=0-- select type --/option option value=meetingMeeting/option option value=event selectedEvent/option /select HTML; else: //if ($_POST['hidSubmit'] != TRUE): echo HTML select name=type id=type option value=0 selected-- select type --/option option value=meetingMeeting/option option value=eventEvent/option /select HTML; endif; ? which works BUT I don't want to have to have that for a month selector or a day selector :) Any ideas what I'm missing? -- 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] Elegance is the goal... Sticky form submit help
Hi Tamara, On Sep 11, 2010, at 12:39 PM, Tamara Temple wrote: Rather than repeating all that code, I suggest the following: select name=type id=type option value=0-- select type --/option option value=meeting ?php echo (isset($_POST['hidSubmit'] $_POST['hidSubmit'] == TRUE $_POST['type'] == meeting) ? selected : '' ? option value=event ?php echo (isset($_POST['hidSubmit'] $_POST['hidSubmit'] == TRUE $_POST['type'] == event) ? selected : '' ? /select That's actually what I'm trying to get away from. I was hoping to do it all in HEREDOC syntax. I've always thought it made it cleaner. But that is a personal opinion :) For a month selector, try: ?php // assume current month number is in $curr_month $months = array(1 = January, February, March, April, May, June, July, August, September, October, November, December); // will create an array of month names, with a starting base of 1 (instead of zero) echo select name=\month\ id=\month\\n; foreach ($months as $m = $mname) { echo option value=\$m\; if ($curr_month == $m) echo selected ; echo $mname/option\n; } echo /select\n; ? There are other possiblities as well. One time, I didn't want to actually store the month names, perhaps allowing them to be localized. Instead I used strftime, which will return appropriate names based on locale: ?php // assume current month number is in $curr_month echo select name=\month\ id=\month\\n; for ($m = 1; $m = 12; $m++) { echo option value=\$m\; if ($curr_month == $m) echo selected ; echo ; $mname = strftime(%B, 0,0,0,2010, $m, 1); // time, year and day don't matter, all we're after is the appropriate month name set in the locale echo $mname; echo /option\n; } echo /select\n; ? I'm actually doing something similar to that right now... ?PHP if (isset($_POST)) { $date = date(n, $i); echo $date; $i++; } ? Prints just the numeric reference to the month. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Elegance is the goal... Sticky form submit help
On Sep 11, 2010, at 1:03 PM, Debbie . wrote: Jason, I don't really understand the responses you got to this email, I have attached the sticky form I made from a book called PHP Visual Quickstart guide. It uses an if conditional to print a response if the field is empty. If I'm not helping, sorry, I'm new! Good luck! live, love and be happy! Deb Hi Deb, Welcome to the list! It will be the best and worse place you'll ever come for help! :) What you sent is helpful, but due to a personal preference I'm trying to avoid going in and out of PHP like you do in there... Trying to use HEREDOC for the entire page. It makes more sense to me that way :) Thank you though! :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Put all class in one file or different files
On 08/29/2010 02:04 PM, Eric Cash wrote: I'm out and about right now, so I can't link you to the autoload documentation page Thanks Eric, I have read the autoload document, but not pay attention on it. I will search more about it now, thanks. -- Thanks! VVThumb Microproduction Location:Room 807,QiLuRuanJianDaSha Qilu Software Park No. 1 Shunhua Rd High-Tech Development Zone Jinan, China 250101 Website: http://www.haulynjason.net/haulyn Mobile: +86 15854103759 Haulyn Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Questions about $_SERVER
On Aug 29, 2010, at 10:55 AM, tedd wrote: At 10:56 AM +0200 8/29/10, Peter Lind wrote: On 29 August 2010 08:08, Jim Lucas li...@cmsws.com wrote: *snip* Their is not existing variable (if you would) that your server, when connecting to a remote server, would be sending. So, to have the remote end be able to identify the initiating host identity, the initiating side would have to add some something to the headers or pass it along in the body of the request itself. +1. Let the requestion script send through identification/ authentification. Regards Peter To all: My post about SERVER globals was simply an observation that the SERVER global report of host and remote was not symmetric -- for example you could obtain both the IP and Domain Name of the host, but only the IP of the remote. Sorry for any confusion I may have caused in my post. As to the reason why I was asking, please review my next post, namely Secure Communication? Cheers, tedd Hey tedd, My understanding of how shared hosting works would make this near impossible... Basically Apache grabs a header that is sent at the initial connection which includes the destination hostname and from there it translates it to the proper directory on the shared host. All the IP's though are based off of the parent site's server... Now with dedicated hosting where you have the entire machine you can do what you are looking at because the IP address will always translate back to your website. Now hopefully my understanding of shared hosting isn't flawed but if it is I'm sure someone will nicely point out why :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Making multiple RSS feeds for the blog website
On Aug 27, 2010, at 5:55 AM, Andre Polykanine wrote: Hello Michelle, Hm. link rel=alternate... that's a good one, thanks (btw, you say me that I should RTFM, but if I knew what to read). Now there are two questions: 1. How do I do those .RSS files with PHP? All of mmy blog entries and other stuff are in MySql. There are classes that can echo the appropriate data as RSS, but there will be more .PHP files, not .RSS/.XML ones. So how do we manage that? 2. Should I make a separate .RSS file for each type of feeds (blog feed, comments feed, timeline feed, news feed)? thanks! Andre... What I did when I created my RSS feed is I went and read the RSS spec and found out what it needed to create it.[1] Read through that and it should get you started. If your competent with PHP then all you would need to do is loop through your result set to display the results. If you're not quite sure if you know how to do it though... I as well as many other people on the list I'm sure are available to hire to get it done :) [1] http://cyber.law.harvard.edu/rss/rss.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Put all class in one file or different files
Hi, all: I have many classes, from Java I have to put a class in one java files, in PHP I know I can put all of them in one file, but this make my class files too large, is there any best practice to guide these basic? Thanks. -- Thanks! VVThumb Microproduction Location:Room 807,QiLuRuanJianDaSha Qilu Software Park No. 1 Shunhua Rd High-Tech Development Zone Jinan, China 250101 Website: http://www.haulynjason.net/haulyn Mobile: +86 15854103759 Haulyn Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Put all class in one file or different files
On 08/29/2010 01:06 PM, Josh Kehn wrote: On Aug 29, 2010, at 12:56 AM, Haulyn Jason wrote: Hi, all: I have many classes, from Java I have to put a class in one java files, in PHP I know I can put all of them in one file, but this make my class files too large, is there any best practice to guide these basic? Thanks. -- Thanks! VVThumb Microproduction Location:Room 807,QiLuRuanJianDaSha Qilu Software Park No. 1 Shunhua Rd High-Tech Development Zone Jinan, China 250101 Website: http://www.haulynjason.net/haulyn Mobile: +86 15854103759 Haulyn Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Your question is clear as mud, can you clarify at all? Regards, -Josh Joshua Kehn | josh.k...@gmail.com http://joshuakehn.com Sorry, I mean: In php project, I am using OOp feature, I want to know, which way the following is better. 1, write a new class, create a new file. 2. write all class in one php file. Thanks. -- Thanks! VVThumb Microproduction Location:Room 807,QiLuRuanJianDaSha Qilu Software Park No. 1 Shunhua Rd High-Tech Development Zone Jinan, China 250101 Website: http://www.haulynjason.net/haulyn Mobile: +86 15854103759 Haulyn Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Surge 2010 Early Registration ends Tuesday!
Early Bird Registration for Surge Scalability Conference 2010 ends next Tuesday, August 31. We have a killer lineup of speakers and architects from across the Internet. Listen to experts talk about the newest methods and technologies for scaling your Web presence. http://omniti.com/surge/2010/register This year's event is all about the challenges faced (and overcome) in real-life production architectures. Meet the engineering talent from some of the best and brightest throughout the Internet: John Allspaw, Etsy Theo Schlossnagle, OmniTI Bryan Cantrill, Joyent Rasmus Lerdorf, creator of PHP Tom Cook, Facebook Benjamin Black, fast_ip Christopher Brown, Opscode Artur Bergman, Wikia Baron Schwartz, Percona Paul Querna, Cloudkick Surge 2010 takes place at the Tremont Grand Historic Venue on Sept 30 and Oct 1, 2010 in Baltimore, MD. Register NOW for the Early Bird discount and guarantee your seat to this year's event! -- Jason Dixon OmniTI Computer Consulting, Inc. jdi...@omniti.com 443.325.1357 x.241 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysqldump
On Aug 17, 2010, at 3:19 PM, tedd t...@sperling.com wrote: At 11:45 AM -0700 8/17/10, Mari Masuda wrote: Actually, mysqldump -u user -p password database_name outfile.sql is also the incorrect command. When providing the password in the command, there should not be a space between the -p and the actual password. Try mysqldump -u user -ppassword database_name outfile.sql and see if that gets you anywhere. Bingo -- that worked. It's interesting that a space is optional between -u and user, but required to be absent between -p and password. Seems not symmetrical to me Tedd... Goad you got the answer you needed as far as safely attacking the command line if my memory serves me correctly you are on a Mac so What you are looking for is a program called terminal. It's in the utilities folder of your harddrive. Then what you would do is assuming your host supports ssh is simply type into the terminal application: ssh youruzern...@yourdomain Say yes when it asks if you want to store the encryption key (I think that's what it's called) and then enter your password. Once all of that is done then just type in the command that was given and it will create the file just as you requested. Now I typed all that for the archives since you found a way to do t with exec but I'm always happy to help the archives where I can :) Have a great night! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Register now for Surge 2010
Registration for Surge Scalability Conference 2010 is open for all attendees! We have an awesome lineup of leaders from across the various communities that support highly scalable architectures, as well as the companies that implement them. Here's a small sampling from our list of speakers: John Allspaw, Etsy Theo Schlossnagle, OmniTI Rasmus Lerdorf, creator of PHP Tom Cook, Facebook Benjamin Black, fast_ip Artur Bergman, Wikia Christopher Brown, Opscode Bryan Cantrill, Joyent Baron Schwartz, Percona Paul Querna, Cloudkick Surge 2010 focuses on real case studies from production environments; the lessons learned from failure and how to re-engineer your way to a successful, highly scalable Internet architecture. The conference takes place at the Tremont Grand Historic Venue on Sept 30 and Oct 1, 2010 in Baltimore, MD. Register now to enjoy the Early Bird discount and guarantee your seat to this year's event! http://omniti.com/surge/2010/register Thanks, -- Jason Dixon OmniTI Computer Consulting, Inc. jdi...@omniti.com 443.325.1357 x.241 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Need help calling multiple functions with if_is
Hi Vince, On Jul 31, 2010, at 3:15 PM, Vince Leibowitz wrote: ?php if (is_home(?php wpads('728leaderboard'); ?) (is_page(42)(?php wpads('leaderboard1'); ? (is_page(10)(php? wpads('leaderboard5);?) ? Try: ?php if (is_home(wpads('728leaderboard');) (is_page(42)( wpads('leaderboard1') (is_page(10)(wpads('leaderboard5)) ? All I did was pull out all the jumps into PHP since the whole thing is a php if statement I didn't see the need to keep opening and closing php... Unless I'm not understanding why you are :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Need help calling multiple functions with if_is
On Jul 31, 2010, at 3:34 PM, Vince Leibowitz wrote: That looks like it should work, but it doesn't. There isn't a reason to close the embedded php statements, but I suspect wpads isn't recognizing the call when it is embedded like this. It just brings up a blank page in all instances, which is the same issue I was having with the original code string. On Sat, Jul 31, 2010 at 2:25 PM, Jason Pruim li...@pruimphotography.com wrote: Hi Vince, On Jul 31, 2010, at 3:15 PM, Vince Leibowitz wrote: ?php if (is_home(?php wpads('728leaderboard'); ?) (is_page(42)(?php wpads('leaderboard1'); ? (is_page(10)(php? wpads('leaderboard5);?) ? Try: ?php if (is_home(wpads('728leaderboard');) (is_page(42)( wpads('leaderboard1') I just noticed right here... You're missing a ' which would cause problems... Very possibly what would fix it in fact (is_page(10)(wpads('leaderboard5)) ? All I did was pull out all the jumps into PHP since the whole thing is a php if statement I didn't see the need to keep opening and closing php... Unless I'm not understanding why you are :) -- ~~ Vince Leibowitz CapitolAnnex.com twitter.com/CapitolAnnex myspace.com/capitolannex facebook.com/profile.php?id=501233189 vince.leibow...@gmail.com AOL, MSN, Yahoo: vpltz || ICQ: 118433437 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] the state of the PHP community
On Jul 29, 2010, at 1:36 AM, Nathan Rixham wrote: Hi All, Hey Nathan! I find myself wondering about the state of the PHP community (and related community with a PHP focus), so, here's a bunch of questions - feel free to answer none to all of them, on list or off, or add more of your own - this isn't for anything specific, just out of interest and sure I (and everybody who reads the replies) will learn something + doors/options/contacts may come of it. The only thing I can guarantee is that I'm genuinely interested in every reply and will read every one of them + lookup every tech and link mentioned. in no particular order: What other languages and web techs do you currently use other than PHP? - if you include html or css please include version, if js then preferred libs, and whether client or server side. HTML 4.01 and just getting into 5.0 CSS 2 + 3(Love some of the opacity stuff!), PHP What ever the current version is that my host has installed. MySQL What's your previous language/tech trail? Don't really have much of a trail... PHP was my start with just a little HTML/CSS before that Are you considering any new languages or techs, and if so which? - names / links I need to learn some more... But haven't decided where or what yet... I'm thinking Java/Javascript (Which I didn't realize were different until a little bit ago :P) Is PHP your hobby/interest, primary development language, just learning or? It started as a hobby... Then turned into a requirement for my job as I developed my companies website, and now it's what I hope tot be able to make money at! :) How many years have you been using PHP regularly? 5 How many years have you been working with web technologies? 13 (Started when the internet first came out :)) Did you come from a non-web programming background? Yes I did... Presorted mailings with the US Post Office. Is your primary role web developer or designer? Both... Though I struggle more with design but having a loving and creative wife who helps In your developer life, are you an employer, and employee, contractor, freelancer, part of a team of equal standing members? I would be a freelancer/contractor... Wouldn't mind being part of a team though with the right bunch of people. Do you tend to work on jobs for geo-local clients, clients in the same country, or do you work internationally 'on the web'? I've only done a handful of paying jobs.. mostly from job boards on the net... But I develop for my self to expand my unterstanding How do you get your projects? do they come to you, word of mouth, do you hunt and bid for projects, code call, visit clients, target clients individually you think you can help, or? - not looking for trade secrets, just to get enough for an overall picture. Right now just me going out and looking for them. Experimenting with twitter to see if that helps though Do you have any frustrations with the PHP community, do you find you want to talk shop but can't, or find people to work with but can't, have projects in mind you want to do but can't find people to do them with etc? I don't know enough of it to help out as much as I want on the mailing list... Or yall reply to quick for me since I work a non-programming job full time! :P Do you network with other PHP'ers in real life - meetups etc, do you tend to shy away, or do you find you circulate in other web related but non PHP focussed communities? real life? You mean unplugged from the matrix? Offline I don't know anyone that understands what I do... So mostly no. Are you a member or any other web tech communities, opensource efforts, or standardization bodies - again, if so which? No Are there any efforts, projects or initiatives which are floating your boat right now and that your watching eagerly (or getting involved with)? Loving the stuff coming out of An Event Apart... The test suites for CSS 3 and HTML5 are getting me very excited in what can happen... And maybe we can push this whole net thing a little further and really make it popular! :) ps: please *do not* flame anybodies answers, that really wouldn't be fair. Best Regards, Nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Fwd: [PHP-DB] always the logic that messes me up.... Database fun!
Hey Everyone, I know it's not strictly on topic but the php-db list hasn't responded and I haven't gotten any farther :) So please read below and earn a free beer for anyone that can help me, and can make it to Florida :) Begin forwarded message: From: Jason Pruim li...@pruimphotography.com Date: July 18, 2010 8:35:49 PM EDT To: php...@lists.php.net Subject: [PHP-DB] always the logic that messes me up Database fun! Hi everyone! I'm trying to put together a completely database driven site so I can learn how to do it... I've gone to the extent of creating apache rewrite rules to redirect all non-existent files/folders to my script to see if it exists which works perfectly. Where I'm running into trouble, is if I store the entire page inside the database, and inside that page I'm grabbing info from another part of the database how do I include that? Such as: pseudo -code: //Display current page info Grab current rate plans and prices from database finish displaying page. Now... It sounds easy enough but what I end up with on my page is: echo hosting info hosting info host info hosting info hosting info hosting info host info hosting info Current Plans HTML; include hostingprices.php; echo More info about hosting HTML; The only thing I changed was the actual text cause I didn't want to spam the list with my hosting schpeal :) So how do I make that work? Any points in a direction? :) -- PHP Database 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] Recent Influx of Unrelated Discussions
On Jul 16, 2010, at 10:47 AM, Paul M Foster wrote: On Fri, Jul 16, 2010 at 11:59:49AM +0200, Arno Kuhl wrote: And Daniel, your own gentle prods to keep things on track I think sets some of the professional tone of the list. This is very true. I've administered various lists for almost ten years, and I know for a fact that the list administrator plays a tremendous role in the tone of a list. So... By replying to this thread... Are we helping the problem or making it worse by adding to the off topic posts? :P Happy Friday yall! :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] There has to be a better way!!
Okay so I've been fighting with this for awhile now and haven't found a better way yet What I want to do, is I have a small portion of my website included into a template. It is displaying hosting plans so on the main site index.php I want it to display a little bit of text (Same as on the main hosting page) and just 1 random hosting plan. then if they click on that plan and go into the main hosting section, I want them to see ALL the hosting plans. Here's the code that I'm using: if($_SERVER['PHP_SELF'] = /index.php) { $sql = SELECT * FROM `hosting` ORDER BY RAND() LIMIT 1; }else{ $sql = SELECT * FROM `hosting` ORDER BY `hostingSort` ASC; } Now... I know there MUST be a better way to do it but I can't see the tree's through the forest. Any other way I could do it? I'm avoiding having lots of duplicate code/text on my pages. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] There has to be a better way!!
On Jul 10, 2010, at 12:03 PM, Ashley Sheridan wrote: On Sat, 2010-07-10 at 11:58 -0400, Jason Pruim wrote: Okay so I've been fighting with this for awhile now and haven't found a better way yet What I want to do, is I have a small portion of my website included into a template. It is displaying hosting plans so on the main site index.php I want it to display a little bit of text (Same as on the main hosting page) and just 1 random hosting plan. then if they click on that plan and go into the main hosting section, I want them to see ALL the hosting plans. Here's the code that I'm using: if($_SERVER['PHP_SELF'] = /index.php) { $sql = SELECT * FROM `hosting` ORDER BY RAND() LIMIT 1; }else{ $sql = SELECT * FROM `hosting` ORDER BY `hostingSort` ASC; } Now... I know there MUST be a better way to do it but I can't see the tree's through the forest. Any other way I could do it? I'm avoiding having lots of duplicate code/text on my pages. To avoid duplicating code, use an include file. If you already have some form of include (for a DB for example) then you can include your other includes in that. Also, not sure if it was a type in your email, but I think you want to use == in your if statement there, instead of = ;) Hey Ash, I may not have explained it properly :) I have 2 files... hosting.php and hostingsmall.php which have the EXACT same content in them other then the SQL statement. Hostingsmall.php has a LIMIT 1 at the end... What I want to do is be able to get rid of hostingsmall.php which is currently included on my main page and run it all off of hosting.php but still be able to limit the query at the front page... the $_SERVER['PHP_SELF'] seems to be doing the trick... Just wanted to find a better way since I've heard you should trust PHP_SELF... But if that's my best bet since it's working I can stick with it :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php