Re: [PHP] Re: Delaying $(document).ready() in jQuery until php script finish
Optimization also becomes a more manipulative, due to the stem point of your further language utilization. If you divide your languages, and disperse them through a C framework, you can utilize the languages in their refined form, and if any portion of an individual language gives optimization problems, you move that particular segment toward a more optimized C implementation. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Delaying $(document).ready() in jQuery until php script finish
On Sat, Mar 12, 2011 at 2:59 AM, Tommy Pham tommy...@gmail.com wrote: On Fri, Mar 11, 2011 at 11:39 PM, David Hutto smokefl...@gmail.com wrote: On Sat, Mar 12, 2011 at 2:34 AM, Tommy Pham tommy...@gmail.com wrote: On Fri, Mar 11, 2011 at 11:26 PM, David Hutto smokefl...@gmail.com wrote: On Sat, Mar 12, 2011 at 2:22 AM, Tommy Pham tommy...@gmail.com wrote: On Fri, Mar 11, 2011 at 10:34 PM, David Hutto smokefl...@gmail.com wrote: Although, right now, if I were going to be using all of those languages in unison(and I am), then I'd go with C, and spit them out to the browser for lower level control, as well as, to remain familiar with some of the main languages being used currently. But then how portable is your app? I'd have to refer to your reply: This would depend on the original application design code. If the original app is meant for specific hardware, and a specific company, then portability is null point. If that's the case why even bother with PHP? Why not just do it in C for pure speed? Speed wasn't the point- Multiple technology usage was the point. And if you're going to poise a browser for multiple intercepts(in terms of languages), then C *seems* to be the best was to move toward the displayment of it's descendants. If it's going to be a multi-language project, then it needs to be addressed with a multilanguage source to stem from, and C would seem like the optimum epicenter for propagation of this. I thought one of the major points of PHP is 'develop anywhere and deploy anywhere'. In the OP's case, where would C fit in when you have HTML, JS, and PHP - PHP would produce the resultant text in addtion to JS HTML. What would be the 'specific need' to do work in C where PHP, its many extensions and library (PECL PEAR), and lots of the other PHP code based libraries/frameworks out there already to do the job? The way I look at it, if too many languages are involved then most likely the application design is over complicated. Because you've been taught that C is over complicated in an optimization standpoint. Just to spit out the above in html/php/js/css in a C framework is simpler than you think. A little printf. And you speak of optimization, but lack the prethought for implementation for these optimizations. How can you move toward a lower level if you don't start on one. You seem stuck on the PHP portion of this, rather than the whole outlook of using multiple languages and technologies through a centralized means to accomplish a specific end, which can be easily optimized. SQL = back end data storage PHP = processing input/output, including back end data HTML/XML = document layout for nice hierarchical format JS/Flash = client side effects and processing to offload some server load Each already designed and made to do the the specific function and are nicely coupled together. From the above, I've yet to see the need to write C code for the PHP based application - with the exception of threads, and let's not get into it again... lol. It's not a 'hard coded' C, it's just a print to the page with C as the conveyor for each. You can then utilize C to partition each language for refinement in the overall. -- According to theoretical physics, the division of spatial intervals as the universe evolves gives rise to the fact that in another timeline, your interdimensional counterpart received helpful advice from me...so be eternally pleased for them. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Delaying $(document).ready() in jQuery until php script finish
On Sat, Mar 12, 2011 at 3:03 AM, Tommy Pham tommy...@gmail.com wrote: On Fri, Mar 11, 2011 at 11:59 PM, David Hutto smokefl...@gmail.com wrote: Optimization also becomes a more manipulative, due to the stem point of your further language utilization. If you divide your languages, and disperse them through a C framework, you can utilize the languages in their refined form, and if any portion of an individual language gives optimization problems, you move that particular segment toward a more optimized C implementation. Seems to me you're going in circle. Portability is null. Are you still stuck in developing for the masses? Because jobs are limited there. Development for corps requires development for specific hardware not a mass of consumers. Multi-language support and yet 'toward a more optimized C implementation'? Did you forget the term epicenter of an app/site? Going back to my previous question then, 'what's the point of PHP' in all of this when you're trying to achieve an optimized C application? PHP is just a portion of the ripple from C, which can got to php(e.g. echo html), and then js in the html, and css in the html, but either can be used in the html with interpolation of strings. Thhe C acts as the pivot point, intertwining the languages above. You can use each one individually. You could do this from a php standpoint/python/html/etc. C becomes the root and the others just branches and leaves woven together with %whatever. -- According to theoretical physics, the division of spatial intervals as the universe evolves gives rise to the fact that in another timeline, your interdimensional counterpart received helpful advice from me...so be eternally pleased for them. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Delaying $(document).ready() in jQuery until php script finish
On Sat, Mar 12, 2011 at 4:10 AM, Tommy Pham tommy...@gmail.com wrote: On Sat, Mar 12, 2011 at 12:06 AM, David Hutto smokefl...@gmail.com wrote: On Sat, Mar 12, 2011 at 2:59 AM, Tommy Pham tommy...@gmail.com wrote: On Fri, Mar 11, 2011 at 11:39 PM, David Hutto smokefl...@gmail.com wrote: On Sat, Mar 12, 2011 at 2:34 AM, Tommy Pham tommy...@gmail.com wrote: On Fri, Mar 11, 2011 at 11:26 PM, David Hutto smokefl...@gmail.com wrote: On Sat, Mar 12, 2011 at 2:22 AM, Tommy Pham tommy...@gmail.com wrote: On Fri, Mar 11, 2011 at 10:34 PM, David Hutto smokefl...@gmail.com wrote: Although, right now, if I were going to be using all of those languages in unison(and I am), then I'd go with C, and spit them out to the browser for lower level control, as well as, to remain familiar with some of the main languages being used currently. But then how portable is your app? I'd have to refer to your reply: This would depend on the original application design code. If the original app is meant for specific hardware, and a specific company, then portability is null point. If that's the case why even bother with PHP? Why not just do it in C for pure speed? Speed wasn't the point- Multiple technology usage was the point. And if you're going to poise a browser for multiple intercepts(in terms of languages), then C *seems* to be the best was to move toward the displayment of it's descendants. If it's going to be a multi-language project, then it needs to be addressed with a multilanguage source to stem from, and C would seem like the optimum epicenter for propagation of this. I thought one of the major points of PHP is 'develop anywhere and deploy anywhere'. In the OP's case, where would C fit in when you have HTML, JS, and PHP - PHP would produce the resultant text in addtion to JS HTML. What would be the 'specific need' to do work in C where PHP, its many extensions and library (PECL PEAR), and lots of the other PHP code based libraries/frameworks out there already to do the job? The way I look at it, if too many languages are involved then most likely the application design is over complicated. Because you've been taught that C is over complicated in an optimization standpoint. Just to spit out the above in html/php/js/css in a C framework is simpler than you think. A little printf. And you speak of optimization, but lack the prethought for implementation for these optimizations. How can you move toward a lower level if you don't start on one. You seem stuck on the PHP portion of this, rather than the whole outlook of using multiple languages and technologies through a centralized means to accomplish a specific end, which can be easily optimized. I thought the whole objective of higher level language is to provide an easier application design and coding, in addition to shorter development maintenance time. Why go back to lower level, isn't that defeating the purpose? That was the point of the term 'prototyping'. A language used to prototype, but built on a framework of optimization, in which the prototype language can be eliminated for the lower level performance bottlenecks. Just a case scenario. If C is included to 'to spit out the above in html/php/js/css' and should you happen to be out town/country on vacation, the other developer(s) doesn't know C and the application requires some minor bug fix or minor addition. The problem is now that modification required is in C. No, the problem lies in the error message, which lies in the underlying language. And familiarity with work is in properly commented and documented code. If the company isn't willing to maintain that throughout the course of development, then your misunderstanding is money out of their pocket. Do you want your vacation disturbed? For money, I comment and document, but disturbed isn't a problem, as long as it's a guaranteed under the contract. Except in the case of an emergency, I don't. :) But does the contract end at consumer misuse, or your discretion, and do they decide, or you? And then when does that end, when you're too important to respond, or had a better offer? Not to mention if where you're vacationing at have a fast internet connection, or even an internet connection at all. While this approach may mean job stability in this situation, I could see it opposite as it causes more down time for the business as being unable to adapt quickly to the ever changing needs required by the economy and/or customers/clients. In the end, if the business can't stay in business, you're out of a job. In one of my recent job experience, I was in a 3 person IT team. d You mean you and a few guys/gals got together, and threw together an app? We have a DBA, developer (also the manager), and I'm the system/network/telecom admin. You probably got a thesaurus, and small business guide to success too. We all have cross discipline experience and train
Re: [PHP] Re: Delaying $(document).ready() in jQuery until php script finish
probably so, but it it's just another discussion we should have just for evolutions sake. Each time it takes place, new info is added by someone. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Delaying $(document).ready() in jQuery until php script finish
On Sat, Mar 12, 2011 at 4:31 AM, Tommy Pham tommy...@gmail.com wrote: On Sat, Mar 12, 2011 at 12:22 AM, David Hutto smokefl...@gmail.com wrote: This isn't a C/PHP question, or optimization, it's a matter of PHP isn't always the center of attention, in terms of a development process. In each language there are advocates, and it's admirable, but ignorant in sight that what you're saying eliminates the rational, and logical thought that there are other languages that can be utilized as the center of development, and have higher level optimization in mind. If you use C, then as optimization, and software evolution occurs, you can move toward elimination the higher level prototyping languages, and move it toward the C (lower level)implementation. You start with just the spit out portion of C, and use the higher levels to prototype...then remove the higher level as you eliminate the inefficient portions, and replace with lower level, C, implementations of these higher level/platform dependent prototyped functions. Isn't this true for every other languages such Python, Perl, and Java? They were written in C at the core. If the language in use can't provide the functionality needed, then yes, I see the need for C. If using C just for optimization, then aren't selling yourself short for longer development and maintenance time when too many languages involved? Not C just for opto, but basic C for the later project utilization. It's just a quick spit out of the other languages which are interpolated to C string on the page. A simple C string with everything else you want in the higher level languages. But then you decide a few php results are slow, so you use a C function. Then you decide a few python functions are slow when returning a js mouseover, so you use a js or C function. It's just a simple platform to use the higher level 'prototype' languages on. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Delaying $(document).ready() in jQuery until php script finish
As I mentioned below, if PHP is sluggish, shouldn't it be brought up to the PHP developers instead? Why would you try include more complexity? I'm sure it has, it's called benchmarks. And they can't top C or Fortran, last I saw. But that is not the point. And did you not see my point about how it's just an initial usage of C to put out php and html/css/js, and that 'complexity' must be as simple as a printf function in another language. Why don't you snatch your nose out of php's asshole for a second to realize it's not the center of a multilanguage project, and sometimes neither is C, or any other language It's the consumers, or the designers, or yours. Just a case scenario. If C is included to 'to spit out the above in html/php/js/css' and should you happen to be out town/country on vacation, the other developer(s) doesn't know C and the application requires some minor bug fix or minor addition. The problem is now that modification required is in C. No, the problem lies in the error message, which lies in the underlying language. If you don't know step by step function programming, or debugging, then why are you arguing with me? And familiarity with work is in properly commented and documented code. If the company isn't willing to maintain that throughout the course of development, then your misunderstanding is money out of their pocket. Nah, just your clients, and that should have been accounted for in your project bid. Do you want your vacation disturbed? For money, I comment and document, but disturbed isn't a problem, as long as it's a guaranteed under the contract. Except in the case of an emergency, I don't. :) But does the contract end at consumer misuse, or your discretion, and do they decide, or you? And then when does that end, when you're too important to respond, or had a better offer? Not to mention if where you're vacationing at have a fast internet connection, or even an internet connection at all. While this approach may mean job stability in this situation, I could see it opposite as it causes more down time for the business as being unable to adapt quickly to the ever changing needs required by the economy and/or customers/clients. In the end, if the business can't stay in business, you're out of a job. In one of my recent job experience, I was in a 3 person IT team. d You mean you and a few guys/gals got together, and threw together an app? We have a DBA, developer (also the manager), and I'm the system/network/telecom admin. You probably got a thesaurus, and small business guide to success too. No, the DBA is needed because the amount of the data that our site handles for the customers specific to local region. The manager just happens to be a software developer. Did he tell you that, or provide credentials? That;s what most project heads do, I assume. We only wrote codes because we needed some functionality to improve efficiency of the site. Prior to writing the code, we had submitted a BRD to corporate for them to provide us that functionality. They said it's not necessary without further explanation. In the end, we all left the company because upper management didn't seem to be really business economic aware. Even the site manager left the company too. For me, when the CEO gives a presentation about outlook for the company, he said that 'we're still trying to figure out why the company didn't meet last year projections'. This was 6 months in the new fiscal year. I lost all respect for upper management. In all my job experiences, except that company, all of the upper management are very concerned about how on track is the company with the projections on a month by month basis. They all wanted daily, weekly, and monthly reports. That company didn't ask for any. We all have cross discipline experience and train ourselves in areas we lack for basic support. Not going to argue there, see my response from experience above. Every one of us don't have a problem taking a month vacation Vacation in IT is an oxymoron, and so is intellectual unavailability, especially with the current interconnectivity. Is it? In one of my job experience, a director once asked me why he didn't see any problems from my area. I simply told him that if he did, then I wasn't be doing my job. Maybe by 'problems' he meant other than what you think are problems. ANd maybe he thinks your job is to report maybe employee unhapiness, instead of employee misbehavior, maybe the miscommunication is in terminology of the word problem That being said. Doing your job means that you should still have a peace of mind to take a vacation or sleep better at night. But how does the client take peace of mind when you're unavailable? out of the country when the other 2 to provide 24/7 support for the facility. Folks at other sites worries even if they try to take 2 weeks vacation and that's not even
Re: [PHP] Re: Delaying $(document).ready() in jQuery until php script finish
Although, right now, if I were going to be using all of those languages in unison(and I am), then I'd go with C, and spit them out to the browser for lower level control, as well as, to remain familiar with some of the main languages being used currently. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Delaying $(document).ready() in jQuery until php script finish
On Sat, Mar 12, 2011 at 1:21 AM, Tommy Pham tommy...@gmail.com wrote: I think the OP is having both PHP JS codes mixed and scattered all over the page. If chunked-encoding used without any ob* implementation, then that's the problem he'll experience. Richard, I recommend to put the $(document).ready() and any JS scriptlets within body/body tags at the very bottom of the HTML document just right before /body. This would allow the mixed PHP/HTML to finish without creating problems for your JS code(s). Why not separate them all, i.e. js, php, html, and if it was in there, css. If you can use them all, then separating them out should be *easy*(I still would have to use references for that many languages). Think of it as an expository writing, with the includes being the main topics, the content being composed of these higher ideas, and the conclusion, just closing it out. Pick the focus, I'd say php, and echo the rest out. Or html, and include the php, css and js. The other solution is implement output buffer using ob* functions. Regards, Tommy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- According to theoretical physics, the division of spatial intervals as the universe evolves gives rise to the fact that in another timeline, your interdimensional counterpart received helpful advice from me...so be eternally pleased for them. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Delaying $(document).ready() in jQuery until php script finish
On Sat, Mar 12, 2011 at 2:22 AM, Tommy Pham tommy...@gmail.com wrote: On Fri, Mar 11, 2011 at 10:34 PM, David Hutto smokefl...@gmail.com wrote: Although, right now, if I were going to be using all of those languages in unison(and I am), then I'd go with C, and spit them out to the browser for lower level control, as well as, to remain familiar with some of the main languages being used currently. But then how portable is your app? I'd have to refer to your reply: This would depend on the original application design code. If the original app is meant for specific hardware, and a specific company, then portability is null point. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Delaying $(document).ready() in jQuery until php script finish
On Sat, Mar 12, 2011 at 2:34 AM, Tommy Pham tommy...@gmail.com wrote: On Fri, Mar 11, 2011 at 11:26 PM, David Hutto smokefl...@gmail.com wrote: On Sat, Mar 12, 2011 at 2:22 AM, Tommy Pham tommy...@gmail.com wrote: On Fri, Mar 11, 2011 at 10:34 PM, David Hutto smokefl...@gmail.com wrote: Although, right now, if I were going to be using all of those languages in unison(and I am), then I'd go with C, and spit them out to the browser for lower level control, as well as, to remain familiar with some of the main languages being used currently. But then how portable is your app? I'd have to refer to your reply: This would depend on the original application design code. If the original app is meant for specific hardware, and a specific company, then portability is null point. If that's the case why even bother with PHP? Why not just do it in C for pure speed? Speed wasn't the point- Multiple technology usage was the point. And if you're going to poise a browser for multiple intercepts(in terms of languages), then C *seems* to be the best was to move toward the displayment of it's descendants. If it's going to be a multi-language project, then it needs to be addressed with a multilanguage source to stem from, and C would seem like the optimum epicenter for propagation of this. I thought one of the major points of PHP is 'develop anywhere and deploy anywhere'. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $GLOBALS example script on php.net
On Sat, Mar 5, 2011 at 5:10 AM, Ashim Kapoor ashimkap...@gmail.com wrote: I'll remove it. How does one remove user notes from php.net ? I'd guest they had been granted access to the php.net page editor, but I may be wrong. Not that that site hasn't been scraped by other sites and added to their content, or been catalogued by google cache or alexis, etc. Thank you, Ashim -- According to theoretical physics, the division of spatial intervals as the universe evolves gives rise to the fact that in another timeline, your interdimensional counterpart received helpful advice from me...so be eternally pleased for them. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help! Made a boo-boo encrypting credit cards
Maybe I missed something here, but aren't the cc's held by the merchant account provider, and just an id by you to recharge(recurring or once), which can be disputed. I ask because it's been a while since I had to look at this. So let the OP's question take precedence, and mine secondary if necessary, if not then I'l move it to another post. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] very quick Regex query
On Mon, Feb 28, 2011 at 10:07 PM, Alexis phplis...@antonakis.co.uk wrote: Hi, I know not strictly a PHP question, but was just wondering if someone can tell me the regex format for something please. I need to replace .. with A good text editor should have find .. and replace with under the search menu. That is six periods replaced by eight hyphens. Many thanks Alexis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- According to theoretical physics, the division of spatial intervals as the universe evolves gives rise to the fact that in another timeline, your interdimensional counterpart received helpful advice from me...so be eternally pleased for them. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] very quick Regex query
On Tue, Mar 1, 2011 at 2:28 AM, David Hutto smokefl...@gmail.com wrote: On Mon, Feb 28, 2011 at 10:07 PM, Alexis phplis...@antonakis.co.uk wrote: Hi, I know not strictly a PHP question, but was just wondering if someone can tell me the regex format for something please. I need to replace .. with A good text editor should have find .. and replace with under the search menu. My bad, that was for editing,. That is six periods replaced by eight hyphens. Many thanks Alexis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- According to theoretical physics, the division of spatial intervals as the universe evolves gives rise to the fact that in another timeline, your interdimensional counterpart received helpful advice from me...so be eternally pleased for them. -- According to theoretical physics, the division of spatial intervals as the universe evolves gives rise to the fact that in another timeline, your interdimensional counterpart received helpful advice from me...so be eternally pleased for them. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] New to list and to PHP
On Sat, Feb 19, 2011 at 11:14 PM, David Robley robl...@aapt.net.au wrote: Daniel Brown wrote: On Fri, Feb 18, 2011 at 14:03, Pete Woodhead pete.woodhea...@gmail.com wrote: Hi I'm Pete Woodhead. I'm new to the list and to PHP. To be honest I very new to code writing. Thought this would be a good way to learn good habits as well as good code writing. Looking forward to learning and participating. Fantastic. As the new guy, you're expected to sweep the floors here each Tuesday and Saturday evening. Lesson one: buy a broom. A shovel might also be useful - Dan forgot to mention the stables... Cheers -- David Robley On a radiator repair shop: Best place to take a leak. Right next to the soldering station and the freon vat? Today is Sweetmorn, the 51st day of Chaos in the YOLD 3177. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- According to theoretical physics, the division of spatial intervals as the universe evolves gives rise to the fact that in another timeline, your interdimensional counterpart received helpful advice from me...so be eternally pleased for them. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] errors after upgrade vom 5.2.10 to 5.3.0 howto solve or hide?
On Wed, Feb 16, 2011 at 9:34 AM, Daniel P. Brown daniel.br...@parasane.net wrote: On Wed, Feb 16, 2011 at 07:15, Richard Quadling rquadl...@gmail.com wrote: On 16 February 2011 11:25, Andre Polykanine an...@oire.org wrote: Hello Fotoo, ? error_reporting(0); Really? You consider shoving your head in the sand a REALISTIC option? Well, at the least, it would shut the errors up in the meantime, pending an actual resolution. However, the use of short_open_tags may completely defeat the intended purpose. -- /Daniel P. Brown Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting (866-) 725-4321 http://www.parasane.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php What was the intended purpose again? -- According to theoretical physics, the division of spatial intervals as the universe evolves gives rise to the fact that in another timeline, your interdimensional counterpart received helpful advice from me...so be eternally pleased for them. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] errors after upgrade vom 5.2.10 to 5.3.0 howto solve or hide?
Only those who live in glass houses, should hide their errors. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] errors after upgrade vom 5.2.10 to 5.3.0 howto solve or hide?
On Wed, Feb 16, 2011 at 9:41 AM, David Hutto smokefl...@gmail.com wrote: Only those who live in glass houses, should hide their errors. if that makes sense. -- According to theoretical physics, the division of spatial intervals as the universe evolves gives rise to the fact that in another timeline, your interdimensional counterpart received helpful advice from me...so be eternally pleased for them. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Rate my (really) simple template class
On Mon, Feb 14, 2011 at 9:52 PM, Brian Waters brianmwat...@gmail.com wrote: So I decided to write a template class in order to get myself going on learning PHP. Of course I wrote the simplest thing possible: class Template { protected $template; protected $vars; public function __construct($template) { $this-template = $template; } public function __set($name, $value) { $this-vars[$name] = $value; } public function __get($name) { return $this-vars[$name]; } public function __toString() { ob_start(); eval('?' . $this-template); return ob_get_clean(); } } Which you can use, quite simply like this: $tpl = new Template(file_get_contents('index.tpl.php')); $tpl-title = 'Here\'s the title'; $tpl-text = 'Blah blah blah...'; echo $tpl; I have a few questions though. - First, I'm storing the template as an actual string, instead of just a path to a template file, which means I'm using eval() instead of require() in my __toString(). My thinking was that this would avoid reading the template file twice in the case that __toString() gets called multiple times. But will PHP handle this automagically if I do in fact decide to store a path to a file, and call require() instead? - Secondly, I noticed that in the constructor, it's not necessary to initialize $vars to an empty array, and I haven't done so. I guess PHP automatically initializes it the first time I set one of its elements to a value. Is this okay, or is there a better way in the name of best practices? - Finally, I'd like to be able to limit what things can be accessed from the scope of the template file. As it stands, if you have a function named blowUpTheComputer() or a gobal variable called $dontTouchThis, a template author can easily cause trouble. They can also access any methods and properties of the Template class. How would you go about restricting this? Thanks a lot! - BW -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Usually template comes after you've mastered the language, and know what to base the initial template on. So know what you're templating first. It's like trying to design a debugger for a language you don't know how to debug. Learn first, and debug,, template later, once you know what you're templating. -- According to theoretical physics, the division of spatial intervals as the universe evolves gives rise to the fact that in another timeline, your interdimensional counterpart received helpful advice from me...so be eternally pleased for them. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] curl_exec won't return (any data)
On Tue, Feb 8, 2011 at 7:24 AM, Tolas Anon tolas...@gmail.com wrote: Hi.. For a set of media import routines, i'm using a javascript-php_on_apache-windows.bat-php_cli-curl-php_script invocation method. It seems longwinded, but it's designed to have different parts of the import process run on different servers. I'm stuck at getting curl_exec() to return the data of the final php_script that does the importing. this is the part that hits my non professionals nerve.you want something to return data like a 'db' that does the 'final' importing'. Importing is more of python from my exp, and it is never done at the end, but at the beginning, so please explain why it's last that this is done. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] curl_exec won't return (any data)
On Tue, Feb 8, 2011 at 7:32 AM, David Hutto smokefl...@gmail.com wrote: On Tue, Feb 8, 2011 at 7:24 AM, Tolas Anon tolas...@gmail.com wrote: Hi.. For a set of media import routines, i'm using a javascript-php_on_apache-windows.bat-php_cli-curl-php_script invocation method. It seems longwinded, but it's designed to have different parts of the import process run on different servers. I'm stuck at getting curl_exec() to return the data of the final php_script that does the importing. this is the part that hits my non professionals nerve.you want something to return data like a 'db' that does the 'final' importing'. Importing is more of python from my exp, In php, t should be include, and again it should be initially. and it is never done at the end, but at the beginning, so please explain why it's last that this is done. -- According to theoretical physics, the division of spatial intervals as the universe evolves gives rise to the fact that in another timeline, your interdimensional counterpart received helpful advice from me...so be eternally pleased for them. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] curl_exec won't return (any data)
On Tue, Feb 8, 2011 at 7:35 AM, Ashley Sheridan a...@ashleysheridan.co.uk wrote: On Tue, 2011-02-08 at 13:24 +0100, Tolas Anon wrote: Hi.. For a set of media import routines, i'm using a javascript-php_on_apache-windows.bat-php_cli-curl-php_script invocation method. It seems longwinded, but it's designed to have different parts of the import process run on different servers. I'm stuck at getting curl_exec() to return the data of the final php_script that does the importing. The script itself runs fine, and i've recorded good details that curl_exec() is supposed to catch with file_put_contents(/some/debug.txt, json_encode($returnArray)), and from those debug-printouts it's just a few tiny steps towards a cascade of return statements, followed by a echo(json_encode($returnArray)) and a normal end to the php_script at the end of the call chain. However, curl_exec() seems to hang completely. I've added over a dozen debuginfo - file on server statements, and the one that should fire straight after curl_exec() does not fire. It does this only with large (1.8gb) video files, a smaller (60mb) video file doesn't produce this problem and the entire import routines work fine then. I'd very much appreciate any tips you might have for me. Let me see if I've got this right. The windows.bat is processing the media file somehow, then calling a php_cli script which makes a cURL call to another web-based PHP script? Is this right? The final script I assume is getting sent some info from the cURL call and is using it somehow (in a DB maybe?) before some sort of message back to your curl call. What is the code then doing with it after that? Other than placing it in the main php file(index.php), at the position you called it at, and at which it sits in precedence at? Because at the end, it is a part of the page being returned to the user. Thanks, Ash http://www.ashleysheridan.co.uk -- According to theoretical physics, the division of spatial intervals as the universe evolves gives rise to the fact that in another timeline, your interdimensional counterpart received helpful advice from me...so be eternally pleased for them. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Paging and permissions
On Tue, Feb 8, 2011 at 7:36 AM, Arno Kuhl ak...@telkomsa.net wrote: I'm hoping some clever php gurus have been here before and are willing to share some ideas. I have a site where articles are assigned to categories in containers. An article can be assigned to only one category per container, but one or more containers. Access permissions can be set per article, per category and/or per container, for one or more users and/or user groups. If an article is assigned to 10 categories and only one of those has a permission denying access, then the article can't be accessed even if browsing through one of the other 9 categories. Currently everything works fine, with article titles showing when browsing through category or search result lists, and a message is displayed when the article is clicked if it cannot be viewed because of a permission. Now there's a requirement to not display the article title in category lists and search results if it cannot be viewed. I'm stuck with how to determine the number of results for paging at the start of the list or search. The site is quite large (20,000+ articles and growing) so reading the entire result set and sifting through it with permission rules for each request is not an option. But it might be an option if done once at the start of each search or list request, and then use that temporary modified result set for subsequent requests on the same set. I thought of saving the set to a temporary db table or file (not sure about overhead of serializing/unserializing large arrays). A sizing exercise based on the recordset returned for searches and lists shows a max of about 150MB for 20,000 articles and 380MB for 50,000 articles that needs to be saved temporarily per search or list request - in the vast majority of cases the set will be *much* smaller but it needs to cope with the worst case, and still do so a year down the line. All this extra work because I can't simply get an accurate number of results for paging, because of permissions! So my questions are: 1. Which is better (performance) for this situation: file or db? have you timed it yourself? 2. How do I prepare a potentially very large data set for file or fast writing to a new table (ie I obviously don't want to write it record by record) Even the db's cant insert as fast as the function is presented to it, and it can respond, so again...timeit 3. Are there any other alternatives worth looking at? This is a question for the experienced php developers. But the above is applicable. TIA Cheers Arno -- According to theoretical physics, the division of spatial intervals as the universe evolves gives rise to the fact that in another timeline, your interdimensional counterpart received helpful advice from me...so be eternally pleased for them. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] curl_exec won't return (any data)
On Tue, Feb 8, 2011 at 8:02 AM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Tue, 2011-02-08 at 07:59 -0500, David Hutto wrote: it's : javascript - php_on_apache - windows.bat - php_cli - php_daemon_script - curl_exec - php_script followed by calls-until-finished from javascript that read the status of php_script via json files written to the server and thus display the status to the end-user.. 1: java event 2:java event calls a php function to apache. Java != Javascript Honestly, I've never used java enough to know the difference from the html/css/javascript/php mentality to notice there was a difference(Not that I don't now the difference, just misuse the term). Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] curl_exec won't return (any data)
On Tue, Feb 8, 2011 at 7:50 AM, Tolas Anon tolas...@gmail.com wrote: On Tue, Feb 8, 2011 at 1:35 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Tue, 2011-02-08 at 13:24 +0100, Tolas Anon wrote: Hi.. For a set of media import routines, i'm using a javascript-php_on_apache-windows.bat-php_cli-curl-php_script invocation method. It seems longwinded, but it's designed to have different parts of the import process run on different servers. I'm stuck at getting curl_exec() to return the data of the final php_script that does the importing. The script itself runs fine, and i've recorded good details that curl_exec() is supposed to catch with file_put_contents(/some/debug.txt, json_encode($returnArray)), and from those debug-printouts it's just a few tiny steps towards a cascade of return statements, followed by a echo(json_encode($returnArray)) and a normal end to the php_script at the end of the call chain. However, curl_exec() seems to hang completely. I've added over a dozen debuginfo - file on server statements, and the one that should fire straight after curl_exec() does not fire. It does this only with large (1.8gb) video files, a smaller (60mb) video file doesn't produce this problem and the entire import routines work fine then. I'd very much appreciate any tips you might have for me. Let me see if I've got this right. The windows.bat is processing the media file somehow, then calling a php_cli script which makes a cURL call to another web-based PHP script? Is this right? The final script I assume is getting sent some info from the cURL call and is using it somehow (in a DB maybe?) before some sort of message back to your curl call. What is the code then doing with it after that? Thanks, Ash http://www.ashleysheridan.co.uk oops, i missed a step (php_daemon_script) in the chain of calls; it's : javascript - php_on_apache - windows.bat - php_cli - php_daemon_script - curl_exec - php_script followed by calls-until-finished from javascript that read the status of php_script via json files written to the server and thus display the status to the end-user.. 1: java event 2:java event calls a php function to apache. 3: which calls a window.bat 4: calls a php command line 5. calls a php daemon, which is a 'waiting server process', listening on on a port. 6. you execute a command line statement 7. and it's for a php script to return something the windows.bat just starts up cli-php with admin privileges, which executes the php_daemon_script, which uses repetitive curl calls to the import-script (php_script at the end of my chain) that does all the work for a single item in the total upload/import queue; it does video conversion with exec(/path/to/ffmpeg), photo conversion with imagemagick, and updates the db with the php adodb library. php_script at the end of it's work returns a simple and short status array (json_encode()d) to the php_daemon_script via curl_exec, that dictates if the php_daemon_script should continue calling the (import) php_script more times. it's curl_exec that hangs/freezes, both with using CURLOPT_RETURNTRANSFER=1, or capturing output with ob_start() and ob_get_clean(). i've gathered that much from my custom debug logs. What do you have at the beginning, and what do you want at the end of this process. Break it down into simple steps. And then not only can any php programmer help you, but any computer scientist can help you utilize the control flow logic. -- According to theoretical physics, the division of spatial intervals as the universe evolves gives rise to the fact that in another timeline, your interdimensional counterpart received helpful advice from me...so be eternally pleased for them. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Secure monetary transactions
On Tue, Feb 8, 2011 at 8:29 AM, Bob McConnell r...@cbord.com wrote: From: Paul M Foster I'm certain people on this list have set up this type of system for customers. So I have some questions: 1) Does the usual online store software (osCommerce or whatever) include secure pages for acceptance of credit cards? I know they have the capability to pass this info securely off to places like authorize.net for processing. 2) Assuming a customer website, probably hosted in a shared hosting environment, with appropriate ecommerce store software, how does one deal with PCI compliance? I mean, the customer would have no control over the data center where the site is hosted. Moreover, they would probably have little control over the updating of insecure software, as demanded by PCI. They likely don't have the facilities to do the type of penetration testing PCI wants. So how could they (or how do you) deal with the potentially hundreds of questions the PCI questionnaire asks about all this stuff? How do you, as a programmer doing this for a customer, handle this? 1) No. 2) PCI compliance is neither simple nor cheap. If you have not done it before, hire a consultant that has and have them train you. You will also need annual refresher courses and a good auditor to validate your site every month. You will need to change data centers, as you need one that is PCI compliant for the pages that will handle protected information. There are requirements for physical security of those servers as well as the software that runs on them. You also have a choice of maintaining your own servers or finding a managed hosting service that will maintain them for you. One of the requirements is that you must maintain separate servers for development and testing. You also need to establish a formal development, test and deployment process. The developers are not allowed to have any access to the production servers. We have four sets, development, QA test, User Acceptance Test and production. The latter two are exposed to the Internet, while the first two are internal only. We have several sites that are now PCI compliant. It took us eight months after the decision to get the first one online and certified. Most of that was training and waiting for the audits and certification, as we nearly passed the initial validation on the first try. But we had to change hosting providers twice to find one that we were comfortable with. After that is all said and done, keep in mind that the primary purpose of the PCI requirements is to mitigate the financial liability of the credit card issuers. If anything goes wrong at your end that exposes privileged data, you will be financially responsible for the damages. So make sure you go above and beyond those requirements to protect yourself. Bob McConnell 1. The client is responsible for the procurement of the hardware, and software they want used. 2. Programmers are to live in a secure environment where reliable technologies are introduced in order for them to develop with. 3. The client is always right, so they're always to blame as well, according to their own procured wisdom. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- According to theoretical physics, the division of spatial intervals as the universe evolves gives rise to the fact that in another timeline, your interdimensional counterpart received helpful advice from me...so be eternally pleased for them. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] curl_exec won't return (any data)
On Tue, Feb 8, 2011 at 3:47 PM, Tolas Anon tolas...@gmail.com wrote: On Tue, Feb 8, 2011 at 9:33 PM, Steve Staples sstap...@mnsi.net wrote: i've been sorta reading this (as I am sure most maybe stopped after the 4th consecutive post)... yea, i feel i gotta be complete so as to not waste the time of people who do wanna help. Personally, I feel that if you want to have a conversation that pertains to the usefulness of the language, and therefore promote it's 'consumer' benefits, and branding, it's a necessity to relate it to the language, and solve the OP's problem programatically utilizing the language itself. but what I am wondering is... why can't you just write the output of the what you're doing to a file, or the db, and then query along the way or when you need/want some information on it?? Maybe i just haven't quite figured out, or got the gist of what you are trying to accomplish... That's exactly what i'm doing. I need curl_exec() to absorb the response to requests that take over 1hr to complete, because i want to be able to run different parts of the media import process on different servers. it also seems to me, that this really isn't a PHP specific issue, so all the posts that you're doing, really doesn't pertain to the PHP mailing list, so (and sorry to say this) maybe stop posting all the incremental updates you're doing, and when there is a major break through, or someone has an idea on how to help solve your issue, update us. Steve. I wish to have a complete log of this bughunt somewhere online, one of the many websites with the php mailing list content will do nicely. I suppose i could've chosen to subscribe to the libcurl mailinglist, but this seemed a good place because i thought to find many people that use libcurl in different ways here. And at the start it could've been the php-cli, or the apache, or the lib-curl, i just didn't know. Even though lib-curl atm looks the more likely suspect, i'll continue this log here. If you don't like it, don't read it. With a decent mail reader it is shoved under 1 header anyways. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- According to theoretical physics, the division of spatial intervals as the universe evolves gives rise to the fact that in another timeline, your interdimensional counterpart received helpful advice from me...so be eternally pleased for them. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] curl_exec won't return (any data)
On Tue, Feb 8, 2011 at 5:05 PM, Tolas Anon tolas...@gmail.com wrote: The one thing that strikes me as odd, before i go, is that i saw no actual HTTP-KEEPALIVE traffic flowing... I might have missed it, but i don't think so.. Welcome to programming. on /off true /false. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- According to theoretical physics, the division of spatial intervals as the universe evolves gives rise to the fact that in another timeline, your interdimensional counterpart received helpful advice from me...so be eternally pleased for them. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Bilingual strtotime()
Either form should be day/month/year/time, or somewhere in that order. From what i know, it shouldn't change much no matter the language. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Bilingual strtotime()
Just check for the initial difference you see in the formats of either. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pulling from Multiple Databases
Do you even NEED a footer with nothing but inane comments in it? It's probably an overcompensation for a small penis. Alexis On 01/02/11 11:54, David Hutto wrote: I'd pass the db's to a threaded function that processes each db's info in an algorithmic order. -- The lawyer in me says argue...even if you're wrong. The scientist in me... says shut up, listen, and then argue. But the lawyer won on appeal, so now I have to argue due to a court order. Furthermore, if you could be a scientific celebrity, would you want einstein sitting around with you on saturday morning, while you're sitting in your undies, watching Underdog?...Or better yet, would Einstein want you to violate his Underdog time? Can you imagine Einstein sitting around in his underware? Thinking about the relativity between his pubic nardsac, and his Fruit of the Looms, while knocking a few Dorito's crumbs off his inner brilliant white thighs, and hailing E = mc**2, and licking the orangy, delicious, Doritoey crust that layered his genetically rippled fingertips? But then again, J. Edgar Hoover would want his pantyhose intertwined within the equation. However, I digress, momentarily. But Einstein gave freely, for humanity, not for gain, other than personal freedom. An equation that benefited all, and yet gain is a personal product. Also, if you can answer it, is gravity anymore than interplanetary static cling? -- 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 -- The lawyer in me says argue...even if you're wrong. The scientist in me... says shut up, listen, and then argue. But the lawyer won on appeal, so now I have to argue due to a court order. Furthermore, if you could be a scientific celebrity, would you want einstein sitting around with you on saturday morning, while you're sitting in your undies, watching Underdog?...Or better yet, would Einstein want you to violate his Underdog time? Can you imagine Einstein sitting around in his underware? Thinking about the relativity between his pubic nardsac, and his Fruit of the Looms, while knocking a few Dorito's crumbs off his inner brilliant white thighs, and hailing E = mc**2, and licking the orangy, delicious, Doritoey crust that layered his genetically rippled fingertips? But then again, J. Edgar Hoover would want his pantyhose intertwined within the equation. However, I digress, momentarily. But Einstein gave freely, for humanity, not for gain, other than personal freedom. An equation that benefited all, and yet gain is a personal product. Also, if you can answer it, is gravity anymore than interplanetary static cling? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] nl2br problem
If project names are indications of programmer's Freudian insights, then what is the FCKEditor? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Organisational question: surely someone has implemented many Boolean values (tags) and a solution exist
Pseudo = Design Algorithm Design Algorithm = Actual Code Actual Code = Alterable db tables Alterable db tables = manipulated data through the app interface with data -- The lawyer in me says argue...even if you're wrong. The scientist in me... says shut up, listen, and then argue. But the lawyer won on appeal, so now I have to argue due to a court order. Furthermore, if you could be a scientific celebrity, would you want einstein sitting around with you on saturday morning, while you're sitting in your undies, watching Underdog?...Or better yet, would Einstein want you to violate his Underdog time? Can you imagine Einstein sitting around in his underware? Thinking about the relativity between his pubic nardsac, and his Fruit of the Looms, while knocking a few Dorito's crumbs off his inner brilliant white thighs, and hailing E = mc**2, and licking the orangy, delicious, Doritoey crust that layered his genetically rippled fingertips? But then again, J. Edgar Hoover would want his pantyhose intertwined within the equation. However, I digress, momentarily. But Einstein gave freely, for humanity, not for gain, other than personal freedom. An equation that benefited all, and yet gain is a personal product. Also, if you can answer it, is gravity anymore than interplanetary static cling? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Organisational question: surely someone has implemented many Boolean values (tags) and a solution exist
Is this a troll? Am I about to be baited? Baited to deploy what is designed to the consumer's specification? Surely. From what is wanted to what is needed. Troll on that. -- Dotan Cohen http://gibberish.co.il http://what-is-what.com -- The lawyer in me says argue...even if you're wrong. The scientist in me... says shut up, listen, and then argue. But the lawyer won on appeal, so now I have to argue due to a court order. Furthermore, if you could be a scientific celebrity, would you want einstein sitting around with you on saturday morning, while you're sitting in your undies, watching Underdog?...Or better yet, would Einstein want you to violate his Underdog time? Can you imagine Einstein sitting around in his underware? Thinking about the relativity between his pubic nardsac, and his Fruit of the Looms, while knocking a few Dorito's crumbs off his inner brilliant white thighs, and hailing E = mc**2, and licking the orangy, delicious, Doritoey crust that layered his genetically rippled fingertips? But then again, J. Edgar Hoover would want his pantyhose intertwined within the equation. However, I digress, momentarily. But Einstein gave freely, for humanity, not for gain, other than personal freedom. An equation that benefited all, and yet gain is a personal product. Also, if you can answer it, is gravity anymore than interplanetary static cling? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Organisational question: surely someone has implemented many Boolean values (tags) and a solution exist
On Thu, Jan 20, 2011 at 2:26 PM, Dotan Cohen dotanco...@gmail.com wrote: On Thu, Jan 20, 2011 at 21:24, David Hutto smokefl...@gmail.com wrote: Is this a troll? Am I about to be baited? Baited to deploy what is designed to the consumer's specification? Surely. From what is wanted to what is needed. Troll on that. Actually, I'm the customer! But assuming that a customer exists, that implies compensation, and therefore fair bait. Then that's different altogether. you get to decide what information is displayed, and what information is 'sensed', and on what platform. What do you want to sense and what do you want to display(not to say I'm an expert, but I like to think in CS)? -- Dotan Cohen http://gibberish.co.il http://what-is-what.com -- The lawyer in me says argue...even if you're wrong. The scientist in me... says shut up, listen, and then argue. But the lawyer won on appeal, so now I have to argue due to a court order. Furthermore, if you could be a scientific celebrity, would you want einstein sitting around with you on saturday morning, while you're sitting in your undies, watching Underdog?...Or better yet, would Einstein want you to violate his Underdog time? Can you imagine Einstein sitting around in his underware? Thinking about the relativity between his pubic nardsac, and his Fruit of the Looms, while knocking a few Dorito's crumbs off his inner brilliant white thighs, and hailing E = mc**2, and licking the orangy, delicious, Doritoey crust that layered his genetically rippled fingertips? But then again, J. Edgar Hoover would want his pantyhose intertwined within the equation. However, I digress, momentarily. But Einstein gave freely, for humanity, not for gain, other than personal freedom. An equation that benefited all, and yet gain is a personal product. Also, if you can answer it, is gravity anymore than interplanetary static cling? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RE: Organisational question: surely someone has implemented many Boolean values (tags) and a solution exist
On Thu, Jan 20, 2011 at 2:40 PM, Jerry Schwartz je...@gii.co.jp wrote: -Original Message- From: Dotan Cohen [mailto:dotanco...@gmail.com] Sent: Thursday, January 20, 2011 11:25 AM To: Jerry Schwartz Cc: mysql.; php-general. Subject: Re: Organisational question: surely someone has implemented many Boolean values (tags) and a solution exist As for setting up a hierarchy, that's trickier. One way to handle that is to work like libraries do: 10 is fiction, 10.05 is crime novels, 10.05.07 is British authors, and so forth. Your `tags` table then looks like Thanks. I prefer the parent tag field, though, I feel that it is more flexible. [JS] I disagree. The method I proposed can be extended to any depth, and any leaf or branch can be retrieved with a single query. No one argues with method of implementation(not that i explored the individual ideas), but with that available, you can hierarchy the concept of your db conceptualization. Regards, Jerry Schwartz Global Information Incorporated 195 Farmington Ave. Farmington, CT 06032 860.674.8796 / FAX: 860.674.8341 E-mail: je...@gii.co.jp Web site: www.the-infoshop.com -- Dotan Cohen http://gibberish.co.il http://what-is-what.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- The lawyer in me says argue...even if you're wrong. The scientist in me... says shut up, listen, and then argue. But the lawyer won on appeal, so now I have to argue due to a court order. Furthermore, if you could be a scientific celebrity, would you want einstein sitting around with you on saturday morning, while you're sitting in your undies, watching Underdog?...Or better yet, would Einstein want you to violate his Underdog time? Can you imagine Einstein sitting around in his underware? Thinking about the relativity between his pubic nardsac, and his Fruit of the Looms, while knocking a few Dorito's crumbs off his inner brilliant white thighs, and hailing E = mc**2, and licking the orangy, delicious, Doritoey crust that layered his genetically rippled fingertips? But then again, J. Edgar Hoover would want his pantyhose intertwined within the equation. However, I digress, momentarily. But Einstein gave freely, for humanity, not for gain, other than personal freedom. An equation that benefited all, and yet gain is a personal product. Also, if you can answer it, is gravity anymore than interplanetary static cling? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] switch case madness
. I do see from where it is you're coming, though, Josh --- once you've gotten the fundamentals, a lot of times it's easier - sometimes even a better idea - to use an existing, mature solution. What helps you to determine its value from a code standpoint? Your existing experience. -- /Daniel P. Brown Network Infrastructure Manager Documentation, Webmaster Teams http://www.php.net/ You are correct, and it is a shame to see many developers fall into the copy / paste realm, especially with a language like PHP where such snippets are often found easily but of dubious quality. Rolling your own is a great way to understand how things work (or should work) internally, as well as giving you valuable practice. I don't mean to discredit is. As I mentioned, more often then not I'm a fan of it. Regards, -Josh Joshua Kehn | josh.k...@gmail.com http://joshuakehn.com I find that at first, in any language, playing with the snippets through a form of stimuli and response(I move this, this happens, or doesn;t), helps to reinforce what I'm learning. But after understanding the snippet, I don't find that reapplying it later subverts the concept of being a 'real coder', because in the end you want to move to a more efficient means of coding, which is, if I'm not mistaken, where these larger frameworks come from-snippets that are reusable(all the way down to a login system snippet). -- It sure does get lonely up under this bridge. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] email address syntax checker
On Wed, Jan 19, 2011 at 11:14 PM, Donovan Brooke li...@euca.us wrote: Hi Guys, I'm waddling my way through database interaction and thought someone on the list may already have a simple email checker that they'd like to share... you know, looking for the @ char and dots etc.. I did a quick search of the archives and found a couple elaborate things.. but I'm looking for something simple. Simple is an irrelevant term, you'd have to elaborate on your current experience. This job will have trusted users and the checker is more to help them catch mistakes when registering. Thanks!, Donovan -- D Brooke -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- The lawyer in me says argue...even if you're wrong. The scientist in me... says shut up, listen, and then argue. But the lawyer won on appeal, so now I have to argue due to a court order. Furthermore, if you could be a scientific celebrity, would you want einstein sitting around with you on saturday morning, while you're sitting in your undies, watching Underdog?...Or better yet, would Einstein want you to violate his Underdog time? Can you imagine Einstein sitting around in his underware? Thinking about the relativity between his cotton nardsac, and his Fruit of the Looms? But then again, J. Edgar Hoover would want his pantyhose intertwined within the equation. However, I digress, momentarily. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: email list 101
On Sun, Jan 16, 2011 at 10:43 AM, Peter Lind peter.e.l...@gmail.com wrote: On 16 January 2011 16:35, Michelle Konzack linux4miche...@tamay-dogan.net wrote: Hello Kirk Bailey, Am 2011-01-16 10:09:03, hacktest Du folgendes herunter: So, in php, I want a program to handle sending out a mail list. All this is going to do is be a filter to exclude non subscribers, and send a copy to every person in the subscriber file. This is pretty simple in python, but this is not my mother tounge we speak here, so let's talk in php instead. If the submission does not come from a member, the script simply aborts. So the script should read the subscriber file, and if the source From: does not appear there, DIE. If it is there, walk the array and send a copy there, then end. Now how to do this in php? Is there an off the shelf solution? Maybe using RTFW http://www.php.net/ Considering that you've used the PHP list for some very inane questions yourself, perhaps you should keep the tone lighter and avoid flaming people? Just a thought. But hypocrisy is so fun though. Regards Peter -- hype WWW: plphp.dk / plind.dk LinkedIn: plind BeWelcome/Couchsurfing: Fake51 Twitter: kafe15 /hype -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Think outside the sphere...O -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] which php file is sending emails?
On Sun, Jan 16, 2011 at 11:19 AM, Mujtaba Arshad mujtab...@gmail.com wrote: Nilesh's note to self: don't sound condescending when suggesting untested Now define 'self'. Is it a remembrance(i.e. a string of molecular structures), or a google(google 'Rich formatting' says google isn't actually a word, and gives the squiggly red underlining for it's own name) search through the archives? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] which php file is sending emails?
On Sat, Jan 15, 2011 at 10:32 PM, Nilesh Govindarajan nil...@itech7.com wrote: On 01/16/2011 12:45 AM, Daniel Brown wrote: On Sat, Jan 15, 2011 at 13:51, Nilesh Govindarajannil...@itech7.com wrote: hahaha, that command wasn't broken. It works on Linux. But certain commands have to be changed to work on *BSD. For example, chmod u=rwx,g=rwx,o= directory -R will work on linux, but will not on FreeBSD. It has to be changed to chmod -R u=rwx,g=rwx,o= directory. Oh, I get it. So you deliberately give bad commands to people to teach them differences. I mean, you know the difference, and the OP did mention that he's using FreeBSD, so that must be the only explanation, right? And yes, I know it works on Linux. I'm just messing with you. ;-P Okay now this is turning into a war :D We're deviating from the original topic. Anyways, I'm not a regular *BSD user :D So some commands may be broken :D :D -- Regards, Nilesh Govindarajan Facebook: http://www.facebook.com/nilesh.gr Twitter: http://twitter.com/nileshgr Website: http://www.itech7.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php And the computational atheist's have a religion. -- Sometimes...my mama...says I get over excited about technology. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array Symbol Suggestion
On Thu, Jan 13, 2011 at 12:59 PM, David Harkness davi...@highgearmedia.com wrote: On Thu, Jan 13, 2011 at 2:23 AM, Richard Quadling rquadl...@gmail.comwrote: The Hungarian Notation [1] was what I was taught all those years ago when I learnt standard C programming. I learned it early on as well, and I never really liked it. Instead of $iFish I would prefer a more descriptive name such as $fishCount. What info did you get on hook for the client? Sure, it's a little longer to type, but it tells you what that number measures. In today's world of objects and loosely-typed languages, a descriptive variable name can be more important than a symbol or notation to hint at the type. As for arrays, I always name the variable plural. And if it maps keys to values instead of holding a list of items, I will typically name it $foosByBar, e.g. $customersById. From that name I *know* it's array already--no need for a prefix or special symbol. $oPlayer, $sName, $iWidth...what's the point? The context in which the variable is used can provide more meaning. If you stick to short functions/methods that do one specific thing, you'll be able to tell that $player is an object, $name is a string, and $width is an integer. I highly recommend the book Clean Code: A Handbook of Agile Software Craftsmanship by Robert C. Martin. [1] It has a lot of great advice on keeping your code easy to understand, test, and maintain. David [1] http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882 -- Sometimes...my mama...says I get over excited about technology. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] curl rtmp
On Sun, Jan 9, 2011 at 2:58 PM, Tontonq Tontonq root...@gmail.com wrote: does cUrl supports rtmp protocol? if so is there any example? These are obvious by searching for the terms, which seem to be quite specific to have not found an answer in the search engines. do we need enable different library? so if not can we save rtmp by curl? if not is there any other rtmp downloader that u know ? You seem to know enough to have answered this by yourself, almost in your own questions. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Command line PHP
Like i said, my introduction to php is browser,and desktop app is python, but I will try php in the command line out. 1) set a variable 2) call an external program with the variable as an argument this is something I recognize very well:) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Command line PHP
I'm with some of the others above on using Python. Writing a command line app is about as simple as: import subprocess word = 'hello' self.espeak = subprocess.Popen(['espeak', word], stdout = subprocess.PIPE).communicate()[0] I think of PHP as more browser, than desktop app/webapp. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie Question
On Fri, Jan 7, 2011 at 2:33 PM, tedd tedd.sperl...@gmail.com wrote: At 2:16 AM -0500 1/7/11, Daniel Brown wrote: On Thu, Jan 6, 2011 at 23:09, Bill Guion bgu...@comcast.net wrote: Fogging must be a REAL OLD Fashioned term. Please clarify. It was originally written before man invented the letter 'L', Bill. No, it was the predecessor to water-boarding. Only in cultural america. In other countries, it's still used as a public display of punishment and humiliation. And humiliation is beneficial to no one. And spankings never did me any good anyways:) Cheers, tedd -- --- 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] Command line PHP
There have been a lot of responses, but this might be the best place to start: http://www.google.com/search?client=ubuntuchannel=fsq=command+line+PHP+application.ie=utf-8oe=utf-8 Which yielded this as the first result: http://php.net/manual/en/features.commandline.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Command line PHP
I could go yoda, but suffice it to say, From The Language Speaks The Soul Of The Man's Design. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Printing PDF
On Wed, Dec 29, 2010 at 3:13 PM, Steve Staples sstap...@mnsi.net wrote: On Wed, 2010-12-29 at 17:36 +, Richard Quadling wrote: On 29 December 2010 17:24, Steve Staples sstap...@mnsi.net wrote: I can create the PDF's no problem, it is just how to send the created pdf to the printer to print (it is a label printer, printing 3x5 labels) What type of printer? Some printers require their own language and won't have any sort of PS, PCL, Esc/2 or GDI support. I've worked with industrial printers which take strings of plain text to do page layout/description. You load template layouts into the printer and can use them. Completely useless under normal circumstances. If the printer is something like an Epson TM-L90 (thermal label printer with barcode support), then sending it a PDF isn't possible as it doesn't have PS support. It is much easier to send it the string of codes to have the barcode generated within the label. On Windows, the drivers deal with all of this stuff. I've no idea on Unix. The exact model of the printer would help. I am currently unaware of the printer model, I am mostly working at building a quote for them. Welcome to being a software developer. I suppose I should get the make/models of what they are going to be using... and hope to hell that they are compatible. I do know that the printer has a custom formatted label, so I hope that there is some drivers or wahtever availble to linux that i can send the PDF to it to print... looks like this will be some trial and error (err... research and development?). The printing is the only real trivial part of the whole thing. . -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Do you trim() usernames and passwords?
On Tue, Dec 28, 2010 at 11:51 PM, Paul M Foster pa...@quillandmouse.com wrote: On Tue, Dec 28, 2010 at 11:28:12PM -0500, Joshua Kehn wrote: On Dec 28, 2010, at 6:28 PM, Paul M Foster wrote: On Tue, Dec 28, 2010 at 03:11:56PM -0500, Joshua Kehn wrote: Specifically: Dotan Cohen wrote: I seem to have an issue with users who copy-paste their usernames and passwords coping and pasting leading and trailing space characters. Users should not be copy-pasting passwords or usernames. Do not compromise a system to cater to bad [stupid, ignorant, you pick] users. If this is an issue then educate the users. Wrong. I use a program called pwgen to generate passwords for me, which I cannot remember. I use another program I built to store them in an encrypted file. When I have to supply a password which I've forgotten (as usual), I fire up my password vault, find the password, and paste it wherever it's needed. Users would be wise to follow a scheme like this, rather than using their dog's name or somesuch as their passwords. Paul -- Paul M. Foster http://noferblatz.com What is wrong? That users should not be copy-pasting passwords or don't compromise the system? I agree that users should not use weak passwords, but not everyone goes everywhere with a vault. I am more then capable of memorizing 20 or so 16-32 character full set passwords. And so you assume everyone can do that? I can remember maybe 5 of the passwords I regularly need. (I rarely repeat passwords for different sites.) In addition, some passwords have been *assigned* to me and cannot readily be changed (and are usually difficult to remember). Many of the rest I so seldom use that it would be silly to try to remember them. Particularly when I do have a password-locked file I can use to record them for me. Under the circumstances I described, I have yet to hear in what way copying and pasting passwords compromises security of anything by itself. Please enlighten me. Correct me if I'm wrong, but If you initially type the username and password into a file, and you have, in my paranoid scenario, a keylogger you don't know about, it get's logged, but also, i assume it would get logged if you typed it in as well, on the site, or that someone could lift the password if given the authority on your system, correct? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Do you trim() usernames and passwords?
It would seem that with in the streaming of information that moves across networks, that such things as virus detection within these networks(meaning governmental oversite of info...post 9/11), which, if I'm not mistaken is regexing for matching strings of definitions, are checked for as they stream through systems, leaving mainly encrypted versions for release. That way, even if they don't stop it, and watch it propagate(to see what it does), then they still know you weren't a part of it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with Include
On Tue, Dec 21, 2010 at 2:48 AM, Ravi Gehlot r...@ravigehlot.net wrote: My point is that you tried to Not me personally. take code from one page and put it all organized in another page and the include that page of includes back into the pages that you want it to feed off from. If stuff works the way that it does then there a reason for it to have been done that way. By the original designer, but maybe not the OP. That's why documenting code is so important. 99% doesn't do it (including me). For you, others, and for self, it's more than important, it can be essential, especially if you're trying to keep up with multiple languages, OS's, and platforms. Ravi. On Tue, Dec 21, 2010 at 2:35 AM, David Hutto smokefl...@gmail.com wrote: On Tue, Dec 21, 2010 at 2:29 AM, Ravi Gehlot r...@ravigehlot.net wrote: Why mess with something that is already working? If you are trying to make it pretty then you are not solving a problem. You are creating one. Define working. I've had programs 'work', but more experienced would say it's flawed in some respect. Does it perform the immediate task? Now define pretty. Is it aesthetically pleasing to you, or to someone else with less, or maybe more experience. By defining the two above, you then define whether it's a problem. To you, or to them, or to the original designer? Ravi. On Mon, Dec 20, 2010 at 7:40 AM, Daniel P. Brown daniel.br...@parasane.netwrote: On Mon, Dec 20, 2010 at 02:49, Simcha Younger sim...@syounger.com wrote: Since it is being included by PHP, and not served by Apache, the extension is not important. Correct, but keep in mind that it will likely be served as plain text if accessed directly, if the web server is not properly configured (which, by default, it isn't). -- /Daniel P. Brown Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting (866-) 725-4321 http://www.parasane.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- They're installing the breathalyzer on my email account next week. -- They're installing the breathalyzer on my email account next week. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with Include
On Tue, Dec 21, 2010 at 9:50 AM, Daniel P. Brown daniel.br...@parasane.net wrote: On Tue, Dec 21, 2010 at 02:48, Ravi Gehlot r...@ravigehlot.net wrote: My point is that you tried to take code from one page and put it all organized in another page and the include that page of includes back into the pages that you want it to feed off from. If stuff works the way that it does then there a reason for it to have been done that way. So you think no one should ever do that because it's only making it look pretty? Ever hear of maintainability? That's why documenting code is so important. 99% doesn't do it (including me). Please cite your source. Personally, I'd even have to admit mine was less than 99% compatible with what I'd like it to be. -- /Daniel P. Brown Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting (866-) 725-4321 http://www.parasane.net/ -- They're installing the breathalyzer on my email account next week. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with Include
On Tue, Dec 21, 2010 at 9:54 AM, David Hutto smokefl...@gmail.com wrote: On Tue, Dec 21, 2010 at 9:50 AM, Daniel P. Brown daniel.br...@parasane.net wrote: On Tue, Dec 21, 2010 at 02:48, Ravi Gehlot r...@ravigehlot.net wrote: My point is that you tried to take code from one page and put it all organized in another page and the include that page of includes back into the pages that you want it to feed off from. If stuff works the way that it does then there a reason for it to have been done that way. So you think no one should ever do that because it's only making it look pretty? Ever hear of maintainability? That's why documenting code is so important. 99% doesn't do it (including me). Please cite your source. Personally, I'd even have to admit mine was(and is) less than 99% compatible with what I'd like it to be. -- /Daniel P. Brown Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting (866-) 725-4321 http://www.parasane.net/ -- They're installing the breathalyzer on my email account next week. -- They're installing the breathalyzer on my email account next week. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-DB] Re: [PHP] Problems w/ goto
On Mon, Dec 20, 2010 at 7:37 AM, Daniel Brown danbr...@php.net wrote: On Sat, Dec 18, 2010 at 17:02, David Hutto smokefl...@gmail.com wrote: or maybe it's saturday morning and i'm drunk? This seems to be the most likely, and considering how all messages are permanently and independently archived and propagate throughout the Internet, it might be a good reason not to go nuts in sending unrelated and unintelligible messages of this nature in the future. Yeah, that hindsights 20/20 ain't it? -- /Daniel P. Brown Network Infrastructure Manager Documentation, Webmaster Teams http://www.php.net/ -- They're installing the breathalyzer on my email account next week. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems w/ goto
On Mon, Dec 20, 2010 at 4:47 PM, David Harkness davi...@highgearmedia.com wrote: On Fri, Dec 17, 2010 at 10:05 AM, la...@garfieldtech.com la...@garfieldtech.com wrote: What PHP has implemented is named break statements, as I understand it. Not exactly. You can jump to arbitrary (labeled) lines within the same context (method/function), but you cannot enter loop constructs--only exit them. While the last bit implies they are only named break statements, you can use them outside of loops as a normal goto statement. firingSequence: if (!acquireTarget()) goto done; fireMainCannon(); fireMissiles(); if (enemiesInView()): goto firingSequence; done: The above implements a convoluted do...while loop using goto. Recommended? Is the problem with using the goto convolutedness(as I've seen other senior programmers in other languages when explaining, or 'showing off'), or is their an actual functional problem with it? Is it just the 'sphagetti code' aspect that it can lead to, meaning confusing another programmer? Not to hijack from the op, or dilute the conversation any further than I did over the weekend. Certainly not! David -- They're installing the breathalyzer on my email account next week. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with Include
On Tue, Dec 21, 2010 at 2:29 AM, Ravi Gehlot r...@ravigehlot.net wrote: Why mess with something that is already working? If you are trying to make it pretty then you are not solving a problem. You are creating one. Define working. I've had programs 'work', but more experienced would say it's flawed in some respect. Does it perform the immediate task? Now define pretty. Is it aesthetically pleasing to you, or to someone else with less, or maybe more experience. By defining the two above, you then define whether it's a problem. To you, or to them, or to the original designer? Ravi. On Mon, Dec 20, 2010 at 7:40 AM, Daniel P. Brown daniel.br...@parasane.netwrote: On Mon, Dec 20, 2010 at 02:49, Simcha Younger sim...@syounger.com wrote: Since it is being included by PHP, and not served by Apache, the extension is not important. Correct, but keep in mind that it will likely be served as plain text if accessed directly, if the web server is not properly configured (which, by default, it isn't). -- /Daniel P. Brown Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting (866-) 725-4321 http://www.parasane.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- They're installing the breathalyzer on my email account next week. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems w/ goto
On Sat, Dec 18, 2010 at 12:45 PM, Geoffrey Bernardo Van Wyk geoffrey.van@gmail.com wrote: Ethan, I tried to test your code, but I get this error next to the labels and goto statements: As a 'professional' programmer, working for an entity, we deal with these problems as we go. As novices, we deal with it on a daily basis. As computer scientists, we think of it as a problem already solved, but in need of translation. Understand, buddy pal. Language feature not compatible with PHP version indicated in project settings I have PHP 5.3.0. Geoffrey _ From: Ethan Rosenberg [mailto:eth...@earthlink.net] Sent: 17 December 2010 06:39 PM To: php-db-lists.php.net; php-general@lists.php.net Subject: [PHP] Problems w/ goto Dear List - I am sending this again since it does not seem to have posted. Ethan +++ Dear List - Thank you with your excellent help in the past. Here is another puzzler I am trying to write a program that can have two(2) independent forms in one PHP file. When I run the code below [from PHP - A Beginner's Guide], to which I have added a second form, it freezes. Without the goto statements, it runs. When it does run, it displays both forms on one Web screen. What I desire is for the first form to be displayed, the data entered and then the second form displayed. In an actual, not test program like this one, the data in the second form would be dependent on the first form. What did I do wrong? Thanks in advance. Here is the code: !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en head titleProject 4-4: Age Calculator/title /head body h2Project 4-4: Age Calculator/h2 ?php // if form not yet submitted // display form $ender = 0; begin: if($ender == 1) exit(); if (!isset($_POST['dob'])) { start1: echo form method=\post\ action=\agecalc2.php\; echo Enter your date of birth, in mm/dd/ format: br /; echo input type=\text\ name=\dob\ /; echo p; echo input type=\submit\ name=\submit\ value=\Submit\ /; echo /form; goto begin; // if form submitted // process form input } else { starter: if (isset($_POST['cat'])) goto purr; // split date value into components $dateArr = explode('/', $_POST['dob']); // calculate timestamp corresponding to date value $dateTs = strtotime($_POST['dob']); // calculate timestamp corresponding to 'today' $now = strtotime('today'); // check that the value entered is in the correct format if (sizeof($dateArr) != 3) { die('ERROR: Please enter a valid date of birth'); } // check that the value entered is a valid date if (!checkdate($dateArr[0], $dateArr[1], $dateArr[2])) { die('ERROR: Please enter a valid date of birth'); } // check that the date entered is earlier than 'today' if ($dateTs = $now) { die('ERROR: Please enter a date of birth earlier than today'); } // calculate difference between date of birth and today in days // convert to years // convert remaining days to months // print output $ageDays = floor(($now - $dateTs) / 86400); $ageYears = floor($ageDays / 365); $ageMonths = floor(($ageDays - ($ageYears * 365)) / 30); echo You are approximately $ageYears years and $ageMonths months old.; goto meow; } meow: if (!isset($_POST['dob'])) goto begin; if (!isset($_POST['cat'])) { echo form method=\post\ action=\agecalc2.php\; echo br /br /Enter your kitten's name: br /; echo input type=\text\ name=\cat\ /; echo p; echo input type=\submit\ name=\submit\ value=\Submit Kitten\ /; echo /form; } else { purr: $name_cat = $_POST['cat']; echo Your Kitten is $name_cat; $ender = 1; } if ($ender == 0) goto begin; first_step: ? /body /html Ethan MySQL 5.1 PHP 5 Linux [Debian (sid)] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ No virus found in this message. Checked by AVG - www.avg.com Version: 10.0.1170 / Virus Database: 1435/3323 - Release Date: 12/18/10 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems w/ goto
You approved all of us, no matter the peer review, when you signed up or the list. The accumulation of knowledge, is insurmountable when delivered as a whole, but devourable if you need satiation of appetite. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems w/ goto
or maybe it's saturday morning and i'm drunk? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems w/ goto
check out my new sig. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PDO: good, popular?
On Tue, Dec 14, 2010 at 6:10 AM, Sam Smith a...@itab.com wrote: Searching for PHP CRUD in hopes of learning the best way to access databases and to use PEAR or what I came across PDO. I want to know the communities opinion of PDO: everyone uses it or no one uses it or it's great or what? In previous experience with questions such as these, you will get several types of individual responses to usages of the software. Some good, some bad, depending on the experience level of the commenter with both the language and the code in question. It's a combination of your current understanding of php and the associated usages of other languages, and what you want to know. Don't trust what people say, trust what feels right at the current time of your usage of the php library available/your experience level, and what you currently know how to use. From my experience with several languages, once you know the basics, even if you do re-invent the 'wheel', so did firestone,michelin, and goodyear, and they're not complaining. And you'll feel better for reinventing, than using someone elses. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PDO: good, popular?
In other words, in ten years from now, even the advisors you get today will rethink their answers with 20/20/hindsight, and not think about your ignorance of technology, but their own. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Copying an Object
On Fri, Sep 24, 2010 at 4:09 AM, Gary php-gene...@garydjones.name wrote: Daniel Kolbo wrote: Say you have two classes: human and male. Further, say male extends human. Let's say you have a human object. Then later you want to make that human object a male object. This seems to be a pretty reasonable thing to request of our objects. I don't think any human can change gender without major surgery, but I don't know if you just chose your example badly or whether you really think objects should be able to mutate into other types of object without some kind of special treatment. But it would work in something like makehuman, where you start with a neuter form and scale one way or the other for physical features. If I remember correctly, we're' all xx until you become xy(genetically speaking). This type of thing would especially be easy if objects of parent classes could be cast as an object of its extended class. Where would the extra data come from to fill in any fields the base class does not have? Just think of a simple example with a Shape class, extended by a ColouredShape class which contains some data about the object's colour - if you have a Shape object it can't become a ColouredShape without some surgery because bits of the ColouredShape's anatomy are not present. -- Gary Please do NOT send me 'courtesy' replies off-list. PHP 5.2.12 (cli) (built: Jan 14 2010 14:54:11) 1.7.7(0.230/5/3) 2010-08-31 09:58 Cygwin -- 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] workflow system design
On Tue, Sep 7, 2010 at 8:39 AM, Jay Blanchard jblanch...@pocket.com wrote: [snip] Hi, i know it is not the right place, but, does anybody know a workflow system development process? or methodology? thanks! [/snip] http://en.wikipedia.org/wiki/Workflow -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysqldump
On Tue, Aug 17, 2010 at 2:55 PM, Robert Cummings rob...@interjinn.com wrote: On 10-08-17 02:45 PM, Mari Masuda wrote: On Aug 17, 2010, at 11:40 AM, tedd wrote: At 2:17 PM -0400 8/17/10, Robert Cummings wrote: On 10-08-17 02:08 PM, tedd wrote: Hi gang: At 6:11 PM -0400 8/13/10, Daniel P. Brown wrote: Easiest method, from the command line on the server from which you want to dump the database: mysqldump -u user -p database_name outfile.sql Command is wrong... should be: mysqldump -u user -p password database_name outfile.sql I did catch that, but did not correct it in my post (considering it was a direct quote). --- 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. That's actually funny... I never put spaces in for the user or password when using the short parameter method and had quickly tried with the space before posting 'Playful with passwords the hacker does not expect', says yoda ... I had tried with the user though and it work so I had assumed it worked for password also. Cheers, Rob. -- E-Mail Disclaimer: Information contained in this message and any attached documents is considered confidential and legally protected. This message is intended solely for the addressee(s). Disclosure, copying, and distribution are prohibited unless authorized. -- 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] mysqldump
On Tue, Aug 17, 2010 at 3:00 PM, David Hutto smokefl...@gmail.com wrote: On Tue, Aug 17, 2010 at 2:55 PM, Robert Cummings rob...@interjinn.com wrote: On 10-08-17 02:45 PM, Mari Masuda wrote: On Aug 17, 2010, at 11:40 AM, tedd wrote: At 2:17 PM -0400 8/17/10, Robert Cummings wrote: On 10-08-17 02:08 PM, tedd wrote: Hi gang: At 6:11 PM -0400 8/13/10, Daniel P. Brown wrote: Easiest method, from the command line on the server from which you want to dump the database: mysqldump -u user -p database_name outfile.sql Command is wrong... should be: mysqldump -u user -p password database_name outfile.sql I did catch that, but did not correct it in my post (considering it was a direct quote). --- 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. That's actually funny... I never put spaces in for the user or password when using the short parameter method and had quickly tried with the space before posting 'Playful with passwords the hacker does not expect', says yoda ... I had tried with the user though and it work so I had assumed it worked for password also. Cheers, Rob. -- E-Mail Disclaimer: Information contained in this message and any attached documents is considered confidential and legally protected. This message is intended solely for the addressee(s). Disclosure, copying, and distribution are prohibited unless authorized. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Or playfulness he expects, but privacy he reaps, said her celibate highness -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysqldump
On Tue, Aug 17, 2010 at 3:04 PM, Robert Cummings rob...@interjinn.com wrote: On 10-08-17 03:00 PM, David Hutto wrote: On Tue, Aug 17, 2010 at 2:55 PM, Robert Cummingsrob...@interjinn.com wrote: On 10-08-17 02:45 PM, Mari Masuda wrote: On Aug 17, 2010, at 11:40 AM, tedd wrote: At 2:17 PM -0400 8/17/10, Robert Cummings wrote: On 10-08-17 02:08 PM, tedd wrote: Hi gang: At 6:11 PM -0400 8/13/10, Daniel P. Brown wrote: Easiest method, from the command line on the server from which you want to dump the database: mysqldump -u user -p database_name outfile.sql Command is wrong... should be: mysqldump -u user -p password database_name outfile.sql I did catch that, but did not correct it in my post (considering it was a direct quote). --- 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. That's actually funny... I never put spaces in for the user or password when using the short parameter method and had quickly tried with the space before posting 'Playful with passwords the hacker does not expect', says yoda I can't wait for 2050 when they release the new Star Wars super duper master awesome director's milk-it edition with 3 seconds of Yoda smoking a cigarette! But they'll put it in a pretty 'Happy meal', with lighter included. :) Cheers, Rob. -- E-Mail Disclaimer: Information contained in this message and any attached documents is considered confidential and legally protected. This message is intended solely for the addressee(s). Disclosure, copying, and distribution are prohibited unless authorized. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP The Anthem
On Sat, Aug 7, 2010 at 1:46 PM, tedd tedd.sperl...@gmail.com wrote: At 12:33 PM -0400 8/7/10, Daniel P. Brown wrote: On Sat, Aug 7, 2010 at 09:47, tedd tedd.sperl...@gmail.com wrote: No, writing it provided me with the experience of developing a rule-based AI solution to a real-world problem and I received a little money for my efforts. Experience and money are never a waste of time. The opinions of what is gainful life experience and what is a waste of time will vary greatly from one to another. Experience and money are never a waste of time *to me*. but did they make money off of the video, was it branded? If not, then it was a great promo, even without seeing it, I've 'seen' the buzz. tedd -- --- 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] [site is acting strange] - blank pages, download index.php, or works fine
On Fri, Jul 30, 2010 at 8:49 PM, David Hutto smokefl...@gmail.com wrote: On Fri, Jul 30, 2010 at 2:50 PM, Ashley Sheridan a...@ashleysheridan.co.uk wrote: On Fri, 2010-07-30 at 13:38 -0400, Adam Richardson wrote: On Fri, Jul 30, 2010 at 11:35 AM, Bill Guion bgu...@comcast.net wrote: At 6:45 PM -0600 7/29/10, Tristan wrote: Yeah like i said site works 95% of the time when navigating. PHP5.2, Mysql 5. The site is completely dynamic so it wouldn't work at all if that was the case of it not being installed right. so the other 5% of the time is blank pages and download index.php files. In Firefox when you get a blank page, if you click view source it will show all the code that should be there but, I can't tell if it's requesting the page again when you do that. It never fails 2 times in a row. A refresh will always fix it. When you look in firebug there is no html so it leads me to believe FF may be doing just that...going for a second request instead of viewing currently opened source? In IE8 I would get something like diagnose problem button more information drop down with this problem can be caused by a variety of issues..this is a completely typical M$ error with no valid help chrome same thing with web page cannot be displayed more information etc... On Thu, Jul 29, 2010 at 6:36 PM, David McGlone da...@dmcentral.net wrote: On Thu, 2010-07-29 at 18:11 -0600, Tristan wrote: I have the strangest issue with my host. They can't figure it out and I'm completely perplexed. We have other sites running on the server just fine. However, this new site is acting very weird. Sometimes we get blank pages, sometimes we get a blank page and then a dialog pops up asking if we want to download index.php, and then sometimes the site is working fine. Any ideas on this? I'm at ends. Appreciate any advice. For authentication we are using mysql auth module in apache/linux and proxy pass. We removed proxy pass to see if that was it but, it wasn't. its a members.domain.com subdomain if that helps. Do you have php-mysql installed? -- Blessings, David M. Does the page validate at http://jigsaw.w3.org/css-validator/? -= Bill =- -- Don't find fault. Find a remedy. - Henry Ford -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Tristan, The good news is that you're not crazy. I've had this exact issue (at least in terms of symptoms) when working with one of my client's websites. The bad news is that this was long ago, I was using a shared host, and I'm not the one who cause or, more importantly, fixed the problem. That said, I've strained my memory to try and recall what might have been said in the follow-up from the host, and it seems like there was a mime-type handling issue (again, I could be completely wrong, this is just a faint memory.) Another faint memory: are you able to see a difference in behavior when you view an index file with the file included in the url ( http://yoursite.com/index.php) as opposed to when you view the page without it in the url (http://yoursite.com)? Sorry, I wish I still had my email exchange with the company to see what information they provided after the fix :( Adam Actually, you just saying that made me think of a similar problem I had once with IIS serving up files. It was XML files rather than PHP, but the Mime issue does ring a bell! Is the server you're using IIS Tristan? Thanks, Ash http://www.ashleysheridan.co.uk Forgot to hit reply all: I'm not sure if this helps, or even relates, but the one time I had a hosting account for a microsoft app named NopCommerce, when I would try to visit the page, it seemed to only allow one connection at a time, because of some MS DB user limitation or something, and I didn't attempt anymore with it. Might relate, might not. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [site is acting strange] - blank pages, download index.php, or works fine
On Fri, Jul 30, 2010 at 8:50 PM, David Hutto smokefl...@gmail.com wrote: On Fri, Jul 30, 2010 at 8:49 PM, David Hutto smokefl...@gmail.com wrote: On Fri, Jul 30, 2010 at 2:50 PM, Ashley Sheridan a...@ashleysheridan.co.uk wrote: On Fri, 2010-07-30 at 13:38 -0400, Adam Richardson wrote: On Fri, Jul 30, 2010 at 11:35 AM, Bill Guion bgu...@comcast.net wrote: At 6:45 PM -0600 7/29/10, Tristan wrote: Yeah like i said site works 95% of the time when navigating. PHP5.2, Mysql 5. The site is completely dynamic so it wouldn't work at all if that was the case of it not being installed right. so the other 5% of the time is blank pages and download index.php files. In Firefox when you get a blank page, if you click view source it will show all the code that should be there but, I can't tell if it's requesting the page again when you do that. It never fails 2 times in a row. A refresh will always fix it. When you look in firebug there is no html so it leads me to believe FF may be doing just that...going for a second request instead of viewing currently opened source? In IE8 I would get something like diagnose problem button more information drop down with this problem can be caused by a variety of issues..this is a completely typical M$ error with no valid help chrome same thing with web page cannot be displayed more information etc... On Thu, Jul 29, 2010 at 6:36 PM, David McGlone da...@dmcentral.net wrote: On Thu, 2010-07-29 at 18:11 -0600, Tristan wrote: I have the strangest issue with my host. They can't figure it out and I'm completely perplexed. We have other sites running on the server just fine. However, this new site is acting very weird. Sometimes we get blank pages, sometimes we get a blank page and then a dialog pops up asking if we want to download index.php, and then sometimes the site is working fine. Any ideas on this? I'm at ends. Appreciate any advice. For authentication we are using mysql auth module in apache/linux and proxy pass. We removed proxy pass to see if that was it but, it wasn't. its a members.domain.com subdomain if that helps. Do you have php-mysql installed? -- Blessings, David M. Does the page validate at http://jigsaw.w3.org/css-validator/? -= Bill =- -- Don't find fault. Find a remedy. - Henry Ford -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Tristan, The good news is that you're not crazy. I've had this exact issue (at least in terms of symptoms) when working with one of my client's websites. The bad news is that this was long ago, I was using a shared host, and I'm not the one who cause or, more importantly, fixed the problem. That said, I've strained my memory to try and recall what might have been said in the follow-up from the host, and it seems like there was a mime-type handling issue (again, I could be completely wrong, this is just a faint memory.) Another faint memory: are you able to see a difference in behavior when you view an index file with the file included in the url ( http://yoursite.com/index.php) as opposed to when you view the page without it in the url (http://yoursite.com)? Sorry, I wish I still had my email exchange with the company to see what information they provided after the fix :( Adam Actually, you just saying that made me think of a similar problem I had once with IIS serving up files. It was XML files rather than PHP, but the Mime issue does ring a bell! Is the server you're using IIS Tristan? Thanks, Ash http://www.ashleysheridan.co.uk Forgot to hit reply all: I'm not sure if this helps, or even relates, but the one time I had a hosting account for a microsoft app named NopCommerce, when I would try to visit the page, it seemed to only allow one connection at a time, because of some MS DB user limitation or something, and I didn't attempt anymore with it. Might relate, might not. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Video lessons
On Fri, Jul 23, 2010 at 2:35 PM, Dan Joseph dmjos...@gmail.com wrote: On Thu, Jul 22, 2010 at 10:04 AM, Jordan Jovanov jovanovj...@gmail.comwrote: Im thing that I'm little layse, Do you somebody know PHP VIDEO LESSONS? I'm not sure exactly what you're meaning there, but check out www.lynda.com -- -Dan Joseph http://www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month. Promo Code NEWTHINGS for 10% off initial order -- Reseller Plans also available! http://www.facebook.com/canishosting http://www.facebook.com/originalpoetry http://www.facebook.com/teaserleaguehttp://www.facebook.com/apps/application.php?id=135491833139465 Have you tried searching at youtube, or google. I'd suggest 'php video tutorials lessons' as the search term without out even trying it first myself. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Video lessons
On Fri, Jul 23, 2010 at 8:13 PM, David Hutto smokefl...@gmail.com wrote: On Fri, Jul 23, 2010 at 2:35 PM, Dan Joseph dmjos...@gmail.com wrote: On Thu, Jul 22, 2010 at 10:04 AM, Jordan Jovanov jovanovj...@gmail.comwrote: Im thing that I'm little layse, Do you somebody know PHP VIDEO LESSONS? I'm not sure exactly what you're meaning there, but check out www.lynda.com -- -Dan Joseph http://www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month. Promo Code NEWTHINGS for 10% off initial order -- Reseller Plans also available! http://www.facebook.com/canishosting http://www.facebook.com/originalpoetry http://www.facebook.com/teaserleaguehttp://www.facebook.com/apps/application.php?id=135491833139465 Have you tried searching at youtube, or google. I'd suggest 'php video tutorials lessons' as the search term without out even trying it first myself. I you want, you can copy and paste my suggestion into the search box, that way it eliminates any excess activity on your part. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] calendar libs
On Tue, Jul 13, 2010 at 2:04 PM, Ricardo Martinez harisel...@gmail.com wrote: Hi! i'm looking for a good calendar libs, want ask, if anyone knows a good library. thx! Ricardo This may hel, it's just a simple search for 'php calendar' : http://www.php-calendar.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] calendar libs
On Tue, Jul 13, 2010 at 2:10 PM, David Hutto smokefl...@gmail.com wrote: On Tue, Jul 13, 2010 at 2:04 PM, Ricardo Martinez harisel...@gmail.com wrote: Hi! i'm looking for a good calendar libs, want ask, if anyone knows a good library. thx! Ricardo This may hel, it's just a simple search for 'php calendar' : http://www.php-calendar.com/ This might help better as a reference: http://www.w3schools.com/php/php_ref_calendar.asp Not to say there isn't a builtin function, or. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] calendar libs
On Tue, Jul 13, 2010 at 2:14 PM, David Hutto smokefl...@gmail.com wrote: On Tue, Jul 13, 2010 at 2:10 PM, David Hutto smokefl...@gmail.com wrote: On Tue, Jul 13, 2010 at 2:04 PM, Ricardo Martinez harisel...@gmail.com wrote: Hi! i'm looking for a good calendar libs, want ask, if anyone knows a good library. thx! Ricardo This may hel, it's just a simple search for 'php calendar' : http://www.php-calendar.com/ This might help better as a reference: http://www.w3schools.com/php/php_ref_calendar.asp Not to say there isn't a builtin function, or. minus the : Not to say there isn't a builtin function, or. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php -l - does it find *anything*?
On Tue, Jul 6, 2010 at 8:22 AM, Gary . php-gene...@garydjones.name wrote: Ashley Sheridan writes: On Tue, 2010-07-06 at 10:54 +0200, Gary . wrote: If foo3 never happens to be called when I am doing my testing (for example if the call is in some if branch that is never exercised) then it only gets found in production, so I would like to find this kind of thing using a static analyser. The kind of problem in foo2 I could live with, but would like to find as well, if possible. (Obviously I am using these two example problems as indicative of the type of things I want to find, it isn't an exhaustive list!) BTW, what problems *does* php -l pick up? I can't find a description anywhere. According to the man page for php, the -l flag only checks the syntax, so a warning wouldn't be displayed, as technically it's not a show-stopper. Well, I think foo3 is, but yeah, I know what you mean. Maybe some sort of unit testing would help pick out these sorts of issues? I do. Actually I posted this by mistake to the phpunit mailing list first :) As PHP isn't a compiled language, I guess it's harder for it to pick up on things like this. Yeah. There are static checkers out there, even some FOSS ones. I guess I'm just a bit frustrated that (as you say) the man page says that -l checks syntax but doesn't really detail what kind of things that covers. Actually, I can't even find a decent description of what E_STRICT covers :( just that Enabling E_STRICT during development has some benefits. Just to interject a little newbie talk... have you ever written a program alone(something developers do for specific situations a lot I find), and not properly written out the documentation because YOU understood what you were doing, but were more into the code than docking it?. This does seem to be a predominant theme amongst some open source projects. STRICT messages will help you to use the latest and greatest suggested method of coding, for example warn you about using deprecated functions. Some benefits? For example? Telling people exactly what is covered seems more useful, to me. Meh. Anyway, that's my whine over for the day :) -- 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] Event Handling
--- On *Mon, 3/15/10, David Hutto dwightdhu...@yahoo.com* wrote: From: David Hutto dwightdhu...@yahoo.com Subject: Re: [PHP] Event Handling To: php-general@lists.php.net, Alex Major p...@allydm.co.uk Date: Monday, March 15, 2010, 3:34 AM --- On Mon, 3/15/10, Alex Major p...@allydm.co.ukhttp://us.mc453.mail.yahoo.com/mc/compose?to=...@allydm.co.uk wrote: From: Alex Major p...@allydm.co.ukhttp://us.mc453.mail.yahoo.com/mc/compose?to=...@allydm.co.uk Subject: [PHP] Event Handling To: php-general@lists.php.nethttp://us.mc453.mail.yahoo.com/mc/compose?to=php-gene...@lists.php.net Date: Monday, March 15, 2010, 2:59 AM Greetings all, I'm currently looking at building a web application, however I've run into an area of development I've not come across before. The web site in its basic form allows users to send cars from a point and then the car will arrive at another point. When the car is set on its way, the start time, travel duration and end time are all known and stored in a MySQL database, what I would like to happen is that an event is triggered on the server at the end time and then an e-mail is sent to the user. This should happen regardless of whether someone is browsing the website or not. I don't believe that I'll be able to solely use PHP, I have spent the afternoon trying to look at potential solutions but I have to admit I've drawn a blank. Google hasn't been helpful (64 pages so far), as any searches related to event handling bring up a load of JavaScript tutorials/help for 'onclick' events etc. I have searched through the PHP documentation and found libevent (http://www.php.net/manual/en/book.libevent.php ), I don't believe that is what I require (although in all honesty the lack of documentation on it means I'm quite in the dark as to its purpose). Another potential candidate I came across was a PHP/Java bridge (http://php-java-bridge.sourceforge.net/pjb/ ), whereby I could use the java virtual machine, register events with it and then callback PHP scripts, although this seems extremely long winded. I was hoping that someone might have some experience with this kind of issue and could point me in the right direction. I'm sure I've missed something right in front of me. Alex. I'm a noob at php myself, but what you might want to look at is cron jobs and autoresponders. Here's an address to one I've messed with before: infinite.ibasics.biz/ I believe it uses cron jobs, I've messed with a lot so it's hard to recall. You might want to have the web app insert the new info in the tables, and have the cron job and script do the rest. David
Re: [PHP] Event Handling
On Mon, Mar 15, 2010 at 5:17 AM, Lester Caine les...@lsces.co.uk wrote: Alex Major wrote: I'm currently looking at building a web application, however I've run into an area of development I've not come across before. The web site in its basic form allows users to send cars from a point and then the car will arrive at another point. When the car is set on its way, the start time, travel duration and end time are all known and stored in a MySQL database, The question HAS to be asked ... how do you know the actual travel time ;) I think I would be expecting to have to enter something on arrival -- Lester Caine - G8HFL - Contact - http://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.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php You could judge the ETA if the shipping was tracked through GPS.
[PHP] Login Script: mysql_num_rows(): supplied argument is not a valid MySQL result resource
The following script is supposed to validate a username and password in a mysql db. When entering the username and password of a preregistered user, I get the following errors: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /var/www/login.php on line 24 Warning: Cannot modify header information - headers already sent by (output started at /var/www/login.php:24) in /var/www/login.php on line 26 On line 24 is: if(!mysql_num_rows($login)) //if the username and pass are wrong --The supplied argument is $login, which is previously defined as: $login = mysql_query(SELECT * FROM 'userinfo' WHERE `user` = '$user' AND `pass` = '$pass`); --which is further defined above it as these values: $user = $_POST['user']; //pulls the username from the form $pw = $_POST['pass']; //pulls the pass from the form $pass = md5($pw); //makes our password an md So why is the sum of those previous definitions an invalid argument for the mysql_query() to test for whether the username and md5 password values are true/equivalent to each other? Thanks for any help you may be able to provide, below is the full login.php page. David This is the full login.php script, I'm pretty sure no other portions are needed to show at this point for the current problem: ?php $act = $_GET['act']; //retrives the page action if(empty($act)) //if there is no action { echo('form action=login.php?act=auth method=post name=loginform id=loginform pUsername input type=text name=user /p pPassword input type=password name=pass /p p input type=submit name=Submit value=Login /p /form'); } elseif($act == auth) //if our page action = auth { $user = $_POST['user']; //pulls the username from the form $pw = $_POST['pass']; //pulls the pass from the form $pass = md5($pw); //makes our password an md5 include(connect.php); //connects to our mysql database $login = mysql_query(SELECT * FROM `userinfo` WHERE `user` = '$user' AND `pass` = '$pass`); //selects info from our table if the row has the same user and pass that our form does if(!mysql_num_rows($login)) //if the username and pass are wrong { header(Location: login.php); //redirects to our login page die(); //stops the page from going any further } else { setcookie(user, $user, time()+3600);//sets our user cookie setcookie(pass, $pass, time()+3600);//sets our pass cookie header(Location: memprar.php);//instead of yourpage.php it would be your protected page } } ?
[PHP] Re: Login Script: mysql_num_rows(): supplied argument is not a valid MySQL result resource
--- On Fri, 2/19/10, David Hutto dwightdhu...@yahoo.com wrote: From: David Hutto dwightdhu...@yahoo.com Subject: Login Script: mysql_num_rows(): supplied argument is not a valid MySQL result resource To: php-general@lists.php.net Date: Friday, February 19, 2010, 3:30 AM The following script is supposed to validate a username and password in a mysql db. When entering the username and password of a preregistered user, I get the following errors: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /var/www/login.php on line 24 Warning: Cannot modify header information - headers already sent by (output started at /var/www/login.php:24) in /var/www/login.php on line 26 On line 24 is: if(!mysql_num_rows($login)) //if the username and pass are wrong --The supplied argument is $login, which is previously defined as: $login = mysql_query(SELECT * FROM 'userinfo' WHERE `user` = '$user' AND `pass` = '$pass`); --which is further defined above it as these values: $user = $_POST['user']; //pulls the username from the form $pw = $_POST['pass']; //pulls the pass from the form $pass = md5($pw); //makes our password an md So why is the sum of those previous definitions an invalid argument for the mysql_query() to test for whether the username and md5 password values are true/equivalent to each other? Because basically !mysql_num_rows($login) is just if'ing the lack of a user/pass match, else it continues to set cookie and session variables. If I'm looking at this wrong let me know. Thanks for any help you may be able to provide, below is the full login.php page. David This is the full login.php script, I'm pretty sure no other portions are needed to show at this point for the current problem: ?php $act = $_GET['act']; //retrives the page action if(empty($act)) //if there is no action { echo('form action=login.php?act=auth method=post name=loginform id=loginform pUsername input type=text name=user /p pPassword input type=password name=pass /p p input type=submit name=Submit value=Login /p /form'); } elseif($act == auth) //if our page action = auth { $user = $_POST['user']; //pulls the username from the form $pw = $_POST['pass']; //pulls the pass from the form $pass = md5($pw); //makes our password an md5 include(connect.php); //connects to our mysql database $login = mysql_query(SELECT * FROM `userinfo` WHERE `user` = '$user' AND `pass` = '$pass`); //selects info from our table if the row has the same user and pass that our form does if(!mysql_num_rows($login)) //if the username and pass are wrong { header(Location: login.php); //redirects to our login page die(); //stops the page from going any further } else { setcookie(user, $user, time()+3600);//sets our user cookie setcookie(pass, $pass, time()+3600);//sets our pass cookie header(Location: memprar.php);//instead of yourpage.php it would be your protected page } } ?
Re: [PHP] Login Script: mysql_num_rows(): supplied argument is not a valid MySQL result resource
--- On Fri, 2/19/10, Ashley Sheridan a...@ashleysheridan.co.uk wrote: From: Ashley Sheridan a...@ashleysheridan.co.uk Subject: Re: [PHP] Login Script: mysql_num_rows(): supplied argument is not a valid MySQL result resource To: David Hutto dwightdhu...@yahoo.com Cc: php-general@lists.php.net Date: Friday, February 19, 2010, 5:34 AM On Fri, 2010-02-19 at 00:30 -0800, David Hutto wrote: The following script is supposed to validate a username and password in a mysql db. When entering the username and password of a preregistered user, I get the following errors: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /var/www/login.php on line 24 Warning: Cannot modify header information - headers already sent by (output started at /var/www/login.php:24) in /var/www/login.php on line 26 On line 24 is: if(!mysql_num_rows($login)) //if the username and pass are wrong --The supplied argument is $login, which is previously defined as: $login = mysql_query(SELECT * FROM 'userinfo' WHERE `user` = '$user' AND `pass` = '$pass`); --which is further defined above it as these values: $user = $_POST['user']; //pulls the username from the form $pw = $_POST['pass']; //pulls the pass from the form $pass = md5($pw); //makes our password an md So why is the sum of those previous definitions an invalid argument for the mysql_query() to test for whether the username and md5 password values are true/equivalent to each other? Thanks for any help you may be able to provide, below is the full login.php page. David This is the full login.php script, I'm pretty sure no other portions are needed to show at this point for the current problem: ?php $act = $_GET['act']; //retrives the page action if(empty($act)) //if there is no action { echo('form action=login.php?act=auth method=post name=loginform id=loginform pUsername input type=text name=user /p pPassword input type=password name=pass /p p input type=submit name=Submit value=Login /p /form'); } elseif($act == auth) //if our page action = auth { $user = $_POST['user']; //pulls the username from the form $pw = $_POST['pass']; //pulls the pass from the form $pass = md5($pw); //makes our password an md5 include(connect.php); //connects to our mysql database $login = mysql_query(SELECT * FROM `userinfo` WHERE `user` = '$user' AND `pass` = '$pass`); //selects info from our table if the row has the same user and pass that our form does if(!mysql_num_rows($login)) //if the username and pass are wrong { header(Location: login.php); //redirects to our login page die(); //stops the page from going any further } else { setcookie(user, $user, time()+3600);//sets our user cookie setcookie(pass, $pass, time()+3600);//sets our pass cookie header(Location: memprar.php);//instead of yourpage.php it would be your protected page } } ? First, please create a new email when sending to the list and don't just reply to the last one, as those of us with email clients that group by threads get confused when the subject line appears to change mid-thread! On to your question, you've got an error with your query, so it will never work: SELECT * FROM `userinfo` WHERE `user` = '$user' AND `pass` = '$pass` // change that last back tick after $pass! Lastly; protect your queries! That $user variable is open to injection. Replacing it with something like $user = mysql_real_escape_string($_POST['user']); Your $pass is protected (I believe) because of what you're doing with the hash, but I'm not an expert in these things, so it could be that this may not be enough. Thanks, Ash http://www.ashleysheridan.co.uk Apologies for hijacking the thread, I hit reply all in a randomly picked email and deleted the info/subject line, guess that doesn't work. Thanks for the advice, it's almost working right, all things considered. David
[PHP] Reading Encrypted Password From MySQLDB
Apache/2.2.12 (Ubuntu) MySQL client version: 5.1.37 PHP extension: mysqli PHP Version 5.2.10-2ubuntu6.4 I'm doing the tutorial from this site: http://www.trap17.com/index.php/Php-Simple-Login-Tutorial_t7887.html This is register.php ?php // dbConfig.php is a file that contains your // database connection information. This // tutorial assumes a connection is made from // this existing file. include (dbConfig.php); //Input vaildation and the dbase code if ( $_GET[op] == reg ) { $bInputFlag = false; foreach ( $_POST as $field ) { if ($field == ) { $bInputFlag = false; } else { $bInputFlag = true; } } // If we had problems with the input, exit with error if ($bInputFlag == false) { die( Problem with your registration info. .Please go back and try again.); } // Fields are clear, add user to database // Setup query $q = INSERT INTO `user_info` (`username`,`password`,`email`) .VALUES('.$_POST[username].') .PASSWORD('.$_POST[password].') .'.$_POST[email].'); // Run query $r = mysql_query($q); // Make sure query inserted user successfully if ( !mysql_insert_id() ) { die(Error: User not added to database.); } else { // Redirect to thank you page. Header(Location: register.php?op=thanks); } } // end if //The thank you page elseif ( $_GET[op] == thanks ) { echo h2Thanks for registering!/h2; } //The web form for input ability else { echo form action=\?op=reg\ method=\POST\\n; echo Username: input name=\username\ MAXLENGTH=\16\br /\n; echo Password: input type=\password\ name=\password\ MAXLENGTH=\16\br /\n; echo Email Address: input name=\email\ MAXLENGTH=\25\br /\n; echo input type=\submit\\n; echo /form\n; } // EOF ? This is login.php ?php session_start(); // dBase file include dbConfig.php; if ($_GET[op] == login) { if (!$_POST[username] || !$_POST[password]) { die(You need to provide a username and password.); } // Create query $q = SELECT * FROM `user_info` .WHERE `username`=VALUES('.$_POST[username].') .AND `password`=PASSWORD('.$_POST[password].') .LIMIT 1; // Run query $r = mysql_query($q); if ( $obj = @mysql_fetch_object($r) ) { // Login good, create session variables $_SESSION[valid_id] = $obj-id; $_SESSION[valid_user] = $_POST[username]; $_SESSION[valid_time] = time(); // Redirect to member page Header(Location: members.php); } else { // Login not successful die(Sorry, could not log you in. Wrong login information.); } } else { //If all went right the Web form appears and users can log in echo form action=\?op=login\ method=\POST\; echo Username: input name=\username\ size=\15\br /; echo Password: input type=\password\ name=\password\ size=\8\br /; echo input type=\submit\ value=\Login\; echo /form; } ? Problem: All users registered through registration page, can't login/get error message. When the password is first written to the db from the registration.php it's assigned a unique number. The problem seems to be in aligning how it's validated by the login.php script. If I manually enter a new user field with the password written directly into the phpMyAdmin, then the login accepts the manually entered user and password at login.php and transfers to the members page. All others get the Error: Sorry, could not log you in. Wrong login information. Can someone please enlighten me as to why registration.php seems to write to the db and the login.php can read/validate from the manual input field but not know what the key to understanding the password's uniquely generated id assigned by the actual registration.php to the password field? Thanks, David