Re: [PHP] REQUEST
On Wed, May 29, 2013 at 9:30 AM, Stuart Dallas stu...@3ft9.com wrote: On 29 May 2013, at 17:26, Last Hacker Always onpoint lasthack...@gmail.com wrote: HEY GUYZ I KNOW, I KNOW THIS IS NOT A PLACE FOR SOMETHING LIKE THIS SO BUT HEY I HAVE A LITTLE TINY QUESTION FOR MY COOL GUYZ. DOES ANYONE HERE USE A SIMPLY MACHINE FUNCTION SCRIPT? BECAUSE THE SCRIPTINGS ARE A LITTLE HARD FOR ME TO UNDERSTAND PLEASE LET ME KNOW GUYS I WANT SOMEONE TO TEACH ME. 1) Shouting at us will not encourage a helpful attitude. 2) Neither will calling us your cool guyz. 3) What is a simply machine function script? 4) http://www.catb.org/esr/faqs/smart-questions.html If you want someone to teach you PHP you'll probably need to pony up some cash. If you want someone to help you while you're learning, show us that you're working on it and we'll be happy to help. -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ --
Re: [PHP] Re: target question
On Mon, Mar 25, 2013 at 10:21 AM, Jim Giner jim.gi...@albanyhandball.com wrote: In light of the apparent lack of any solution, I have embarked on changing all my report choices to use multiple forms with different target attribs as needed. For many of them not a big deal, but for several it adds a degree of difficulty since I have to copy the values of any input fields into each separate form by using hidden fields and js called by the form during 'onsubmit'. Works but would be nicer if the simple changing of the target was more reliable. Thanks for reading. What about onclick='window.open(http://domain.com/path/to/generated/pdf;, _blank)' ? Regards, Tommy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Not counting my own page visits
On Mon, Mar 4, 2013 at 9:47 AM, Angela Barone ang...@italian-getaways.com wrote: Hello, I have a script that counts hits to all the pages in my site and emails me a report nightly. However, it also counts my visits to my site, and when I'm coding, I'm hitting a lot of my pages, repeatedly. I'd like to find a way to not count my page visits. At first, I thought about adding a parameter to each URL and parsing that in the script, but that would get old real fast, and also, I may forget to add it each time. Is there a way to tell the script to ignore my visits? Thank you, Angela What about ignoring $_SERVER['REMOTE_ADDR'] or $_SERVER['REMOTE_HOST'] where that matches your public IP or FQDN? http://php.net/manual/en/reserved.variables.server.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Multithreading for OOP PHP
On Wed, Oct 31, 2012 at 6:46 AM, Alex Nikitin niks...@gmail.com wrote: Hey guys (and/or gals), I have heard this question entirely too many times, I think at some point Rasmus just stopped responding to it. The real reason that PHP is not threaded has nothing to do with PHP internal or extension thread safety, the reason is more to the extent that it doesn't make sense to add threading to PHP, it will only increase code and model complexity and create more points of failure, but again the reason is not this, the reason is that it doesn't make sense in PHP's native environment to add threading in the first place. Natively PHP is summoned by a web server, yes you can call PHP in CLI, but that's not it's point market, PHP is first and foremost a server-side language for the web and it is ran by a web server such as Apache or Nginx or IIS(i wouldn't know why you would use IIS, but it could be). All of these web servers (maybe with exception of IIS, i wouldn't know) work pretty much on the same principal, you have the main process that spawns a bunch of worker threads (this is adjustable in configuration, but is typically 1 per cpu thread). These threads are what actually process the requests and call PHP, meaning that if multiple threads are processing multiple requests, multiple instances of PHP will be called. This is why adding threading to PHP makes absolutely no sense, why would you spawn threads in something that is already being called by a thread? Don't get me wrong, threads spawning other threads is a solution, but it is a solution on massively parallel architectures, such as the GPGPUs that can handle over a thousand threads, and it is a solution for an entirely different problem, namely costly conditional statements; PHP on the other hand runs on a general purpose processor that already cache thrashes and runs into issues with instruction pipelines in parallel execution, adding more threads to it would do nothing for performance (or make it worse), make for more complex code and introduce new issues, like for example how do you test threaded code, debugging, messaging, etc, which will introduce new places where php apps fail, new security concerns, etc, and I think we are far from having current issues fixed... That's all understood but there are times when that one request from the visitor requires many sub-requests like connection to DB and making SOAP calls. Sure, it can much faster do you think the response time for the visitor when the sub requests are done in child threads? Sure, I could implement curl_multi as you state below. Want to parallelize your PHP execution? Learn to love curl_multi :) In this case, fix the program, not the programming language. Just my $0.02 But how do you then manage those calls or sub-threads? What about synchronizing? Like you said, fix the program right? Then shouldn't that be fixed in PHP at the core rather than a hack after? Cheers, Tommy -- Alex -- The trouble with programmers is that you can never tell what a programmer is doing until it’s too late. ~Seymour Cray -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Multithreading for OOP PHP
On Wed, Oct 31, 2012 at 9:27 AM, Alex Nikitin niks...@gmail.com wrote: That's all understood but there are times when that one request from the visitor requires many sub-requests like connection to DB and making SOAP calls. I would say it's more than just there are times, that's how a typical script lives, it imports libraries, queries the database, and talks to other systems. Sure, it can much faster do you think the response time for the visitor when the sub requests are done in child threads? I am not so sure of that. Let's make it a mental exercise really quickly. So let's say we have a website, lets say that we want to query the database and make 2 soap calls at the same time, so for every request we spawn 3 threads to do this. Now, ofcourse for every single request, if they were not concurrent, we would run faster, but what happens when we add a little load to this, say 300 requests per second (and i have built wordpress instances that do 360 on a small ec2 instance). You have say 4 cores @ 1 thread/core, so your web server has 4 threads that are continuously running + 1 for dispatch, and then you have 900 threads that you now have to spawn, process, transfer execution to other threads (context switch in and out, maybe a few time) and terminate per second. The problem is that modern CPUs are not very good at doing this, you are context switching between threads, you are context switching between cores, because your network stack runs on a different core or for any other reason, etc, which is very expensive computationally, on top of which you have to spawn new threads and then kill them. And on a say 4 requests per second system, you may win a few miliseconds on parallelizing your data aggregation, but any real load will see that benefit turn in a negative direction. Curl multi is not necessarily a hack, in context of soap, i can build my soap queries, which is always a serial process anyways, and then use curl multi to run the soap requests in parallel, so there, one part already solved. How is it solved when you can't monitor and actively maintain each individual requests within curl_multi? Since nothing is shared, you'll need some place store that information (ie memached or DB). With memached, you're already using extra memory and CPU cycles for that. How is that different than what you describe with extra CPU cycles and RAM? Other than using memcached for something that's not intended by design? If you're using DB, that's even worse because now you're relying on extra network traffic and disk IO (read slower performance). What about synchronizing the information between each calls in the sub-threads? If you got it solved with curl_multi, I'd love to see that pseudo code. I'm sure there are many here that would like to see that too. Anyway, this topic of threading in PHP has already been discussed heatedly. I'm sure it's already been submitted as feature request. As with all feature request, it's up to the dev. :) Cheers, Tommy Database is even easier, since you are usually using a persistent connection, you are already relying on the mysql driver to thread your calls while maintaining a single instance of your connection (eliminating the need for three way hand shakes every time you want to talk to your database, which saves you at least 3 round trips, plus auth (which is 3 more round trips and crypto on both sides)), so even there this problem is already solved for you. And if you are saying that you can run multiple parallel queries for the same PHP process, you really need to fix your database and queries first :) Then shouldn't that be fixed in PHP at the core rather than a hack after? Nope, no need to needlessly complicate PHP especially if there is no need or performance gain in doing it. There are plenty of other areas where PHP can be fixed where it does matter, i mean have a look at a month of PHP bugs if you want to get depressed :) -- The trouble with programmers is that you can never tell what a programmer is doing until it’s too late. ~Seymour Cray -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: php can't insert data mysql table
On Mon, Oct 1, 2012 at 6:03 AM, Jim Giner jim.gi...@albanyhandball.com wrote: In this case, I do think that your insert statement is incorrect - I could be wrong. I think the VALUES clause s/b just 'VALUE'. Also if you added MYSQLI_ERROR to your error handling you should get a very helpful message. VALUES also work. See http://dev.mysql.com/doc/refman/5.5/en/insert.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to limit source IP in PHP
On Wed, Sep 12, 2012 at 6:53 AM, Tonix (Antonio Nati) to...@interazioni.it wrote: Is there a way to force a PHP script to bind to a prefixed IP? Actually, while you can assign more IPs to Apache for listening, assigning domains to specific IPs, it looks like any PHP script can freely choose which IP to bind. Instead I'd love some domains are permitted to open connections only from the domain IP. In FreeBSD I do it easily, setting up dedicated jails for domains. But how to do it simply using PHP on Linux? Regards, Tonino Inter@zioniInterazioni di Antonio Nati http://www.interazioni.it to...@interazioni.it 1) Use Listen in Apache 2) Use VM such as KVM, VMWare, etc. 3) Make an array containing permissible domains. Check the $_SERVER['SERVER_NAME'] if exists in that array. React/respond accordingly. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to limit source IP in PHP
On Wed, Sep 12, 2012 at 7:18 AM, Tonix (Antonio Nati) to...@interazioni.it wrote: Il 12/09/2012 16:08, Tommy Pham ha scritto: On Wed, Sep 12, 2012 at 6:53 AM, Tonix (Antonio Nati) to...@interazioni.it wrote: Is there a way to force a PHP script to bind to a prefixed IP? Actually, while you can assign more IPs to Apache for listening, assigning domains to specific IPs, it looks like any PHP script can freely choose which IP to bind. Instead I'd love some domains are permitted to open connections only from the domain IP. In FreeBSD I do it easily, setting up dedicated jails for domains. But how to do it simply using PHP on Linux? Regards, Tonino Inter@zioniInterazioni di Antonio Nati http://www.interazioni.it to...@interazioni.it 1) Use Listen in Apache 2) Use VM such as KVM, VMWare, etc. 3) Make an array containing permissible domains. Check the $_SERVER['SERVER_NAME'] if exists in that array. React/respond accordingly. 1) is only for listening. 2) means a VPS for each domain, which we already do with vmware and FreeBSD jails, but it is too expensive for some customers. 3) means I'm writing the script, which is not the standard situation. You must suppose the script to be written from a malicious user in a shared environment. Is PHP able to 'force' binding IP? I hoped there was an external directive I did not see, but probably this is a PHP lack. Regards, Tonino -- Inter@zioniInterazioni di Antonio Nati http://www.interazioni.it to...@interazioni.it 2) Previously you've mentioned that you were able to do that in FreeBSD jails. IIRC, the jails are similar to VMs in regards to isolating of environment and dedicated IP for that environment. It seems that you want something that is equivalent of jails and VM but not actual VM/jails. Are you referring to 1 application with one installed point but is used in multiple virtual domains and expect the application to act/respond accordingly to the requests for each virtual domain? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Display Array Tree as Menu - Can't figure out how to find depth with something over 2 levels
On Thu, Aug 16, 2012 at 11:05 AM, Tristan sunnrun...@gmail.com wrote: Thanks David, Here's my tree creation. I'm trying to either put depth count on each array or run through the tree and figure it out after. I just can't figure out where to put it :D Great very lightweight script to create a tree from parent id and id if you want to save this one for yourself btw. function createTree($list, $parent){ $tree = array(); //$depth = 0; foreach ($parent as $k=$l){ //echo $k.'br /'; if(isset($list[$l['section_id']])){ //echo $k.'br /'; $l['depth'] = $k; $l['children'] = createTree($list, $list[$l['section_id']]); } else { $l['depth'] = 0; } $tree[] = $l; } return $tree; } $arr = $dashSections; $new = array(); foreach ($arr as $a){ $new[$a['section_parent_id']][] = $a; } // CREATE THE TREE $tree = createTree($new, $new[0]); //echo count($tree); //print_r($tree); On Thu, Aug 16, 2012 at 11:36 AM, David OBrien dgobr...@gmail.com wrote: On Thu, Aug 16, 2012 at 12:40 PM, Tristan sunnrun...@gmail.com wrote: I can't for the life of me figure out how to find the depth of the array that I'm looping through to output tabs or indentations to the display for each depth. The entries also have section postition if you can figure out how to include that within each depth of the results I will buy you a case of beer. I was hoping to do something like... foreach($trees as $tree){ if($tree['current_depth'] == 0){ echo $tree['menu_item']; } else if($tree['current_depth'] == 1){ echo 'indentation'.$tree['menu_item']; } else if($tree['current_depth'] == 2){ echo 'indentation - indentation'.$tree['menu_item']; } } Or maybe even like this... foreach($trees as $tree){ // output nbsp; the amount of times current_depth equals echo str_repeat(nbsp;, $tree['current_depth']) } I have my $tree structure as: [16] = Array ( [section_id] = 21 [section_parent_id] = 0 [section_pos] = 30 [section_name] = Resource Center [has_order] = 1 [section_has_hierarchy] = 1 [total_entries] = 35 [children] = Array ( [0] = Array ( [section_id] = 38 [section_parent_id] = 21 [section_pos] = 31 [section_name] = Resource Center [has_order] = 1 [section_has_hierarchy] = 1 [total_entries] = 35 [children] = Array ( [0] = Array ( [section_id] = 39 [section_parent_id] = 38 [section_pos] = 32 [section_name] = Resource Center [has_order] = 1 [section_has_hierarchy] = 1 [total_entries] = 35 ) [1] = Array ( [section_id] = 40 [section_parent_id] = 38 [section_pos] = 33 [section_name] = Resource Center [has_order] = 1 [section_has_hierarchy] = 1 [total_entries] = 35 ) ) [19] = Array ( [section_id] = 26 [section_parent_id] = 0 [section_pos] = 45 [section_name] = Resource Center [has_order] = 1 [section_has_hierarchy] = 1 [total_entries] = 55 [children] = Array ( [0] = Array ( [section_id] = 27 [section_parent_id] = 26 [section_pos] = 46 [section_name] = Newsletters Intro [has_order] = 0 [section_has_hierarchy] = 1 [total_entries] = 1 ) ) ) maybe something like this in the foreach if parent = 0 then level = 0; if haschilden is true increment level; How is the menu being displayed? In a browser like jquery's plugin superfish? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Bazar behavior w/ private member variables
On Thu, Jul 12, 2012 at 7:19 PM, Nathan Nobbe quickshif...@gmail.com wrote: Hi all, Strangely PHP seems to let each class have its own layer of private scope for member variables. If a subclass defines a member variable of the same name as one defined in the parent the values are maintained independently in instances of the child class. First off a simple class with a private member variable $_myPrivate, and a public accessor method which returns its value: class A { private $_myPrivate = 5; public function getMyPrivate() { return $this-_myPrivate; } } Second, a subclass, that gets weird right away, first we define a private member variable that already has been defined in the parent class, and give it a different initial value. To illustrate the behavior we have two accessor methods, setMyPrivate that uses the $this keyword to get the value of $_myPrivate, which returns the value of the subclasse's version of the variable, and getParentsMyPrivate, that calls A::getMyPrivate via the parent keyword and it returns the value of $_myPrivate as defined in the base class. class B extends A { private $_myPrivate = 6; public function setMyPrivate() { $this-_myPrivate = 6; } public function getMyPrivate() { return $this-_myPrivate; } public function getParentsMyPrivate() { return parent::getMyPrivate(); } } Look at a var_dump of an instance of B: object(B)#2 (2) { [_myPrivate:B:private]= int(6) [_myPrivate:A:private]= int(5) } clearly storage is allocated for two different values. Now I'm sure you all know that if I were to define a private method in A and try to call it from B a Fatal error is raised, something on the order of PHP Fatal error: Call to private method A::tryToCallMeFromB() from context 'B' so why the special treatment for member variables, is this supposed to be a feature? -nathan That is OOP accross all languages. If you want the child class to modify the variable, then set it to protected. Private is only accessible within that class. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is there a way to stop HTMLPurifier/CSStidy from forcing input CSS into all lowercase?
On Thu, May 31, 2012 at 11:17 PM, Govinda govinda.webdnat...@gmail.com wrote: You need to get better tools. I found this with Notepad++ for Windows searching case within *.php files filter within the root directory of the extracted zip/tarball: H:\data\Downloads\dev\PHP\htmlpurifier-4.4.0\library\HTMLPurifier\AttrDef\CSS\Font.php (6 hits) Line 45: $lowercase_string = strtolower($string); Line 46: if (isset($system_fonts[$lowercase_string])) { Line 47: return $lowercase_string; Line 61: case 0: Line 77: case 1: Line 131: case 2: Haven't looked at the entire file or source code but that looks close enough to me... ;) Thanks a lot for taking a look Tommy, I do have a decent text editor I use to code with... and had searched for possible places where is the culprit strtolower() ... and so far no matter which instances(s) I comment out, I cannot seem to turn off the behavior of the library as a whole (either of them, or both) which is forcing the input CSS to lowercase. Perhaps you should spend some time looking for a better text editor for your OS. :) When the current tools I use does not give satisfactory progress in what I'd like to do, I replace the tool(s). For example, I also just tried the exact place you suggested: this one: [snip]htmlpurifier-4.4.0\library\HTMLPurifier\AttrDef\CSS\Font.php ...and changed line 45 to this: //$lowercase_string = strtolower($string);//Govinda hack $lowercase_string = $string; but still no luck. Have you tried http://htmlpurifier.org/phorum/ and did you noticed Since the project has been suspended, please only contact me if you intend to continue maintaining it. for CSSTidy? I hadn't posted on http://htmlpurifier.org/phorum because last time I did that when I has also posted on stackoverlfow (SO), then the developer of HTMLpurifier scolded me for the dupe ;-) .. and he has already posted a comment on my (this new) SO post, saying just, Hmm, that's silly of CSS Tidy. Maybe we should change that default.. I assume he probably has a lot on his plate, to the point that his answers are incredibly terse and not necessarily very helpful. I did see the message about CSStidy no longer being developed (if that is the meaning behind suspended). Yet when i was researching it, many people were still recommending it. No? Do you know/prefer something else for the purpose of cleaning user-input CSS bound for an external style sheet? Thanks -Govinda Are you sure you fixed ALL of the offending lines containing strtolower? This is what Notepad++ returns when I search for strtolower: Search strtolower (48 hits in 28 files) H:\data\Downloads\dev\PHP\htmlpurifier-4.4.0\library\HTMLPurifier\AttrDef\CSS\Background.php (1 hits) Line 35: $bits = explode(' ', strtolower($string)); // bits to process H:\data\Downloads\dev\PHP\htmlpurifier-4.4.0\library\HTMLPurifier\AttrDef\CSS\BackgroundPosition.php (1 hits) Line 80: $lbit = ctype_lower($bit) ? $bit : strtolower($bit); H:\data\Downloads\dev\PHP\htmlpurifier-4.4.0\library\HTMLPurifier\AttrDef\CSS\Color.php (1 hits) Line 17: $lower = strtolower($color); H:\data\Downloads\dev\PHP\htmlpurifier-4.4.0\library\HTMLPurifier\AttrDef\CSS\Font.php (1 hits) Line 45: $lowercase_string = strtolower($string); H:\data\Downloads\dev\PHP\htmlpurifier-4.4.0\library\HTMLPurifier\AttrDef\CSS\ListStyle.php (1 hits) Line 30: $bits = explode(' ', strtolower($string)); // bits to process H:\data\Downloads\dev\PHP\htmlpurifier-4.4.0\library\HTMLPurifier\AttrDef\CSS\TextDecoration.php (1 hits) Line 19: $string = strtolower($this-parseCDATA($string)); H:\data\Downloads\dev\PHP\htmlpurifier-4.4.0\library\HTMLPurifier\AttrDef\CSS.php (2 hits) Line 51: $property = strtolower($property); Line 59: if (strtolower(trim($value)) !== 'inherit') { H:\data\Downloads\dev\PHP\htmlpurifier-4.4.0\library\HTMLPurifier\AttrDef\Enum.php (2 hits) Line 7: * built-in strtolower and ctype_lower functions, which may Line 40: $string = ctype_lower($string) ? $string : strtolower($string); H:\data\Downloads\dev\PHP\htmlpurifier-4.4.0\library\HTMLPurifier\AttrDef\HTML\Color.php (1 hits) Line 17: if (isset($colors[strtolower($string)])) return $colors[$string]; H:\data\Downloads\dev\PHP\htmlpurifier-4.4.0\library\HTMLPurifier\AttrDef\HTML\LinkTypes.php (1 hits) Line 39: $part = strtolower(trim($part)); H:\data\Downloads\dev\PHP\htmlpurifier-4.4.0\library\HTMLPurifier\AttrDef\Lang.php (3 hits) Line 35: $subtags[0] = strtolower($subtags[0]); Line 50: if (!ctype_lower($subtags[1])) $subtags[1] =
Re: [PHP] is there a way to stop HTMLPurifier/CSStidy from forcing input CSS into all lowercase?
On Thu, May 31, 2012 at 10:33 PM, Govinda govinda.webdnat...@gmail.com wrote: Hi guys anyone here using HTMLpurifier and CSStidy together? (like e.g. to allow users to create their own external style sheets via form input) ...for example, in the way this post's answer explains how to use HTMLpurifier and CSStidy together: http://stackoverflow.com/questions/3241616/ If so, do you know how to set CSStidy's config options in that context? I found how to set CSStidy's config options if I was running CSStidy from the command line, or on its _own_ from PHP runtime, but I do not know how to set the config options from within HTMLpurifier, or even how to hack/override either of those libraries to solve my particular issue. I looked and hacked and thought for sure I would find the offending line of code.. but somehow, nothing I have tried is stopping one or both of those libraries from forcing all my input CSS into lowercase, which I do not want. The issue is that I need the input CSS's case to be left as the user input it (so that for example background image paths in that CSS do not break). more details, attempted fixes, etc.: http://stackoverflow.com/questions/10843600/ Thanks for any thoughts/tips of any kind -Govinda Have you tried http://htmlpurifier.org/phorum/ and did you noticed Since the project has been suspended, please only contact me if you intend to continue maintaining it. for CSSTidy? Regards, Tommy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is there a way to stop HTMLPurifier/CSStidy from forcing input CSS into all lowercase?
On Thu, May 31, 2012 at 10:48 PM, Tommy Pham tommy...@gmail.com wrote: On Thu, May 31, 2012 at 10:33 PM, Govinda govinda.webdnat...@gmail.com wrote: Hi guys anyone here using HTMLpurifier and CSStidy together? (like e.g. to allow users to create their own external style sheets via form input) ...for example, in the way this post's answer explains how to use HTMLpurifier and CSStidy together: http://stackoverflow.com/questions/3241616/ If so, do you know how to set CSStidy's config options in that context? I found how to set CSStidy's config options if I was running CSStidy from the command line, or on its _own_ from PHP runtime, but I do not know how to set the config options from within HTMLpurifier, or even how to hack/override either of those libraries to solve my particular issue. I looked and hacked and thought for sure I would find the offending line of code.. but somehow, nothing I have tried is stopping one or both of those libraries from forcing all my input CSS into lowercase, which I do not want. The issue is that I need the input CSS's case to be left as the user input it (so that for example background image paths in that CSS do not break). You need to get better tools. I found this with Notepad++ for Windows searching case within *.php files filter within the root directory of the extracted zip/tarball: H:\data\Downloads\dev\PHP\htmlpurifier-4.4.0\library\HTMLPurifier\AttrDef\CSS\Font.php (6 hits) Line 45: $lowercase_string = strtolower($string); Line 46: if (isset($system_fonts[$lowercase_string])) { Line 47: return $lowercase_string; Line 61: case 0: Line 77: case 1: Line 131: case 2: Haven't looked at the entire file or source code but that looks close enough to me... ;) more details, attempted fixes, etc.: http://stackoverflow.com/questions/10843600/ Thanks for any thoughts/tips of any kind -Govinda Have you tried http://htmlpurifier.org/phorum/ and did you noticed Since the project has been suspended, please only contact me if you intend to continue maintaining it. for CSSTidy? Regards, Tommy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Crudin - CRUD INterface Generator - Open Source Project
On Fri, May 25, 2012 at 3:53 PM, Maciek Sokolewicz maciek.sokolew...@gmail.com wrote: On 25-05-2012 23:09, Rodrigo de Almeida Rodriguez wrote: Hi, I am the creator of a open source project called Crudin (http://crudin.smarc.com.br/en) Crudin is a system for generation of fron-ends in the MySQL, writted in PHP Without needing to program nothing you get a complete platform with operations CRUD (Create, Read, Update and Delete) and much more Crudin mounts relations, to make upload of archives and images, treat fields enum/set and much more All you need is any MySQL database! Hi Rodrigo, I must admit I am having trouble understanding what you're making here. I tried looking at your demo page, but since it's half-Portuguese, and half(-crud)-English, it makes it impossible for me to understand even half of what it says. Could you please explain, properly, what your system DOES exactly, and why I would want to use it? Because currently I just don't understand what it is supposed to help me with exactly. hmm.. Demo Login New Table ... Erro: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY `new table`.`id` desc LIMIT 0, 60' at line 1 What is the purpose of your framework? From the documentation, I can see that it has tables of permissions for the users. Looking at the permission table, it seems you're attempting to replicate MySQL permission. If its purpose is generate the UI for CRUD, how comparable is it to Yii? When you just specify the table name in GUI, Yii generates the entire UI with client side validation also, IIRC. In the back-end, it has a class for that table and retrieves the table data into the class objects via ORM. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Serving a .dmg via readfile?
On Wed, Apr 25, 2012 at 8:54 PM, Brian Dunning br...@briandunning.com wrote: Hey all - I'm having no luck serving a .dmg from my online store. I stripped down the code to just the following to debug, but no matter what I get a zero-byte file served: header('Content-Type: application/x-apple-diskimage'); // also tried octet-stream header('Content-Disposition: attachment; filename=My Cool Image.dmg'); $size = filesize('/var/www/mypath/My Cool Image.dmg'); header('Content-Length: '.$size); readfile('/var/www/mypath/My Cool Image.dmg'); This same code works for a number of other file types that I serve: bin, zip, pdf. Any suggestions? Professor Google is not my friend. -- Maybe file size limit somewhere? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Serving a .dmg via readfile?
On Wed, Apr 25, 2012 at 9:04 PM, Tommy Pham tommy...@gmail.com wrote: On Wed, Apr 25, 2012 at 8:54 PM, Brian Dunning br...@briandunning.com wrote: Hey all - I'm having no luck serving a .dmg from my online store. I stripped down the code to just the following to debug, but no matter what I get a zero-byte file served: header('Content-Type: application/x-apple-diskimage'); // also tried octet-stream header('Content-Disposition: attachment; filename=My Cool Image.dmg'); $size = filesize('/var/www/mypath/My Cool Image.dmg'); header('Content-Length: '.$size); readfile('/var/www/mypath/My Cool Image.dmg'); This same code works for a number of other file types that I serve: bin, zip, pdf. Any suggestions? Professor Google is not my friend. -- Maybe file size limit somewhere? Forgot to mention that your code doesn't check the result [1]. If it was this instead: header('Content-Type: application/x-apple-diskimage'); // also tried octet-stream header('Content-Disposition: attachment; filename=My Cool Image.dmg'); $size = filesize('/var/www/mypath/My Cool Image.dmg'); header('Content-Length: '.$size); if (readfile('/var/www/mypath/My Cool Image.dmg') === false) die ('Error readfile ...'); Or alternatively, use xdebug in your dev environment. ;) HTH, Tommy [1] http://php.net/readfile -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SqLite INSERT want not write
On Thu, Apr 19, 2012 at 12:40 PM, siefke_lis...@web.de siefke_lis...@web.de wrote: Hello, On Thu, 19 Apr 2012 15:17:06 -0400 Steven Staples sstap...@mnsi.net wrote: Ok, so I was wrong... ;) it does happen Try this: $sql = INSERT INTO bloggen (date, autor, title, teaser, content) VALUES (' . date('Y-m-d H:i:s') . ', :autor, :title, :teaser, :content);; No errors, but no entry in the database. Or $sql = INSERT INTO bloggen (date, autor, title, teaser, content) VALUES (NOW(), :autor, :title, :teaser, :content);; PDOException: SQLSTATE[HY000]: General error: 1 no such function: NOW Now is not availible in Sqlite, can use date, Technically, it's date('now') per [1] :) RTFM FTW! http://www.sqlite.org/draft/lang_datefunc.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Customized Session Handler can not work for PHP 5.1.6 and CentOS 5.5
On Sat, Apr 14, 2012 at 9:27 AM, Mingda mingda...@gmail.com wrote: Hi, All, System: CentOS 5.5; PHP version is 5.1.6. I met a strange problem associate with session_save_handler in current environment(The same code can work well in my local windows platform and ubuntu system). This is your clue on how to fix. What version of PHP are on Windows and Ubuntu? If different, perhaps upgrade your CentOS' PHP? If the same exact version on all 3 OSes, then consult CentOS :). HTH, Tommy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php in windows
On Mon, Apr 9, 2012 at 7:05 PM, Kirk Bailey kbai...@howlermonkey.net wrote: The edition of php for windows I instaklled does not work. Which flavor of windows php DOES work properly in windows? -- Did you configure it properly??? I've run it fine from XP (x86 x64), Win2003 (x86 x64) Win2008 (x86 x64), Win7 (x64), and Win2008R2. Easiest is get IIS7 or IIS7.5 (Vista, Win08, Win7, Win2008R2 - including in a VM) and current version IIS PHP Manager. HTH, Tommy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] desk top interactive environment
On Mon, Apr 9, 2012 at 6:54 PM, Kirk Bailey kbai...@howlermonkey.net wrote: I am not ABLE to create it yet. Anyone else able to? Hmm... Google php desktop ... notice the 2nd link. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image inventoryer
On Thu, Apr 5, 2012 at 7:26 PM, Kirk Bailey kbai...@howlermonkey.net wrote: Now ai am still a novice at p[hp, how can I do this ? Have you read any book on PHP? even the official from PHP.net? Learn the tool so you know how to use it, efficiently. Otherwise how do you know if the tool can do what you want... What you're asking for ATM is someone to write the code for you which is not how it works. You need to provide some code, or even pseudo code at least... HTH, Tommy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image inventoryer
On Thu, Apr 5, 2012 at 8:02 PM, Kirk Bailey kbai...@howlermonkey.net wrote: If you don't want to read the manual or a book, you could quickly do some Google'ing as below: ok. ?php filelist=inventory all files in directory ./ filesystem site:php.net for file in filelist: // walk a listing of many items loop site:php.net IF filetype in gif, jpg, png { condition site:php.net echo 'img src=./'.file.'P' // notice that is a 'singlequote' immedately followed by a doublequote. ? Or just look at the table of contents in the official manual to see what PHP has to offer and see what you can do since you already have some programming experience. Something like this. In python I would write something like: #!/usr/bin/python import string, glob files=glob.glob(./*.*) # files is a list variable (a 1 dimensional addressable array) for file in files: # for each cell in files do this doblock: if str.split(file,'.')[1] in gif,jpg,png): #if the file type is in a list of acceptable types, print 'img src=./'+file+'P' # print out the material to return surrounding # the file name On 4/5/2012 10:34 PM, Tommy Pham wrote: On Thu, Apr 5, 2012 at 7:26 PM, Kirk Baileykbai...@howlermonkey.net wrote: Now ai am still a novice at p[hp, how can I do this ? Have you read any book on PHP? even the official from PHP.net? Learn the tool so you know how to use it, efficiently. Otherwise how do you know if the tool can do what you want... What you're asking for ATM is someone to write the code for you which is not how it works. You need to provide some code, or even pseudo code at least... HTH, Tommy PS: don't top post since it's preferred on this list. You can search the archive for the discussion about it. HTH, Tommy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Adding Rows In PHPMYADMIN
On Mon, Apr 2, 2012 at 5:46 PM, Karl James karlja...@tampabay.rr.comwrote: Hello, ** ** Hey guys, I figured out my critical error. I have a table that has a limit of 30 rows. How can I add more rows to a table so that we can upload more images? Below is what I need to change. ** ** Thanks, karl ** ** ** ** *Indexes: **[image: Description: Documentation]*http://dev.mysql.com/doc/refman/5.0/en/optimizing-database-structure.html ** *Keyname* *Type* *Cardinality* *Action* *Field* *PRIMARY* PRIMARY 30 [image: Description: Edit]http://www.axiton.com:444/phpMyAdmin/tbl_indexes.php?db=axitontable=producttoken=879a7b6914f690825a521dd29c2f0736goto=tbl_structure.phpback=tbl_structure.phpindex=PRIMARYphpMyAdmin=0b5ebd941a4bbe87db1e38f60fd10dadec30e8e7 [image: Description: Drop]http://www.axiton.com:444/phpMyAdmin/sql.php?db=axitontable=producttoken=879a7b6914f690825a521dd29c2f0736goto=tbl_structure.phpback=tbl_structure.phpsql_query=ALTER+TABLE+%60product%60+DROP+PRIMARY+KEYzero_rows=The+primary+key+has+been+droppedphpMyAdmin=0b5ebd941a4bbe87db1e38f60fd10dadec30e8e7 product_id ** ** ** ** ** ** Karl James karlja...@tampabay.rr.com Need Web Design Check Out My Site: http://kjwebsitedesign.com *Flexible in Cost, Time, and Service.* ** ** 1) Wrong list for the question 2) Since you've chosen this line of profession, pick up a SQL Fundamentals or Fundamentals of SQL book HTH, Tommy
Re: [PHP] whats wrong
On Fri, Mar 30, 2012 at 11:45 PM, saeed ahmed mycomputerbo...@gmail.com wrote: i have made a php script with a tutorial helpi dont know where is a error.please have a look Your code below assumes that everything is perfect in your world. IE: no network connectivity issue, all firewall related are properly configured, the user account actually exists and have the right permissions, the database exists and so are the table(s), etc I suggest you revisit the official PHP manual and read about each function you're using. ?php //connect and select a database mysql_connect(localhost,root, ); for starters, http://php.net/function.mysql-connect Noticed the result returned. You didn't bother to check whether if it's successful or not. If not why not? Since the DB is on the same box, is the firewall, if any, configured properly? If there's no firewall or if it's configured properly, is the account valid and have the right permissions? Is the MySQL server running on the default port 3306? If you don't know how to configure each of the above mentioned, allow me to introduce you a new friend, Google ;) Both of those topics are beyond the scope of this list. HTH, Tommy mysql_select_db(addressbook); //Run a query $result=mysql_query(select(SELECT*FROM COLLEAGUE); ? !DOCTYPE html PUBLIC-//w3c//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head titleAddress Book/title meta http-equiv=content-type content=text/html;charset=utf-8 /head body h1Address Bookh1 table Border=1 cellpadding=2cellspacing=3 summary=table holda colleague contacts information tr th ID/th thFirst Name/th thLast Name/th thTelephone/th thEmail Address/th /tr ?php //LOOP through all table rows while ($row=mysql_fetch_array($result)) { echotr; echotd.$row['id'] . /td; echo td . $row['firstName'] . /td; echo td . $row['lastName'] . /td; echo td . $row['telephone'] . /td; echo td . Srow['email'] . /td; echo/tr; } //free result memory and close database connection mysql_free_result($result); mysql_close(); ? /table /body /html thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] some good deals on good books
On Sat, Mar 31, 2012 at 12:02 AM, tamouse mailing lists tamouse.li...@gmail.com wrote: ( I apologize if this offends anyone's sensibilities. I am not in the employ of O'Reilly, nor is this going to make me any scratch. I just think this is a good chance to pick up some pretty useful books. ) Makes a lot of sense to me for someone kind enough to share a great offer to fellow coders/hackers :) Thanks. I'll pass this along to the folks newly interested in PHP. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Got HTML5 History API + caching LICKED, I think, grin
On Fri, Mar 16, 2012 at 1:45 PM, Stuart Dallas stu...@3ft9.com wrote: As for my files and homepage being Huge, yep, it's made for the future or current fast internet connections. Frankly, size reduction is not on my agenda. I'll wait for the nets to become faster still. And the server should spit it out at 2MB/s at least.. That may be so, but when my 100Mbit/s connection finally managed to download the file it took about 4 minutes, which is nowhere near 2MB/s. Your homepage takes 7 seconds to load - that's unacceptable in the real world, especially when you're talking about a server that's (and I'm only guessing here) not under heavy load. Anyway, your comment about waiting for the nets (sic) to catch up so it can cope with your bloat has convinced me to not bother looking any further into your project, but I wish you the best of luck with it (you're gonna need it). -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ Yup... I think rene forgot the fact is if each client requests pull 1MB/s , his upload has to be at least 120MB/s for 100 simultaneous clients' connections. Last time I check in ISP services, that bandwidth falls within OC-12+ category -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL over TCP results on CLOSE_WAIT state in PHP 5.3.8
On Mon, Mar 5, 2012 at 7:33 AM, php-l...@dubistmeinheld.de wrote: I have a MySQL server A, a server B with PHP 5.3.8 and a server C with PHP 5.3.3. I'm connecting to the MySQL server on A via TCP from B and C using an internal network. Server B and C use the same PHP application. There are also same PHP scripts that get data from the database and then calculate up to 30 minutes. I close all database connection before doing the calculation to save connections (and ports) using: $thread_id = mysqli_thread_id( $this-handle ); mysqli_kill( $this-handle, $thread_id ); mysqli_close( $this-handle ); During a review on our servers I discovered that server B has a lot of network connection in the state CLOSE_WAIT. Server C running the same PHP application has not. I see the difference that server B is using mysqlnd and server C not. serverB# netstat -an | grep 3306 tcp 1 0 10.8.0.58:47455 10.8.0.1:3306 CLOSE_WAIT serverA# cat firewall Feb 17 16:21:49 www kernel: [6587053.325075] SFW2-OUT-ERROR IN= OUT=tun0 SRC=10.8.0.1 DST=10.8.0.58 LEN=40 TOS=0x00 PREC=0x00 TTL=64 ID=0 DF PROTO=TCP SPT=3306 DPT=47455 WINDOW=0 RES=0x00 RST URGP=0 Does anybody have an idea why this happens? How can I avoid this or investigate in this? Is this a know issue? Is the underlying OS for servers B C exactly the same? Down to kernel version (if Linux/Unix), NICs and driver version, configurations, etc.? It would help if specify OS type and kernel version. No, client B and C have different OS versions. You are right this can be a reason too. Do you have any hints how I can trace that down? Details client B (newer OS with CLOSE_WAIT problems): $ uname -a Linux www3 3.1.9-1.4-default #1 SMP Fri Jan 27 08:55:10 UTC 2012 (efb5ff4) x86_64 x86_64 x86_64 GNU/Linux $ mysql --version mysql Ver 14.14 Distrib 5.5.16, for Linux (x86_64) using readline 6.2 $ ethtool -i eth0 driver: r8169 version: 2.3LK-NAPI firmware-version: rtl_nic/rtl8168e-2.fw bus-info: :04:00.0 supports-statistics: yes supports-test: no supports-eeprom-access: no supports-register-dump: yes Details client C: $ uname -a Linux www13 2.6.34.10-0.4-default #1 SMP 2011-10-19 22:16:41 +0200 x86_64 x86_64 x86_64 GNU/Linux $ mysql --version mysql Ver 14.14 Distrib 5.1.57, for suse-linux-gnu (x86_64) using readline 6.1 $ ethtool -i eth0 driver: r8169 version: 2.3LK-NAPI firmware-version: bus-info: :04:00.0 Server A: Linux www 3.1.9-1.4-default #1 SMP Fri Jan 27 08:55:10 UTC 2012 (efb5ff4) x86_64 x86_64 x86_64 GNU/Linux $ mysql --version mysql Ver 14.14 Distrib 5.5.16, for Linux (x86_64) using readline 6.2 $ ethtool -i eth0 driver: r8169 version: 2.3LK-NAPI firmware-version: rtl_nic/rtl8168e-2.fw bus-info: :04:00.0 supports-statistics: yes supports-test: no supports-eeprom-access: no supports-register-dump: yes I also have set wait_timeout 45 in my.cnf on server A and mysqli.reconnect On on client B and C in php.ini. Troubleshooting that much variances will take a lot of time. Do you have root access? Was the OS installed via standard distribution? Did someone reconfigured and recompiled the kernel and system? I'd suggest you start compiling from source of the following: * MySQL client - same version (preferred) or newer than server (make sure config is the same on both boxes for PHP) * compile PHP thereafter Then you'll know if it's the OS related or not (ie: configuration, kernel version, etc.) Also, your kernel versions doesn't seem to be stable per [1]. You might want to check each flavor's distributor. Just out of curiosity, are both boxes (B C) are the same Linux flavor? Best regards, Tommy [1]http://www.kernel.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Nested database loops and completing an unordered list....
On Thu, Mar 1, 2012 at 6:29 AM, Jay Blanchard jay.blanch...@sigmaphinothing.org wrote: Good morning PHP groupies! I am working on this tool that will ultimately display a collapsible org chart. The org chart is based on a nested unordered list and that is the heart of my question. The NUL(nested unordered list) is based on a set of database queries - sometimes as many as 14 queries. Each query relies on data returned by all of the the queries before it. So what I am doing right now is this - query generates a list item while this list item get the next level dependent upon this item query generates this list item while this list item get the next level dependent on each list item above ...and so on. (I have written about this before and thought I had it solved, but alas, that is not the case.) The result needs to be something like this: ul lilevel a ul lilevel b/li // has no children lilevel b ul lilevel c/li /ul /li /ul /li /ul This is a semantically and syntacticallycorrect UL. Keep in mind that this can go many levels deeper. The hardest part, and the part that I am looking to accomplish, is closing the list items properly regardless of how deep the tree is. If properly handled this could even be made into JSON with the proper syntax, but I am not worried about that now. I was hoping that a fresh set of eyes would point me to a solution that I obviously cannot see at the moment. Thanks! Jay Your situation sounds like list of categories for a e-commerce site. Each category (like a person) is unique and may have a parent category (boss) like that of a CEO. ** table structure: CREATE TABLE IF NOT EXIST employees ( employeeID INT NOT NULL PRIMARY KEY, bossID INT NOT NULL DEFAULT '0', firstName VARCHAR(50) NOT NULL, middle VARCHAR(50) NOT NULL, lastName VARCHAR(50) NOT NULL ) ** SQL query: SELECT * FROM employees ORDER BY bossID; ** PHP pseudo code: // $employees = array(0 = array()); // CEO doesn't have a boss thus you get his/her info via $bigBossID = $employees[0]['subordinates'][0]; // connect to DB // execute query // iterate results while ($row = $result-fetch_assoc()) { $employees[$row['employeeID']] = $row; if (!empty($row['bossID']) $employees[$row['bossID']]['subordinates'] = $row['employeeID']; } // free result // close connection if need be You can get any person's info via $employees[$employeeID] and get the manager/director/VP/etc subordinates: if (isset($employees[$employeeID]['subordinates']) !empty($employees[$employeeID]['subordinates'])) foreach ($employees[$employeeID]['subordinates'] = $subordinateID) { // access subordinate's info via $employees[$subordinateID] } else echo {$employees[$employeeID]['firstName']} does not have subordinates.; If there's any organizational change, the code still works. HTH, Tommy Disclaimer: the above syntax is from memory. I haven't done SQL manipulation or PHP coding in over a year ;) so check and adjust accordingly to your RDBMS and application's design. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Nested database loops and completing an unordered list....
On Thu, Mar 1, 2012 at 4:36 PM, Jay Blanchard jay.blanch...@sigmaphinothing.org wrote: [snip]…stuff…[/snip] I am getting close, but I am also getting frustrated. I probably need to walk away for a bit. I have an array of tiers…. Array ( [0] = TIER1DATA [1] = TIER2DATA [2] = TIER3DATA [3] = BUSTIER1DATA [4] = BUSTIER2DATA [5] = BUSTIER3DATA [6] = BUSTIER4DATA ) Each of the tiers which represent parents in children in pairs. TIER1DATA is the parent of TIER2DATA, etc. representing 7 columns of data. snip/ How are those tiers assembled? Do you know what the table structure is? Can you disclose it in an obfuscate fashion? You're asking for help on the best way to retrieve and manipulate the data in PHP but you haven't disclose how it's represented at the source. That's like asking us how to get water without telling the location of the water: ocean, lake, underground, etc.. You get the idea. Best regards, Tommy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I enable more useful PHP error logging?
On Tue, Feb 28, 2012 at 3:14 PM, Daevid Vincent dae...@daevid.com wrote: My question is, is there a way to enable some PHP configuration that would output more verbose information, such as a backtrace or the URL attempted? Have you looked at log4php? [1] It's a log4j (Java based) logging facility port to PHP. IIRC for log4j, you can do various logging from FINEST, FINER, FINE, INFO, WARNING, ERROR (?), SEVERE levels within the application. You can adjust levels as needed at run time. You may want to have a wrapper that will do back trace and record the requested URL. The log4* facility does rolling file logging, DB, e-mail, syslog, etc. (I've used the log4j and log4net before.) Very handy and flexible, IMO. HTH, Tommy [1] http://logging.apache.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL over TCP results on CLOSE_WAIT state in PHP 5.3.8
On Mon, Feb 27, 2012 at 4:06 AM, php-l...@dubistmeinheld.de wrote: Hi, I have a MySQL server A, a server B with PHP 5.3.8 and a server C with PHP 5.3.3. I'm connecting to the MySQL server on A via TCP from B and C using an internal network. Server B and C use the same PHP application. There are also same PHP scripts that get data from the database and then calculate up to 30 minutes. I close all database connection before doing the calculation to save connections (and ports) using: $thread_id = mysqli_thread_id( $this-handle ); mysqli_kill( $this-handle, $thread_id ); mysqli_close( $this-handle ); During a review on our servers I discovered that server B has a lot of network connection in the state CLOSE_WAIT. Server C running the same PHP application has not. I see the difference that server B is using mysqlnd and server C not. serverB# netstat -an | grep 3306 tcp 1 0 10.8.0.58:47455 10.8.0.1:3306 CLOSE_WAIT serverA# cat firewall Feb 17 16:21:49 www kernel: [6587053.325075] SFW2-OUT-ERROR IN= OUT=tun0 SRC=10.8.0.1 DST=10.8.0.58 LEN=40 TOS=0x00 PREC=0x00 TTL=64 ID=0 DF PROTO=TCP SPT=3306 DPT=47455 WINDOW=0 RES=0x00 RST URGP=0 Does anybody have an idea why this happens? How can I avoid this or investigate in this? Is this a know issue? Is the underlying OS for servers B C exactly the same? Down to kernel version (if Linux/Unix), NICs and driver version, configurations, etc.? It would help if specify OS type and kernel version. Best regards, Tommy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: [PHP] What's Your Favorite Design Pattern?
On Tue, Feb 7, 2012 at 2:31 PM, Paul M Foster pa...@quillandmouse.com wrote: On Tue, Feb 07, 2012 at 09:02:00PM +, Tim Streater wrote: On 07 Feb 2012 at 19:34, Daniel Brown danbr...@php.net wrote: On Tue, Feb 7, 2012 at 13:56, Mike Mackintosh mike.mackint...@angrystatic.com wrote: I was curious to see what everyones favorite design patterns were, if you use any, and why/when have you used it? Choices include slots and signals (observer), singleton, mvc, hmvc, factory, commander etc.. Mine is apparently CPSV (Commentless Procedural Spaghetti Vomit), as that's what I encounter no less than 80% of the time in the wild. Since I have no idea what anyone is talking about, I can only conclude that you're playing Mornington Crescent (q.v.), on a non-standard board. -- Cheers -- Tim Design Patterns are Way Nifty Kewl patterns of code which are supposed to facilitate certain types of operations. (Was that sarcasm you detected? Yes it was.) For example, the Singleton pattern. Let's say you had a configuration class that held the configuration values for your application, and you wanted to make sure there was only one object of that class instantiated, no matter how many times it was called in your code. You'd arrange the code and call the class in a certain way to ensure that only one object of that class resulted. To make your configuration class a singleton, you'd probably make the class have a *private* constructor (so no outside routine could call it), and then provide a method called get_instance() which tested for the existence of an object of that class. If such an instance was found, someone calling configuration::get_instance() would simply get the existing object returned to them. Otherwise, configuration::get_instance() would instantiate the class and then return the new object to the caller. As you can see, that's a peculiar way of setting up your code for a specific purpose. Other design patterns do other things and dictate setting up things in other ways. Here's a code example of the above explanation: http://pastebin.com/mTrybi6u HTH, Tommy The definitive work on this (and where it first gained the most publicity) is a book called Design Patterns by four authors (Gamma, Helm, Johnson and Vlissides). It essentially contains a chapter about each (known at the time) design pattern and some pseudocode about how it might be constructed. I imagine the authors looked at a lot of code and discovered that programmers were coming up with code that, in each case was remarkably similar for solving certain types of programming problems. So they codified what that found and wrote a book about it. I have the book on my shelf, and it's decent technology, but you could spend your whole career and never use any of it, and get along just fine. Paul -- Paul M. Foster http://noferblatz.com http://quillandmouse.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] any security issues with this mysql_update function?
On Fri, Jan 13, 2012 at 7:52 PM, Haluk Karamete halukkaram...@gmail.com wrote: I wrote a function sql_update which takes a $db_name, a $table_name, a $where and finally a $data array where data is authored by using an associative array which allows easy the pairing of field names and field values. This is how I build the data array; $data = array( 'FirstName' = 'John', 'LastName' = Smith, 'Age' = 90, ); and this is how I call the function sql_update(blueprint2012,test_table,where PersonID=1,$data); And this does it for me, does it very easy and convenient, but I've got a concern... If you kindly take a look at the function that does the work sql_update posted below, therein you will see a mysql_real_escape_string being used in an array_map operation. The question is would simply having mysql_real_escape_string in there will protect me from a SQLInjection? Is it that good? Or do you think this kind of stuff should be handled before the function is called at $data building time? This approach of course would then nullify the need of using mysql_real_escape_string within the below function. I'm inclining towards the idea that the below function *should* just assume that the data is safe ( and therefore not use mysql_real_escape_string ) and that before I call the function, I should take care of the SQLInjection stuff more transparently, so that $data is safe and sound as far as both sqlinjection and htmlencode against XSS. But then again, if mysql_real_escape_string does the job well and good enough, why worry? what say you? function sql_update($db_name,$table_name,$where,$data) { //dies out if something wrong. //returns $the_number_of_records_effected, if any //following 3 lines take care of the connection bp_conn($db_name,$db_server,$db_username,$db_pass); $link = mysql_connect($db_server, $db_username, $db_pass) or die(mysql_error()); mysql_select_db($db_name, $link) or die(mysql_error()); $values = array_map('mysql_real_escape_string', array_values($data)); $keys = array_keys($data); $i=-1; $string = SET ; foreach ($keys as $item) { $i++; $string = $string . ` . $item . `=' . $values[$i] . ', ; } //echo [ . $string . ]; // [SET `FirstName`='John', `LastName`='Smith', `Age`='90', ] $string = bp_cutthelast($string,2) . . $where; //echo [ . $string . ]; // [SET `FirstName`='John', `LastName`='Smith', `Age`='90'] $update_sql_statement = 'UPDATE `'.$table_name. ` . $string; //echo $update_sql_statement; //outputs UPDATE `test_table` SET `FirstName`='John', `LastName`='Smith', `Age`='90' where PersonID=1 if (mysql_query($update_sql_statement,$link )) { return mysql_affected_rows ($link); mysql_close($link); } else { echo error SQL FAILS . mysql_error(); mysql_close($link) ; die; return null; } } Use MySQLi library and simplify your life [1]. Best regards, Tommy [1] http://php.net/class.mysqli and http://php.net/class.mysqli-stmt and http://php.net/class.mysqli-result -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] reporting errors when $ sign is missing in front of a variable
On Wed, Jan 11, 2012 at 8:43 PM, Haluk Karamete halukkaram...@gmail.com wrote: Hi, I'm coming from ASP background. There, there is a life saver option called option explicit. It forces you to declare your variables using the dim statement. The good thing about that is that if you were to mis-spell one of your variables, asp.dll throws an error stating that on line so and so, variable so and so not declared. This allows you to immediately fix the error saving lots of time. If you did not use option explicit, then that misspelled variable would not have caused any error and you woud have spent much more time debugging your app as to what went wrong where. Now, I undersand with PHP, that we do not have a variable declaration per se; you put a $ sign in front of a word, and that becomes a variable. Since in asp, we do not use $ much. I keep forgetting that. I first declare a var and set a value for it using the $. But then I refer to the darned thing, without the $. And there are no errors. Ths behaviour seems extremely odd to me. How do I achieve the functionality that if I forget to use $ sign for a previously declared variable, php throws me an error. example $my_var = 90; echo my_var; I want an error to be thrown in line 2. what do I need to do? I was assuming that since there is no function titled my_var, PHP would have complain right there and then. But instead, it simply echoes my_var. I would have expected my_var to be outputted only if I were to write echo my_var;. This beats me. At the top of my page, I already have this ?php error_reporting (E_ALL ^ E_NOTICE); ? Haluk This works for me in development environment without a debugger setup using a web browser (note that I'm using 5.4RC2 so the default behavior of error_reporting(E_ALL) is different [1]: Notice: Use of undefined constant my_var - assumed 'my_var' in F:\dev\sites\wwwroot\php_apps\test.php on line 5 my_var ?php error_reporting(E_ALL); ini_set('display_errors', 'on'); $my_var = 90; echo my_var; highlight_file(__FILE__); Good luck, Tommy [1] http://php.net/function.error-reporting -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-WIN] 5.3.9RC2 and 5.4RC2
On Mon, Nov 28, 2011 at 1:34 AM, Pierre Joye pierre@gmail.com wrote: On Mon, Nov 28, 2011 at 5:51 AM, Tommy Pham tommy...@gmail.com wrote: Can someone please confirm if you're able to create/drop MySQL database on using phpMyAdmin with PHP 5.3.9RC2 or PHP5.4RC2? Please use the sqlsrv or mysql functions directly with CREATE/DROP queries in a little script, it will be easier to debug. Cheers, -- Pierre @pierrejoye | http://blog.thepimp.net | http://www.libgd.org I don't know what happened last night. After about 2 hours trying to make some progress but failed, I called it a night. I just tried again to see if I had the same problems as last night. Apparently, I don't, even after several attempts to duplicate last night problems. Anyway, I got a few things setup to facilitate troubleshooting the compatibilities, including bug report Doc #60404. Here comes a wall of text from about 5-6 hours of testing, mostly for sqlsrv ... LOL. 5.3.5 5.3.9RC2 5.4.0RC2 error_reporting E_ALL ~E_DEPRECATED ~E_STRICT 22527 22527 22527 file_uploads On On On log_errors On On On log_errors_max_len 0 0 0 max_execution_time 300 300 300 max_input_time 60 60 60 memory_limit 128M 128M 128M post_max_size 20M 20M 20M upload_max_filesize 20M 20M 20M Drupal 7.9 + MySQL 5.5-rc install OK OK OK Drupal 7.9 + MySQL 5.5-rc using1 OK OK OK Drupal 7.9 + SQL Server 10.50.2500 install OK Error[3] Error[4] Drupal 7.9 + SQL Server 10.50.2500 using1 OK partial[2] partial[2] SQL Server install - Working Set (memory) 186,636K SQL Server install - Private Working Set (memory) 145,760K SQL Server install - Commit Size (memory) 147,736K MySQL install - Working Set (memory) 123,552K MySQL install - Private Working Set (memory) 86,332K MySQL install - Commit Size (memory) 87,648K 1. Create and Edit the short article in the home page in each PHP version. 2. Sometimes generates HTTP Error 500.0 when reading/creating/editing a new article. 3. Always receive HTTP Error 500.0 after creating about 25 tables out of 73 max. 4. SQLSTATE[IMSSP]: An error occurred substituting the named parameters. For 5.3.5 and 5.3.9RC2, sqlsrv driver is the same (ExtensionVer) version 2.0.1802.200 and I have xdebug trace logs of every execution. I didn't bother with the memory comparison for 5.3.9RC2 and 5.4.0RC2 since Drupal 7.9 failed to install for sqlsvr. There error_log file doesn't have any errors prior to and when PHP crashed suddenly, generating the HTTP 500. 5.3.5 has 62 extensions: Core, PDO, PDO_ODBC, Phar, Reflection, SPL, SimpleXML, bcmath, bz2, calendar, cgi-fcgi, com_dotnet, ctype, curl, date, dom, enchant, ereg, exif, filter, ftp, gd, gettext, gmp, hash, iconv, imap, intl, json, ldap, libxml, mbstring, mcrypt, mhash, mysql, mysqli, mysqlnd, odbc, openssl, pcre, pdo_mysql, pdo_pgsql, pdo_sqlsrv, pgsql, session, shmop, soap, sockets, sqlsrv, standard, tidy, tokenizer, wddx, wincache, xdebug, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, zlib 5.3.9RC2 has 63 extensions: Core, PDO, PDO_ODBC, Phar, Reflection, SPL, SimpleXML, bcmath, bz2, calendar, cgi-fcgi, com_dotnet, ctype, curl, date, dom, enchant, ereg, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, imap, intl, json, ldap, libxml, mbstring, mcrypt, mhash, mysql, mysqli, mysqlnd, odbc, openssl, pcre, pdo_mysql, pdo_pgsql, pdo_sqlsrv, pgsql, session, shmop, soap, sockets, sqlsrv, standard, tidy, tokenizer, wddx, wincache, xdebug, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, zlib 5.4.0RC2 has 60 extensions: Core, PDO, PDO_ODBC, Phar, Reflection, SPL, SimpleXML, bcmath, bz2, calendar, cgi-fcgi, com_dotnet, ctype, curl, date, dom, ereg, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, imap, intl, json, ldap, libxml, mbstring, mcrypt, mhash, mysql, mysqli, mysqlnd, odbc, openssl, pcre, pdo_mysql, pdo_pgsql, pdo_sqlsrv, pgsql, session, shmop, soap, sockets, sqlsrv, standard, tidy, tokenizer, wddx, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, zlib If anyone is interested, here's my code for cleaning the db automatically and reporting PHP version, the database (server client) version - specifically for Drupal 7.9: function exceptionHandler($e) { echo $e-getMessage(); print_r($e-getTrace()); } set_exception_handler('exception_handler'); $settings = 'sites/default/settings.php'; /** broken - file locking by IIS ** if (isset($_GET['use'])) { //if (!unlink($settings)) //throw new Exception('Error removing old settings'); $source = sites/default/settings.{$_GET['use']}.php; switch ($_GET['use']) { case 'mysql': case 'mssql': if (file_exists($source)) copy($source, $settings); //if (!copy(__DIR__.'/sites/default/settings.mysql.php', __DIR__.'/'.$settings)) //throw new Exception('Error copying MySQL settings.'); break
[PHP] Re: [PHP-WIN] 5.3.9RC2 and 5.4RC2
On Sun, Nov 27, 2011 at 7:32 AM, Pierre Joye pierre@gmail.com wrote: hi, I just uploaded two zip for sqlsrv and 5.4. I did not test them and they are no official builds, only for testing purposes (so is 5.4 :). you can find them at http://www.php.net/~pierre/ Cheers, Hi Pierre, I really appreciate your help with the sqlsrv build. It seems that I'm having problems test installing Drupal 7 with it. So I tried test installing on MySQL instead to see if the driver is the issue. Apparently that fails also. Then I went to pull up phpMyAdmin v3.4.7 to do some create/drop databases. Nothing works and no errors reported. Using PHP Manager for IIS, I tested 3 configurations that I have: 5.3.5 nts 5.3.9RC2 nts 5.4RC2 nts The only PHP version that would create/drop MySQL database via phpMyAdmin is 5.3.5 nts :( Platform is Win08R2/IIS7.5 SP1 with all current patches. MySQL is 5.5.7-rc (official binary). Can someone please confirm if you're able to create/drop MySQL database on using phpMyAdmin with PHP 5.3.9RC2 or PHP5.4RC2? phpMyAdmin reports MySQL client driver version: 5.3.9RC2 as mysqlnd 5.0.8-dev - 20102224 - $Revision: 318113 $ 5.4RC2 as mysqlnd 5.0.10-dev - 20111026 - $Revision: 318612 $ Thanks again, Tommy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] 5.3.9RC2 and 5.4RC2
Hi everyone, 5.3.9RC2 works fine with all my apps so far. 5.4RC2 broke with sqlsvr and its PDO in addition to Wincache, which I've already brought to MS' attention. What's the estimated official release of 5.4? I can't wait for the feature session.upload_progress* in 5.4 which I need to do some testing as how I can implement that into my existing apps!!! That's just awesome!! Thanks for all your continuous hard work :) Platform: Win08R2/IIS7.5 SP1 with current patches running PHP as FastCGI. Applications: drupal, joomla, mediawiki, wordpress, and a few of my own :) Cheers, Tommy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Tutorial for the structure of an php-app ?
On Fri, Nov 25, 2011 at 4:38 PM, Andreas maps...@gmx.net wrote: Hi again, is there a tutorial for the structure of an php-app? There are more than enough books and online docs that teach the basics of PHP and of course the native mysql commands. I'd now rather need a help to figure out how to pull up a wee bit more complex app. I know how to connect to a DB even though it might not be mysql. I can select stuff and dump it into a HTML table. Actually I prefer PDO and PostgreSQL. Is there a tutorial that teaches how to construct a app with a 2-column design. E.g. a menue frame on the left and a bigger content area on the right. So a click on a menue item would dynamically display a form or a list in the content area. What you're asking has nothing to do PHP. It's all UI and client side. That's all relative to: * who are the visitors * amount of information to be display * type of application such as functions and features * tools in your belt, ie: ajax, flash, etc... to name a few and not necessarily in that order. What is a good way to glue everthing together between login and logout. I know cookies and sessions and I suspect those were a way to do it. How would I integrate a template system like smarty? It weren't bad if there were clues about AJAX, too. I'm in search of a way to extend the knowledge about bricks, tubes and cables to the wisdom to actually build a house out of those things. More importantly, shouldn't you need to find out the properties of each materials prior to building a house as it will affect the design and structural integrity? How strong is the brick? What kind of tubes? Can they be easily bended? What about prone to rust or chemical reactions with long term exposure to chlorinated water? What cables are needed for each purpose and is the proper gauge of the cable being used? Insufficient gauge will lead to fire. After you have a firm understanding of the materials/technologies/skills involved, then Google programming design patterns... HTH, Tommy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: [PHP] include
On Mon, Nov 21, 2011 at 2:56 AM, Tim Streater t...@clothears.org.uk wrote: On 20 Nov 2011 at 23:46, Tamara Temple tamouse.li...@tamaratemple.com wrote: Tim Streater t...@clothears.org.uk wrote: At the moment I'm using an instance of apache to run PHP scripts, as and when required via AJAX. Having got some understanding of web sockets, I'm minded to look at having a small server to execute these functions as required. The scripts, some 50 or so, are only about 300kbytes of source code, which seems small enough that it could all be loaded with include, as in: ?php $fn = 'wiggy.php'; include $fn; ? This appears to work although I couldn't see it documented. I'm really not sure what you're looking for here -- that is pretty standard php practice to load php files with include -- what were you expecting here? I'm looking for confirmation that: include $fn; is an allowed form of the include statement. RTFM [1] example #6 ;) HTH, Tommy [1] http://php.net/function.include -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include
On Sat, Nov 19, 2011 at 2:16 PM, Tim Streater t...@clothears.org.uk wrote: At the moment I'm using an instance of apache to run PHP scripts, as and when required via AJAX. Having got some understanding of web sockets, I'm minded to look at having a small server to execute these functions as required. The scripts, some 50 or so, are only about 300kbytes of source code, which seems small enough that it could all be loaded with include, as in: ?php $fn = 'wiggy.php'; include $fn; ? This appears to work although I couldn't see it documented. I'd also like to be able to replace a module without restarting the server. I couldn't see a way to drop an included file, do I therefore take it that there is none? Failing that, is there a good way to dynamically replace parts of a PHP program, possibly using runkit? -- Cheers -- Tim Tim, I think you're approaching this the wrong way. 1) have a clear understanding of PHP - syntax, capabilities, etc. 2) have a clear understand of what you're intending to do - application's function/purpose, features, manageability, expandability, portability, etc... 3) understand design patterns What your asking is practically impossible in any programming language akin to 'how to un-import packages in Java' or 'how to un-using namespace in C#'. If you don't want to use it, don't include it ;) If this is running as web app, you can use header [1] and pass the criteria for next phase of the operation as URL parameters. But doing this is going to kill the server side with too many unnecessary round trips. Which clearly demonstrates point 2 and 3. You should look into Interfaces, and Abstract under OOP [2]. HTH, Tommy [1] http://php.net/function.header [2] http://php.net/language.oop5 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: [PHP] include
On Sun, Nov 20, 2011 at 1:34 PM, Tim Streater t...@clothears.org.uk wrote: On 20 Nov 2011 at 10:36, Tommy Pham tommy...@gmail.com wrote: I think you're approaching this the wrong way. 1) have a clear understanding of PHP - syntax, capabilities, etc. That's what I'm doing - gathering information about bits of PHP that I've not used (or not used very much) before to see how my new setup could be structured. That's a good starting point. 2) have a clear understand of what you're intending to do - application's function/purpose, features, manageability, expandability, portability, etc... I have a clear idea about *that*. I want to figure out if it's possible to use web sockets with a small server written in PHP to replace my current structure of ajax + apache + processes (which I suppose it forks). I see these benefits: 1) possible benefit - presumably when an ajax request arrives, a new process is started and so PHP has to be loaded and initialised each time. But perhaps this is in some way optimised so the PHP process is left running and apache then just tells it to read/execute a new script. 2) Definite benefit - when a browser makes an ajax request to run a script, it gets no information back until the script completes. Then it gets all of it. I have a couple of unsatisfactory workarounds for that in my existing structure. Websockets appears to offer a way for the browser to receive timely information. You didn't understand my 2nd point completely. The 2nd point starts with what function/purpose does the app provide such as is it an e-commerce, CMS, forum, etc... What you're talking about is the process(es) which facilitate(s) the application's functions ie: there's more than one way to skin the cat - so to speak. Which is part of manageability, portability, expandability (ie: scaling to clusters, ease of 3rd party plugins, etc), etc 3) understand design patterns I don't know what this means. Google programming design patterns What your asking is practically impossible in any programming language akin to 'how to un-import packages in Java' or 'how to un-using namespace in C#'. If you don't want to use it, don't include it ;) I do want to use it but would like to be able to replace it with a newer version. If there is no way to do this then that is a data point. That's why I suggested you read up regarding OOP, including Interface and Abstracts. In OOP, you define and guaranteed certain functionalities with Interfaces - hence the term API (Application Programming Interface) - but you pass a super/parent class or any of its sub/child classes, implement those interface(s), to do the work needed as how you want things done based on certain criteria. Classic example: 1) connect to db 2) execute query 3) fetch results 4) process results 5) close connection given those 5 above steps, there are many ways to proceed about it. Which way you choose depends on my 2nd point. In the past, the standard practice was using client library such as MySQL or MySQLi, especially prior to PHP5. Now it's done via PDO or other data abstraction layer, including ORM depending on a lot of things: experience, skills, knowledge, project dead line, personal preference/style, best coding practices, and lazyness in that given moment - not particularly in those order either. And here's another question. Can a child forked by pcntl_fork() use a socket that the parent obtained? Reading the socket stuff in the PHP doc, there are a number of user-supplied notes hinting this might be problematic. -- Cheers -- Tim HTH, Tommy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: [PHP] include
On Sun, Nov 20, 2011 at 4:44 PM, Tommy Pham tommy...@gmail.com wrote: On Sun, Nov 20, 2011 at 1:34 PM, Tim Streater t...@clothears.org.uk wrote: On 20 Nov 2011 at 10:36, Tommy Pham tommy...@gmail.com wrote: And here's another question. Can a child forked by pcntl_fork() use a socket that the parent obtained? Reading the socket stuff in the PHP doc, there are a number of user-supplied notes hinting this might be problematic. -- Cheers -- Tim Forgot to address this in my previous e-mail because I was cooking while trying to read/reply my e-mails. Anyway, if I'm not mistaken, what you're trying to do is making a threaded application. PHP does not support threads currently. PHP and threads has been a heated discussion on this list in the past. You're welcome to search the archives. [1] HTH, Tommy [1] http://marc.info/?l=php-general -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sniping on the List
On Thu, Nov 17, 2011 at 9:43 PM, Robert Cummings rob...@interjinn.com wrote: http://shorl.com/tebrakefesahe ROFLMAO!!! Thanks Robert for starting off a good Friday for me :D -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RE: [PHP] Safari and PDF
On Wed, Nov 16, 2011 at 4:13 AM, HallMarc Websites m...@hallmarcwebsites.com wrote: Seems strange that you are given a choice. My clients have been telling me that they are told to get the latest Acrobat Reader by Safari. Which they have done (again why allow a plugin that isn't supported get installed to begin with) only to be told the same exact thing the next time the click on a pdf. Anyway, I realize this topic is now slightly off list. Perhaps their system administrator / tech support person doesn't know any better about what's available in OS X and decided to install Acrobat Reader? Regards, Tommy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Novice MySQL problem
On Mon, Nov 14, 2011 at 4:11 AM, Stuart Dallas stu...@3ft9.com wrote: On 14 Nov 2011, at 11:47, Jim Giner wrote: Actually, no it doesn't, since I have a well-developed sense of all of that, but that's not helping to answer the OP's question now, is it? Stay on point. The OP's problem is solved, so the point is no longer relevant. I'm curious to know what your well-developed sense of all of that does when in lieu of auto-incrementing fields, and why. The only legitimate reason I've ever come across to avoid them is when you expect to need to partition data across multiple master DB servers. Is this why you avoid them? -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ Even with clustering, not comparing inherent clustering technique between RDBMSes, consider the following (MySQL) table example: CREATE TABLE `my_cluster_sample` ( `pkID1_AutoInc` bigint(11) NOT NULL AUTO_INCREMENT, `pkID2_SrvrID` int(11) NOT NULL DEFAULT '1' COMMENT 'Use # of designated server ID', `name` varchar(50) NOT NULL, PRIMARY KEY (`pkID1_AutoInc`,`pkID2_SrvrID`) ) The only reason that I see where not to use integer types with auto increment for PK is when you have an insane _LARGE_ number of rows, in any given DB instance/server. Then, the integer type no longer applies and the use of GUID/UUID or other surrogate types comes in, aside from getting into hot debate/discussion about pros cons of natural vs surrogate keys even if you don't have large amount of data ;) Regards, Tommy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysqli question
On Sat, Nov 12, 2011 at 6:15 AM, Peet Grobler p...@hivemind.net wrote: Not sure if this is the correct mailing list to be asking this question but here goes: I've got a prepared statement. $stmt = $dbh-prepare (insert into test values (?, ?)) or die (Error: . $dbh-error); $stmt-bind_param ('ii', $var1, $var2) or die (Error: . $dbh-error); $stmt-execute() or die (Error: . $dbh-error); Okay I've taken the or die statements and put it into a function called 'db_error'. So it looks kinda like this: or db_error ($dbh, $__FILE__, $__LINE__); My db error then prints out $dbh-error and FILE and LINE variables so I know exactly where the error is. I would, however, love to print out the actual SQL text that failed. There's no way to determine it, the closest way I can think of is using a $sql variable holding the 'prepare' sql - but that's not what's going to the database. On a mysqli error - I can only see the actual sql that caused the problem on the development system, as mysql logging is turned on on that. It's not possible to turn on on the live system the overhead would probably kill us. Anyone found a way to do this? Peet Depends on your overall application design. Meaning if you got database abstraction layer in place to handle all your DB access or the code snippet you've provided is used directly in a file. In either case, the same concept applies but details of approach are different. * store the SQL statement string into a variable * in your error handler, access that variable and send it to where you need to Thus, this: $stmt = $dbh-prepare (insert into test values (?, ?)) or die (Error: . $dbh-error); becomes $sql = insert into test values (?, ?); $stmt = $dbh-prepare ($sql) or db_error ($dbh, __FILE__, __LINE__, $sql); function db_error(object $dbh = null, $file, $line, $sql) { /* do what you need with it here */ } or db_error ($dbh, $__FILE__, $__LINE__); __FILE__ are reserved keywords __LINE__. If you intended to use variables represent the similar meaning, the suggested approach would be $file and $line respectively. It would make things easier to read and less confusing when you're troubleshooting, IMO. If you have everything done in classes [1] and put all your DB access in an abstraction layer class, you can use Exception [2] and get stack traces [3] to better handle and troubleshoot any errors. [4] is the non OOP way of error handling, IMO less elegant approach. Best regards, Tommy [1] http://php.net/language.oop5 [2] http://php.net/language.exceptions [3] http://php.net/exception.gettrace [4] http://php.net/ref.errorfunc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] create file after form completion
This line is consider 'top post'. Meaning you're posting on top of the reply. On Sat, Oct 29, 2011 at 12:12 PM, Pau vim.u...@googlemail.com wrote: Hi, Please try not to top post. sorry, but I do not understand the expression (I am not native, as you might have guessed). Do you mean not to include the email in my reply? Sorry about that. Where as this line is bottom posting. Meaning you'd be posting bottom/below the reply, which is the preferred method on this list. Regards, Tommy
Re: [PHP] Why does this script run out of memory?
On Fri, Oct 28, 2011 at 9:38 AM, Jim Long p...@umpquanet.com wrote: I'm running PHP 5.3.8 on FreeBSD 8.2 with MySQL 5.1.55. Jim, Installed from packages or standard port tree build? Did you do any tweak for the ports build? Any special compiler parameters in your make.conf? I've noticed that you used MySQL extensions. Have you tried MySQLi to see if there's any difference? Regards, Tommy
Re: [PHP] Object size
On Fri, Oct 28, 2011 at 9:43 AM, QI.VOLMAR QI qi.vol...@gmail.com wrote: Is there a function or method that calculate the object size in PHP?. Or maybe that calculates a xml buffer of a file? I need to check a size of a file, and if it's size is bigger than 500kb. I will need to make another file to the subsequent content. Any help will serve. Tks, Volmar http://php.net/ref.filesystem http://php.net/function.filesize
Re: [PHP] Exporting large data from mysql to html using php
On Wed, Oct 26, 2011 at 5:47 PM, Jason Pruim li...@pruimphotography.comwrote: Jason Pruim li...@pruimphotography.com The server that's running it is a home computer with a VPS installed... It's not my dev environment :) Home computer used for a production environment? Wow.. I'm speechless. The information being searched is specifically phone numbers, and the bosses want to provide the public away to browse them, hence the pagination... Once I removed a COUNT from mysql it started working alot better... So I still need to provide a better pagination system, but it's working. If just showing phone numbers only and no other information, what's the point since there are already several other white and yellow pages on the net? There's even a reverse number look-up too. There's also a well known paid service for getting a DB of contacts (name, address, phone numbers of persons and businesses). Just out of curiosity, what is it that your boss intend to offer that would stand out for already existing services? I doubt anyone would be sane enough to sit there and just browse through phone numbers only. Even if it does show the owner's name of the registered number, I highly doubt anyone sane would browse unless you provide some kind of filter/search. Oh, and the 89 million is just for one state :) We are talking the possibility of I believe 10 billion numbers to cover the US, not to mention Canada which I believe uses the same numbering system as we do so that could be another 10 billion... As I've mentioned, something of this magnitude is better to leave it to the DBA and work together with that DBA. Either hire/contract one or become one :) I'm working on becoming one ontop of web designer and programmer :) Good luck, that's a LOT of reading. I'd estimate that's about 3k+ pages of reading. :) Regards, Tommy
Re: [PHP] Exporting large data from mysql to html using php
On Wed, Oct 26, 2011 at 12:52 AM, Lester Caine les...@lsces.co.uk wrote: Tommy Pham wrote: It turns out the issue was actually in the pagination... I'm reworking the whole thing and stream lining it... But in the pagination that I found on the internet it used a SELECT COUNT(*) WHERE state='{$state}'; and the COUNT was killing the time... Once that was removed, I was displaying records faster then I could imagine... So it's off to pagination land to fix it! And possibly redo the entire thing! If you're encountering performance issues while doing SELECT COUNT(*), it sounds like you have serious disk IO performance issue. Is the DB on RAID subsystem? If not, why not? If so, what level? Also, what type of HDDs? For something like this, it should be RAID 10 with HDDs spinning at least 7200RPM, 10,000+ RPM recommended, connected to a good RAID controller, like 3ware's. Also, the controller should be in slot PCI-X or, preferably, PCI-e. What a load of twoddle ... I wonder ... The real question is what's the purpose of the DB? Is it for OLAP or OLTP? ;) As for dealing with DB having millions of rows, you're crossing over into DBA area. SELECT COUNT(*) is a problem on any fully transactional database, since it has to be generated from the currently active view of the data. Rather than trying to get the database engine access every record faster, the correct action is to either avoid the count altogether, or more practically maintain a separate table with useful counts that have been generated from the committed data. Jason, it is not unreasonable that an initial view will be displaying unfiltered data, so you just need to restrict the number of records displayed. As you have found out, telling the user how many more records there are is the real problem, so if it's not important ... don't, but if it's useful to know, then keep a 'cache' of counts that link to your initial filter options. Once you are down to a few thousand records, then a SELECT COUNT(*) may be appropriate ;) Where it becomes a problem is when there the user can set up a more complex filter that the cache does not cover ... -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/wiki/?page=**contacthttp://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/**index.phphttp://www.firebirdsql.org/index.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Exporting large data from mysql to html using php
On Wed, Oct 26, 2011 at 1:40 AM, Lester Caine les...@lsces.co.uk wrote: Tommy Pham wrote: I wonder ... The real question is what's the purpose of the DB? Is it for OLAP or OLTP? ;) As for dealing with DB having millions of rows, you're crossing over into DBA area. Many of my customers have coming up on 20 years of data available. There has been a debate on transferring historic data to a separate database, but having it available is not causing a problem, except for some counts and larger search actions, and being able to see how long a client has been visiting is often useful. Statistical analysis is always done on a separate machine, with a replicated copy of the data, so as not to affect the active users ... What kind of counts/filters? What kind of RAID subsystem is the storage? What's the total size of the DB? Up to 20 years of data should be in the peta range. In that peta range, if you're not having performance issue and not using either RAID 0, 0+1, 10, 50, or 60, I'd love to hear about the application and database design in details. :) That said, we are now using the much more detailed LLPG address data rather than simple postcode, and that has added another order of magnitude to data that is being searched live ... -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/wiki/?page=**contacthttp://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/**index.phphttp://www.firebirdsql.org/index.php Since Jason didn't disclose sufficient information, I suggested that RAID storage based on the worst case scenario being this: as a business analyst, I'd want to do drill-downs, filters, counts of a the following for an up-coming marketing campaign: * county(ies) * city(ies) * zip code(s) * address type (business and/or residential) * of business (commercial, industrial/manufacturing, etc) * of residential ( homes - single/townhouses - or apartments/condos ) The filters and counts will any combinations of the above, ie: 5 random zip codes within the given state that lists all other criteria and break down. As Jason mention having 89million rows for a given state, how long would it take to run the drill-downs if the DB isn't sitting on a fast storage medium? That 89 million is the most likely the average count in the USA. For California and New York, the number can double that easily. That's only the basic filtering. What of a specific business industry such as landscaping? What of the filtering by yearly income and/or real estate value? BTW, as a business analyst, I don't want to wait hours for the info to update every time I change a criteria/filter to get the counts before I look into a few random individual records from the results. As I've mentioned, something of this magnitude is better to leave it to the DBA and work together with that DBA. Either hire/contract one or become one :) Regards, Tommy
Re: [PHP] Exporting large data from mysql to html using php
On Wed, Oct 26, 2011 at 4:14 AM, Lester Caine les...@lsces.co.uk wrote: Tommy Pham wrote: Many of my customers have coming up on 20 years of data available. There has been a debate on transferring historic data to a separate database, but having it available is not causing a problem, except for some counts and larger search actions, and being able to see how long a client has been visiting is often useful. Statistical analysis is always done on a separate machine, with a replicated copy of the data, so as not to affect the active users ... What kind of counts/filters? What kind of RAID subsystem is the storage? What's the total size of the DB? Up to 20 years of data should be in the peta range. In that peta range, if you're not having performance issue and not using either RAID 0, 0+1, 10, 50, or 60, I'd love to hear about the application and database design in details. :) We are still only in hundreds on Mb and historic data is has less detail than the current 'transactions'. The current postcode table is 500Mb, and while the LLPG data would increase that by the order of 100, it's currently only restricted to a councils immediate working area, so we keep the problem contained. Dropping back to postcode for out of area enquiries. Users complain if an enquiry takes more than a few seconds, and Firebird is giving me more than adequate performance, and allows shadow data to be created via triggers to reduce the need for 'counting'. I have a new 'application' which is using the same search criteria but the data volume is growing a lot faster, 10Gb on the test system here, but I am still seeing the same search speeds once the correct indexes have been generated. But it will take a few more years before that starts reaching the 100Gb level :) -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/wiki/?page=**contacthttp://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/**index.phphttp://www.firebirdsql.org/index.php I'm just curious. What's the total rows count? Data accumulated in 20 years and only taking that much space doesn't seem like there's a lot going on each year over the years. All the DBAs that I know they deal with minimum addition/import of 1 million rows per week, currently. I didn't bother asking them how far back they keep the data as that amount of rows is too overwhelming for me, for the moment, as I'm not a DBA :)
Re: [PHP] Exporting large data from mysql to html using php
On Tue, Oct 25, 2011 at 7:06 PM, Jason Pruim li...@pruimphotography.comwrote: It turns out the issue was actually in the pagination... I'm reworking the whole thing and stream lining it... But in the pagination that I found on the internet it used a SELECT COUNT(*) WHERE state='{$state}'; and the COUNT was killing the time... Once that was removed, I was displaying records faster then I could imagine... So it's off to pagination land to fix it! And possibly redo the entire thing! If you're encountering performance issues while doing SELECT COUNT(*), it sounds like you have serious disk IO performance issue. Is the DB on RAID subsystem? If not, why not? If so, what level? Also, what type of HDDs? For something like this, it should be RAID 10 with HDDs spinning at least 7200RPM, 10,000+ RPM recommended, connected to a good RAID controller, like 3ware's. Also, the controller should be in slot PCI-X or, preferably, PCI-e. Regards, Tommy
Re: [PHP] Geo IP Location help needed...
On Mon, Oct 24, 2011 at 7:03 PM, Tommy Pham tommy...@gmail.com wrote: On Mon, Oct 24, 2011 at 6:36 PM, DealTek deal...@gmail.com wrote: but maybe the db is old from - Geo IP Location? hmmm . how do I check? -- Thanks, Dave - DealTek deal...@gmail.com [db-11] Dave, I don't Linux too well but it should be similar to FreeBSD in some ways. You can download the latest updates from Maxmind [1]. See [2] for the info regarding your current GeoIP DB installed/used on the system. Regards, Tommy [1] http://www.maxmind.com/app/php [2] http://php.net/function.geoip-db-get-all-info Forgot to include list.
[PHP] Re: Ms Web PI and PHP
On Thu, Oct 20, 2011 at 5:15 AM, Joseph Adenuga jadenu...@yahoo.com wrote: Dear Tommy, Good day to you. I'm trying to install Microsoft's Web Platform as advised in your last message below. But, I don't know which application to install from the list provided from the downloaded applications. Please which ones are the correct window web PI and PHP applications to download from the list. I look forward to hearing from you. Many thank's and have a beautiful day. Best Wishes, Joseph --- On *Wed, 19/10/11, Tommy Pham tommy...@gmail.com* wrote: From: Tommy Pham tommy...@gmail.com Subject: Re: [PHP] PHP 5.2 and Apache 2.2 are really compatible? To: Tim Thorburn immor...@nwconx.net Cc: php-general@lists.php.net Date: Wednesday, 19 October, 2011, 9:32 On Wed, Oct 19, 2011 at 9:26 AM, Tim Thorburn immor...@nwconx.nethttp://mc/compose?to=immor...@nwconx.net wrote: Failing this, do you need Apache? If you just want a web server to test some stuff on, you can download Microsoft's Web Platform - it will install and configure IIS to run with PHP, IIS is only available on Windows XP Professional. Other versions of XP doesn't have IIS, IIRC. Joseph, Please include the list. If you're using Windows XP Professional, you can use the IIS that comes with it. To install it, Control Panel Add / Remove Programs (?) Windows Components. If you're using Windows XP Home Premium or other XP variants, I suggest you use Apache web server (httpd) [1] instead and follow the manual [2] for its configurations. Then download the PHP's Windows binary [3], install/unzip, and then configure it [4]. While using the MS Web Platform Installer (WPI) may get you up and running faster, you won't fully comprehend the ins/outs of the entire setup where you may have to update the newer versions because of bug fixes or new features or do some configuration tweaks for various reasons (security, performance, logging, etc.). Don't bother trying to use IIS Express on the MS WPI, IMO, it's worthless as you have to do the configurations via command line appcmd.exe, IIRC. Another option you can use is XAMPP for Windows [5] but I prefer putting everything together myself ;) Good luck, Tommy [1] http://httpd.apache.org/download.cgi download v2.2.21 Win32 Binary including OpenSSL 0.9.8r (MSI Installer) [2] http://httpd.apache.org/docs/2.2/ [3] http://windows.php.net/download/ either the installer or zip (I prefer zip) [4] php.net/install.windows.iis6 or php.net/install.windows.apache2 [5] http://www.apachefriends.org/en/xampp-windows.html
Re: [PHP] PHP 5.2 and Apache 2.2 are really compatible?
On Wed, Oct 19, 2011 at 9:26 AM, Tim Thorburn immor...@nwconx.net wrote: Failing this, do you need Apache? If you just want a web server to test some stuff on, you can download Microsoft's Web Platform - it will install and configure IIS to run with PHP, IIS is only available on Windows XP Professional. Other versions of XP doesn't have IIS, IIRC.
Re: [PHP] Seeking strategy/algorithm for maintaining order of records
On Sun, Oct 16, 2011 at 2:32 PM, Stephen stephe...@rogers.com wrote: On 11-10-16 04:10 PM, Jim Giner wrote: Stephen: What you describe is a multistep problem. There are many ways to show pictures (images) in any order you want. * So far, the OP has only asked how to keep his categories in order. Curious, yes, but he hasn't even asked how to display the images in order - maybe he doesn't care about that.. Well, I want to deal with one part of the design at a time :) Thanks to all who replied. This is a collective response. Displaying in an order is easy when you have a field called order. SELECT descriptions FROM categories ORDER by order; My issue is, say I have three records: ID CategoryOrder 1BW1 2Landscapes 2 3Nudes 3 I am looking for the best way to be able to change the values to ID CategoryOrder 1BW3 2Landscapes 2 3Nudes 1 Dynamically building a form, entering the new order value, and then looping through the post, with a SQL UPDATE is the best I can come up with. A future issue will be doing the same to the table category-photograph ID Category_id photo_id order This table is needed to allow a photograph to be in more than one category. Cheers Stephen Depends on the tools you have in your belt. If you want to keep it strictly HTML + PHP, you can use the form POST. Iterate through the form's categories collection and update to the database, this simplest application design doesn't require you check what's the previous order is or which category's order has changed. /* psuedo code */ - $order = null; $id = null; - $sql = UPDATE SET `order` = '?' WHERE `ID` = '?'; - make connection to db - if ( [1] prepare statement === false ) throw new Exception('Error preparing statement: '.$sql); - if ( [2] bind param $order and $id === false ) throw new Exception('Error binding parameters: $order '.$order.' and $id '.$id); - iterate through the form POST collection of categories - $id = $category_id; $order = $category_order; - if ([3] execute prepared statement === false) throw new Exception('Error executing prepared statement '.$sql; - end loop / iteration - close db connection However, using this method will have a performance issue if the number of records you're updating is large regardless of which 'category' was changed. Good luck, Tommy [1] php.net/mysqli.prepare [2] php.net/mysqli-stmt.bind-param [3] php.net/mysqli-stmt.execute [4] php.net/language.exceptions
Re: [PHP] Local variable protection
On Wed, Oct 12, 2011 at 4:51 PM, Benjamin Coddington bcodd...@uvm.eduwrote: On Oct 12, 2011, at 4:24 PM, Ken Robinson wrote: Quoting Benjamin Coddington bcodd...@uvm.edu: Are there any assurances that function local variables are protected from code calling the function? For example, I would like to provide some cryptographic functions such as function org_secure_string($string) { $org_key = a very random key; return hash($string, $key); } function org_reveal_string($hash) { $org_key = a very random key; return unhash($hash, $key); } I'd like to protect $org_key from any code following or using these functions. I've not yet found a way that it can be revealed, but I wonder if anyone here can give me a definitive answer whether or not it is possible. It's called the scope of the variable. See http://us3.php.net/manual/en/language.variables.scope.php Variables defined in a function are only available to the function where they are defined. Yes, but scope does not necessarily protect a value. Within a function globals are out of scope, but their values can still be accessed through $GLOBALS. Maybe you should read that [1] again and thoroughly analyze the given example. Any variable and its value within the function is only accessible within _that_ function, unless you make a reference to a global variable. Thus, the value is protected within the local scope inside that function, which you're free to do as you wish within that same function. As Ken mentioned, you should revisit that section Ken provided in the official manual. BTW, your examples will generate errors as $key is not defined nor did you reference it to a global variable within the functions. If you still have any doubts, run the following code with all errors and warnings enabled in the php.ini: function org_secure_string($string) { $key = a very random key; return hash($string, $key); } echo 'pre'; var_dump($GLOBALS); The use of var_dump is one of the best ways to confirm that what actually happens is the _exactly_the_same_ as what you think should happen within your code/application. Many languages have little-documented reflection features. I am concerned about a determined person being capable of discovering the value of a variable within a function that has already been defined. Is there a way to this? Is there a way to examine the input buffer, or anything that has been read into the interpreter so far? Certainly those values exist within the memory of the process, which can be accessed through other methods. I'd be very happy if anyone is able to say it is not possible to do this, and explain why. Ben Regards, Tommy [1] php.net/reserved.variables.globals
Re: [PHP] Server Side Include translator as PHP functions
On Sun, Oct 9, 2011 at 8:41 AM, Complex complex.confus...@gmail.com wrote: Tedd, The crucial detail you're lookign for is my lack of choice or control in the matter, for all sorts of reasons that are actually quite stupid but not possible for *me* to change, and not possible for anyone else to change quickly. Thus I am looking for a solution to the problem at hand, instead of a suggestion for what the entire org should be doing instead. I know what they should be doing instead, but that's not my decision. It's not like I'm building a new website this way; I'm trying to move forwards with an existing and large website. The more different code-bases we have for different parts of the site, the harder it will be to actually change to something else (PHP-based, I pray). At the time when I was working with ASP and SSI, I suggested my client to better rewrite the application in OOP language then do patchworks. But he _insisted_ on keeping existing code base. So I did patchworks here and there. It got to the point where he finally wanted some additional features much later that it was impossible to do with ASP and SSI. It was then that he finally decided to go with my suggestions, which is months later. During that time, I could have easily rewritten the application in PHP. That's why I suggested you to consider the site's function and features. It maybe just one thing that the client/boss wants now, then another, and another... etc... Eventually, you're going to through the same thing I did. Good luck, Tommy
Re: [PHP] Server Side Include translator as PHP functions
On Sat, Oct 8, 2011 at 8:36 AM, Complex complex.confus...@gmail.com wrote: Hello, Can you please tell me if there's already a set of PHP functions for translating SSI commands to PHP? I'm looking to do two things -- one difficult, one easy -- using PHP on a hosted server. My client has web pages that use Server Side Includes, and one sub-site that uses PHP. The task is to make the PHP sub-site use the same SSI includes as the rest of the site to maintain a consistent code structure. I can simply use include_once() to include each SSI include; that works fine. However, I'd like to recognize and replace one of the SSI instructions with a more nuanced PHP instruction that will insert dynamic information from the sub-site's environment. 1. include SSI files A 2. include SSI file B, Recognize B and replace it with some PHP code 3. include SSI file C and i can't actually do that b/c PHP gets run first and then SSI instructions. So the difficult thing I want to do is to read the SSI files (literally, using fread or similar), translate them to PHP ('include virtual' -- include(), set var=foo value=bar -- var foo = bar, etc), and then execute them. Then the simple thing I want to do will be recognizing the commands I want to replace or modify and doing so. Since this is a hosted solution, I don't believe I can install any PHP modules, and I'll have to use some functions instead. Does that already exist, please? -- -- CC --- I think you didn't provide enough details to get a more accurate suggestion of a solution, but here goes... Is 'include SSI file B' always included and always need to be replaced? If so, that's a very apparent solution. If not, what are criterias? URL? Query parameter(s) and/or value(s)? Certain user(s)? Certain group(s) of users? Certain hour of the day? Certain user agent(s)? etc... Regardless of how dynamic any site is, there's a always some kind of pattern. What you need to do is identify that pattern and do what you need accordingly. What about having PHP read those files to be included and output without having to rely on SSI mechanisms? I'm just curious... since PHP is OOP and, IIRC of SSI, the use of SSI limits the full potential of OOP and PHP. Is the control of the application and configurations beyond yours? Regards, Tommy
Re: [PHP] Server Side Include translator as PHP functions
On Sat, Oct 8, 2011 at 8:36 AM, Complex complex.confus...@gmail.com wrote: Hello, Can you please tell me if there's already a set of PHP functions for translating SSI commands to PHP? I'm looking to do two things -- one difficult, one easy -- using PHP on a hosted server. My client has web pages that use Server Side Includes, and one sub-site that uses PHP. The task is to make the PHP sub-site use the same SSI includes as the rest of the site to maintain a consistent code structure. I can simply use include_once() to include each SSI include; that works fine. However, I'd like to recognize and replace one of the SSI instructions with a more nuanced PHP instruction that will insert dynamic information from the sub-site's environment. 1. include SSI files A 2. include SSI file B, Recognize B and replace it with some PHP code 3. include SSI file C and i can't actually do that b/c PHP gets run first and then SSI instructions. So the difficult thing I want to do is to read the SSI files (literally, using fread or similar), translate them to PHP ('include virtual' -- include(), set var=foo value=bar -- var foo = bar, etc), and then execute them. Then the simple thing I want to do will be recognizing the commands I want to replace or modify and doing so. Since this is a hosted solution, I don't believe I can install any PHP modules, and I'll have to use some functions instead. Does that already exist, please? -- -- CC --- I think you didn't provide enough details to get a more accurate suggestion of a solution, but here goes... Is 'include SSI file B' always included and always need to be replaced? If so, that's a very apparent solution. If not, what are criterias? URL? Query parameter(s) and/or value(s)? Certain user(s)? Certain group(s) of users? Certain hour of the day? Certain user agent(s)? etc... Regardless of how dynamic any site is, there's a always some kind of pattern. What you need to do is identify that pattern and do what you need accordingly. What about having PHP read those files to be included and output without having to rely on SSI mechanisms? I'm just curious... since PHP is OOP and, IIRC of SSI, the use of SSI limits the full potential of OOP and PHP. Is the control of the application and configurations beyond yours? Regards, Tommy
Re: [PHP] Server Side Include translator as PHP functions
My apologies I was multitasking some heavy applications/tests and had a huge spike in CPUs utilization and I accidentally clicked on send x2.
Re: [PHP] Server Side Include translator as PHP functions
On Sat, Oct 8, 2011 at 2:31 PM, Complex complex.confus...@gmail.com wrote: On Sat, Oct 8, 2011 at 1:09 PM, Tommy Pham tommy...@gmail.com wrote: I think you didn't provide enough details to get a more accurate suggestion of a solution, but here goes... Is 'include SSI file B' always included and always need to be replaced? If so, that's a very apparent solution. If not, what are criterias? URL? Query parameter(s) and/or value(s)? Certain user(s)? Certain group(s) of users? Certain hour of the day? Certain user agent(s)? etc... Regardless of how dynamic any site is, there's a always some kind of pattern. What you need to do is identify that pattern and do what you need accordingly. What about having PHP read those files to be included and output without having to rely on SSI mechanisms? I'm just curious... since PHP is OOP and, IIRC of SSI, the use of SSI limits the full potential of OOP and PHP. Is the control of the application and configurations beyond yours? Regards, Tommy Tommy, Last question first: yes, using SSI limits the full potential of the PHP being used, but the point of this exercise is to continue using the existing SSI includes for this small subsection of the larger website, and to not recode the larger whole to benefit the smaller piece. Make whatever Star Trekism of that you will; we simply don't have time or resources to use PHP everywhere as we should. Then you should seriously consider the site's function and features and see if the current application fits that model. Doing little patchwork here and there may end up costing a lot more time and resources than just rewriting the application in PHP, IMO, not to mention losing customer/clients because of buggy application due to patchworks. I'm sure some experienced folks here have been through that at some point, myself included - which is why I stop using ASP and SSI and moved on to OOP over 10 years ago. I do not understand your question about criteria; the only criteria for these Apache Server Side Includes is the relative (or relative-to-root) filepath: !--#include virtual=/includes/header-pieces/A.inc -- If you mean, which server variables am I accessing with SSI and now need to access with PHP, I'm primarily concerned with the current filepath. SSI include file B is, in this case, the contents of an HTML webpage's HEAD block. The PHP-based CMS can fill the HEAD with some useful info unique to the current page. If I can achieve the _actual problem_ of translating the SSI commands into PHP, it would be a simple matter for me to insert some additional material into the middle of the original. The only reason I even mention this simple problem is because it explains why Im bothering to do this at all. If all I wanted was to get the unaltered output of the SSI includes, I'd just continue doing ?php include(/includes/header-pieces/A.inc); ? and be on my way. All I want to know is if someone has already written a set of functions to translate some if not all SSI commands into PHP. e.g.!--#include virtual=/includes/header-pieces/A.inc -- becomes ?php include(/includes/header-pieces/A.inc); ? !--#set var=foo value=bar -- becomes ?php var foo = bar; ? !--#if expr=${foo} --...!--#elif expr=${bar} --...!--#else --...!--#endif -- ?php if($foo) {...} elseif($bar) {...} else {...} ? Otherwise, I have to write those functions myself and, inevitably, spend time I don't have getting it right. I've searched, but I may easily have missed or not recognized the functions that I need. -- -- CC --- * Case 1 of always include and always replace (and not modifying headers): change !--#include virtual=/includes/old/file/B.inc -- to !--#include virtual=/path/to/php/code2exec.php -- * Anything else, if I'm reading it correctly: Incoming request - static HTML file - SSI mechanism (included some files) change the above flow to (there by passing SSI mechanism) Incoming request - PHP file index.php (include some files, execute PHP scripts as needed and change the httpd configurations accordingly) or Incoming request - SSI mechanism (included some files) change the above flow to (there by passing SSI mechanism) !--#include virtual=/path/to/php/file/handlingRequests.php -- or just remove the SSI mechanism altogether and have a index.php file doing all the work and thus reducing the complex configuration and application flow, and server overhead. (Migrating the SSI configurations in httpd to PHP codes shouldn't take that long unless you're new to PHP.) --- the file handlingRequests.php or index.php would look something akin to below. ?php include_once('/path/to/header.inc'); // psuedo code // if condition A (looking to match certain query parameter name value [1] //or certain user agents [2]) then //include ('/path/to/file/conditionA.inc'); // elseif condition B (whatever else condition
Re: [PHP] Server Side Include translator as PHP functions
On Sat, Oct 8, 2011 at 5:33 PM, Complex complex.confus...@gmail.com wrote: Thanks for the advice, I'm aware of all that, but I'm looking for a specific PHP solution at the moment. Unless you have advice on how I can update the SSI includes on the larger website *without* having to also update the PHP includes for this smaller website? I take it that you don't know of such a function; do you have a recommendation for a good function or program repository I could search? The couple that I was looking at (such as http://php.resourceindex.com/) don't look like they've received a whole lot of attention lately, and may not be the best sources. Did you look at my suggestion as work around such as replacing the SSI mechanism for a particular path/URL with PHP? Use of 'Conditional expressions' [1] maybe necessary which is beyond the scope of this list. What are SSI? SSI (Server Side Includes) are directives that are placed in HTML pages, and evaluated on the server while the pages are being served. They let you add dynamically generated content to an existing HTML page, without having to serve the entire page via a CGI program, or other dynamic technology. The decision of when to use SSI, and when to have your page entirely generated by some program, is usually a matter of how much of the page is static, and how much needs to be recalculated every time the page is served. SSI is a great way to add small pieces of information, such as the current time. But if a majority of your page is being generated at the time that it is served, you need to look for some other solution. [1] Last time I checked, SSI, either on httpd or IIS, doesn't have any means to do dynamically, including generating headers, as you intended. Regards, Tommy [1] http://httpd.apache.org/docs/current/howto/ssi.html
Re: [PHP] Namespaced code with SabreDAV
On Thu, Oct 6, 2011 at 7:37 AM, Andrew Mason slackma...@gmail.com wrote: Hello all, I am trying to use the wonderful SabreDAV library to create a webdav share. I have a demo up and running however the framework / class i'm using is namespaced, and SabreDAV unfortunately does not have a 5.3 style namespace declaration. I have an spl_autoload function registered in my base controller and so long as I prefix the classname with a \ it all works: $rootDirectory = new \Sabre_DAV_FS_Directory($rootDir); // The server object is responsible for making sense out of the WebDAV protocol $server = new \Sabre_DAV_Server($rootDirectory); However, SabreDAV it's self has a large amount of other PHP classes which it calls which obviously aren't prefixed with '\' Is there a way i can tell PHP any class name that get's instanciated with 'Sabre_' should resolve to '\Sabre' ? Many thanks Andrew If my memory serves regarding PHP's namespace, you could build something like this $file = APP_DIR.'\'.$class; if( file_exists( $file ) ) require_once $file; into your autoloader. You may have to adjust '/' to/from '\\' depending on your platform or you can use the constant DIRECTORY_SEPARATOR in the full path to the class. Then you don't need add \ before your class to instantiate. I don't know how the SabreDAV framework looks like but you may want to look at how Zend framework loads their class as to give you some idea what you may need to do in your autoload to circumvent SabreDAV being not 5.3 namespace declaration. You may also want to take a look at CodeIgniter's autoloading mechanism. Regards, Tommy
Re: [PHP] Problem with code...
On Thu, Oct 6, 2011 at 7:29 PM, Jason Pruim li...@pruimphotography.comwrote: Jason Pruim li...@pruimphotography.com On Oct 6, 2011, at 9:04 PM, George Langley wrote: On 2011-10-06, at 6:28 PM, Jason Pruim wrote: ?PHP //SETUP VARIABLES $mailTo = li...@pruimphotography.com; $mailFrom = li...@pruimphotography.com; //These 2 can be changed IF you know what you are doing and why! $returnPath = $mailFrom; $replyTo = $mailFrom; $mailSubject = New Convention registration!; $message = ; //DO NOT CHANGE UNDER PENALITY OF BEING SLAPPED WITH A WET NOODLE!!! $headers = From: .$mailFrom.\n; $headers .= Return-Path: .$returnPath.\n; $headers .= Reply-To: .$replyTo.\n; function send_email($mailTo, $mailSubject, $mailMessage, $headers) { if(mail( $mailTo, $mailSubject, $mailMessage, $headers )) { $message = Thank you for registering!; }else { echo There was an issue with your registration.. Please try again later; } }//Close Function if(!empty($errorCount)) { }else { //Build Email message $mailmessage = Full Name: . $_POST['firstname'] . . $_POST['lastname'] . \n\n; $mailmessage .= Address: . $_POST['address'] . \n\n; $mailmessage .= City, State, Zip: . $_POST['city'] . . $_POST['state'] . . $_POST['zip'] . \n\n; $mailmessage .= Phone: . $_POST['phone'] . \n\n; $mailmessage .= Email address: . $_POST['email'] . \n\n; if($_POST['affiliation'] == NFBOther) { $mailmessage .= Chapter Affiliation: . $_POST['other'] . \n\n; }else{ $mailmessage .= Chapter Affiliation: . $_POST['affiliation'] . \n\n; } if($_POST['person'] ==Other){ $mailmessage .= Who will pick up the ticket? . $_POST['Pfirstname'] . . $_POST['Llastname'] . \n\n; }else{ $mailmessage .= Who will pick up the ticket? I will pick it up my self! \n\n; } $mailmessage .= Payment Method: . $_POST['paymentMethod']; send_email($mailTo, $mailSubject, $mailmessage, $headers); } ? Sometimes... It is dropping the last $mailmessage line... The payment method in the actual email it sends... Anyone have any ideas? I'm stumped Hi there. First thought is perhaps it is not getting a value for paymentMethod and if it doesn't exist, will the line still get added? I would always check to see if every post variable isset, before adding the line. Can write a default line in its place if missing. The variable is being set with a default value of nothing else... But for some reason it's not bringing it through when the form is submitted... Any other ideas? hehe :) Have you tested with the same payment method to see if somewhere in your code or a hiccup in the server is causing the problem? Does that happen to any or certain payment method (including blank entry)? I'm guessing it may happen with only certain payment method. From the line if(!empty($errorCount)) {, I presume you have a mechanism in place to sanitize and validate inputs? I'd suggest you start troubleshooting from there. If this is still development phase, try to bypass that mechanism for a quick confirmation that is causing the problem. Regards, Tommy
Re: [PHP] Namespaced code with SabreDAV
On Thu, Oct 6, 2011 at 1:45 PM, Tommy Pham tommy...@gmail.com wrote: On Thu, Oct 6, 2011 at 7:37 AM, Andrew Mason slackma...@gmail.com wrote: Hello all, I am trying to use the wonderful SabreDAV library to create a webdav share. I have a demo up and running however the framework / class i'm using is namespaced, and SabreDAV unfortunately does not have a 5.3 style namespace declaration. I have an spl_autoload function registered in my base controller and so long as I prefix the classname with a \ it all works: $rootDirectory = new \Sabre_DAV_FS_Directory($rootDir); // The server object is responsible for making sense out of the WebDAV protocol $server = new \Sabre_DAV_Server($rootDirectory); However, SabreDAV it's self has a large amount of other PHP classes which it calls which obviously aren't prefixed with '\' Is there a way i can tell PHP any class name that get's instanciated with 'Sabre_' should resolve to '\Sabre' ? Many thanks Andrew If my memory serves regarding PHP's namespace, you could build something like this $file = APP_DIR.'\'.$class; if( file_exists( $file ) ) require_once $file; into your autoloader. You may have to adjust '/' to/from '\\' depending on your platform or you can use the constant DIRECTORY_SEPARATOR in the full path to the class. Then you don't need add \ before your class to instantiate. I don't know how the SabreDAV framework looks like but you may want to look at how Zend framework loads their class as to give you some idea what you may need to do in your autoload to circumvent SabreDAV being not 5.3 namespace declaration. You may also want to take a look at CodeIgniter's autoloading mechanism. Regards, Tommy Here's another idea that you could do with the autoloader. The autoloader is slightly modified from PureMVC's site to suit my needs. Using namespace and everything that's PHP v5.3+, this is part of PureMVC framework that I've ported over from the original Flash code a while back. define( 'PMVC_BASE_DIR', str_replace( '\\', '/', __DIR__ ).'/' ); function __autoload( $class ) { if( stristr( $class, '\\' ) ) { $file = APP_DIR.str_replace( '\\', '/', $class ).EXT; if( file_exists( $file ) ) require_once $file; else throw new \Exception( 'Unable to find class '.$class. ' in the expected location '.$file ); } else { $_basePaths = array( PMVC_BASE_DIR.'org/puremvc/php/patterns/facade/', PMVC_BASE_DIR.'org/puremvc/php/interfaces/', PMVC_BASE_DIR.'org/puremvc/php/core/', PMVC_BASE_DIR.'org/puremvc/php/patterns/', PMVC_BASE_DIR.'org/puremvc/php/patterns/command/', PMVC_BASE_DIR.'org/puremvc/php/patterns/mediator/', PMVC_BASE_DIR.'org/puremvc/php/patterns/observer/', PMVC_BASE_DIR.'org/puremvc/php/patterns/proxy/' ); $classPaths = array_merge( explode( PATH_SEPARATOR, get_include_path() ), $_basePaths ); foreach( $classPaths as $classPath ) { $path = $classPath.$class.EXT; if( file_exists( $path ) ) { require_once $path; return; } } throw new \Exception( 'Unable to find class '.$class.' in '. implode( PATH_SEPARATOR, $classPaths ) ); } }
Re: [PHP] Re: Secure data management
On Tue, Oct 4, 2011 at 8:01 PM, Jeremiah Dodds jeremiah.do...@gmail.comwrote: On Tue, Oct 4, 2011 at 9:25 PM, Tommy Pham tommy...@gmail.com wrote: There would be a difference in performance since the the expression has to be reevaluated, including the function FROM_BASE, every time versus one time evaluation of prepared statement. This is true, but it should be pointed out that for a large majority of web applications the performance hit given by either prepared statements or base64 encoding is going to be miniscule compared to the bottlenecks already present at the db-access and network-latency layers. Sites that approach needing to actively worry about the performance hit from either method are rare, and it's doubtful that the solution used would be to remove the tactic, assuming the reasons for the approach being used are sound and still present. As for the added complexity, if you have SQL statements all over your code then yes it will add a time overhead, but any codebase of a significant size should be using a centralised API for database access such that changes like this have a very limited scope. Isn't that one of the major points of OOP? Still, what about new developers, having to remember that additional (and most likely unneeded) complexity, to the project which they would like to build additional modules/plugins for? The paragraph you're replying to is saying that this shouldn't be a pain if your code is well organized. If your codebase is sane, these details should be transparent to new developers. If they can't be, then new developers get a chance to learn things :P My code base, being sane and KIS, wouldn't contain that base64 :P Anyway, I've spent the last hour or so trying PoC and some metric analysis but can't seem to get consistent results in execution speed in the MySQL workbench testing without (restart server before each SQL statement to prevent use of cache) and with FLUSH+RESET. Would someone, when you have time, please see if you're getting the same? Here are the codes: * PHP + HTML ?php if (isset($_POST['data']) !empty($_POST['data'])) { $data = $_POST['data']; $data_base64 = base64_encode($data); echo $data.'br/'.$data_base64; } ? form method=post enctype=multipart/form-data input type=text name=data size=100 / input type=submit value=Encode / /form * MySQL syntax + BASE64_DECODE [1] DROP TABLE IF EXISTS test.base64; CREATE TABLE IF NOT EXISTS test.base64 ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, data_ varchar(100) NOT NULL COLLATE utf8_general_ci, data_base64 varchar(150) NOT NULL COLLATE utf8_general_ci ); TRUNCATE test.base64; -- FLUSH TABLES; FLUSH PRIVILEGES; RESET QUERY CACHE; INSERT INTO test.base64 (data_, data_base64) VALUES ('string to encode 2',BASE64_DECODE('c3RyaW5nIHRvIGVuY29kZSAy')); /* 0.046 sec */ -- FLUSH TABLES; FLUSH PRIVILEGES; RESET QUERY CACHE; PREPARE stmt1 FROM 'INSERT INTO test.base64 (data_, data_base64) VALUES (?, ?)'; SET @a = 'string to encode 3'; SET @b = 'string to encode 3'; EXECUTE stmt1 USING @a, @b; /* 0.015 sec */ -- FLUSH TABLES; FLUSH PRIVILEGES; RESET QUERY CACHE; INSERT INTO test.base64 (data_, data_base64) VALUES ('string to encode','string to encode'); /* 0.015 sec */ -- FLUSH TABLES; FLUSH PRIVILEGES; RESET QUERY CACHE; SELECT COUNT(*) FROM test.base64; /* 3 rows */ INSERT INTO test.base64 (data_, data_base64) VALUES ('string to encode','string to encode'); DELETE FROM test.base64;'); /* error after DELETE - sample SQL injection */ SELECT COUNT(*) FROM test.base64; /* 0 rows */ INSERT INTO test.base64 (data_, data_base64) VALUES ('string to encode\'); DELETE FROM test.base64;',BASE64_DECODE('c3RyaW5nIHRvIGVuY29kZScpOyBERUxFVEUgRlJPTSB0ZXN0LmJhc2U2NDs=')); SELECT COUNT(*) FROM test.base64; /* 1 row */ -- test SELECT queries against sample data table with 219,061 rows having 4 rows contains word 'pressure' -- FLUSH TABLES; FLUSH PRIVILEGES; RESET QUERY CACHE; SELECT * FROM test.base64_product_desc WHERE `name` LIKE CONCAT('%', BASE64_DECODE('cHJlc3N1cmU='), '%'); /* 0.499 sec / 0.000 sec - subsequent runs w/o FLUSH/RESET are about same time */ -- FLUSH TABLES; FLUSH PRIVILEGES; RESET QUERY CACHE; SELECT * FROM test.base64_product_desc WHERE `name` LIKE '%pressure%'; /* 0.530 sec / 0.000 sec - subsequent runs are received from cached if not reset */ -- FLUSH TABLES; FLUSH PRIVILEGES; RESET QUERY CACHE; PREPARE stmt1 FROM 'SELECT * FROM test.base64_product_desc WHERE `name` LIKE %?%'; /* %?% \'%?%\' '%?%' */ SET @a = 'pressure'; EXECUTE stmt1 USING @a; /* failed to run */ -- FLUSH TABLES; FLUSH PRIVILEGES; RESET QUERY CACHE; Times recorded are from the initial run for both INSERT and SELECT. [1] base64.sql attachment from http://bugs.mysql.com/bug.php?id=18861
Re: [PHP] Re: Secure data management
On Tue, Oct 4, 2011 at 4:11 PM, Stuart Dallas stu...@3ft9.com wrote: On 5 Oct 2011, at 00:04, Mark Kelly wrote: Hi. On Tuesday 04 Oct 2011 at 21:39 Stuart Dallas wrote: http://stut.net/2011/09/15/mysql-real-escape-string-is-not-enough/ Thanks. I followed this link through and read the full message (having missed it the first time round), and while I find the idea of using base64 to sanitise text interesting I can also forsee a few difficulties: It would prevent anyone from accessing the database directly and getting meaningful results unless the en/decode is in triggers, or maybe stored procedures. No more one-off command-line queries. How would you search an encoded column for matching text? I'd be interested in any ideas folk have about these issues, or any others they can envisage with this proposal. Base64 encoding will work when the native base64 functions are available in MySQL which will allow you to base64 encode the data into a statement like INSERT INTO table SET field = FROM_BASE64(?php echo base64_encode($data); ?) sorta thing. I'm still not a massive fan of that idea given that prepared statements are an option, but it would work. -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ -- Inserting and updating isn't the problem. I think Mark referring to is how would that be implemented in this simple type of query: SELECT * FROM my_table WHERE col_name LIKE '%key word%'; If there's no viable mean to filter the data, that storage method/medium is rather pointless, IMHO.
Re: [PHP] Re: Secure data management
On Tue, Oct 4, 2011 at 4:49 PM, Stuart Dallas stu...@3ft9.com wrote: On 5 Oct 2011, at 00:45, Tommy Pham wrote: On Tue, Oct 4, 2011 at 4:11 PM, Stuart Dallas stu...@3ft9.com wrote: On 5 Oct 2011, at 00:04, Mark Kelly wrote: Hi. On Tuesday 04 Oct 2011 at 21:39 Stuart Dallas wrote: http://stut.net/2011/09/15/mysql-real-escape-string-is-not-enough/ Thanks. I followed this link through and read the full message (having missed it the first time round), and while I find the idea of using base64 to sanitise text interesting I can also forsee a few difficulties: It would prevent anyone from accessing the database directly and getting meaningful results unless the en/decode is in triggers, or maybe stored procedures. No more one-off command-line queries. How would you search an encoded column for matching text? I'd be interested in any ideas folk have about these issues, or any others they can envisage with this proposal. Base64 encoding will work when the native base64 functions are available in MySQL which will allow you to base64 encode the data into a statement like INSERT INTO table SET field = FROM_BASE64(?php echo base64_encode($data); ?) sorta thing. I'm still not a massive fan of that idea given that prepared statements are an option, but it would work. -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ -- Inserting and updating isn't the problem. I think Mark referring to is how would that be implemented in this simple type of query: SELECT * FROM my_table WHERE col_name LIKE '%key word%'; If there's no viable mean to filter the data, that storage method/medium is rather pointless, IMHO. Go back and read what I wrote again. Base64 is only being used to transmit the data to MySQL - it's being stored in the database in its decoded form. -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ The question still applies as how would you safeguard that 'key word' transmission, especially against SQL injection. I suppose one could do it this way: SELECT * FROM my_table WHERE col_name LIKE CONCAT('%', FROM_BASE64(?php echo base64_encode($data); ?), '%') Is the overhead worth it to warrant that kind of safeguard? That's just a simple query with a simple search criteria. What about in the case of subselect and multi-table joins?
Re: [PHP] Re: Secure data management
On Tue, Oct 4, 2011 at 5:51 PM, Stuart Dallas stu...@3ft9.com wrote: On 5 Oct 2011, at 01:13, Tommy Pham wrote: On Tue, Oct 4, 2011 at 4:49 PM, Stuart Dallas stu...@3ft9.com wrote: On 5 Oct 2011, at 00:45, Tommy Pham wrote: On Tue, Oct 4, 2011 at 4:11 PM, Stuart Dallas stu...@3ft9.com wrote: On 5 Oct 2011, at 00:04, Mark Kelly wrote: Hi. On Tuesday 04 Oct 2011 at 21:39 Stuart Dallas wrote: http://stut.net/2011/09/15/mysql-real-escape-string-is-not-enough/ Thanks. I followed this link through and read the full message (having missed it the first time round), and while I find the idea of using base64 to sanitise text interesting I can also forsee a few difficulties: It would prevent anyone from accessing the database directly and getting meaningful results unless the en/decode is in triggers, or maybe stored procedures. No more one-off command-line queries. How would you search an encoded column for matching text? I'd be interested in any ideas folk have about these issues, or any others they can envisage with this proposal. Base64 encoding will work when the native base64 functions are available in MySQL which will allow you to base64 encode the data into a statement like INSERT INTO table SET field = FROM_BASE64(?php echo base64_encode($data); ?) sorta thing. I'm still not a massive fan of that idea given that prepared statements are an option, but it would work. -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ -- Inserting and updating isn't the problem. I think Mark referring to is how would that be implemented in this simple type of query: SELECT * FROM my_table WHERE col_name LIKE '%key word%'; If there's no viable mean to filter the data, that storage method/medium is rather pointless, IMHO. Go back and read what I wrote again. Base64 is only being used to transmit the data to MySQL - it's being stored in the database in its decoded form. -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ The question still applies as how would you safeguard that 'key word' transmission, especially against SQL injection. I suppose one could do it this way: SELECT * FROM my_table WHERE col_name LIKE CONCAT('%', FROM_BASE64(?php echo base64_encode($data); ?), '%') Is the overhead worth it to warrant that kind of safeguard? That's just a simple query with a simple search criteria. What about in the case of subselect and multi-table joins? That would indeed be logical if base64 was your chosen method of protection, but I think prepared statements are a far more elegant solution. As for the overhead I very much doubt there's much difference between that and the overhead of prepared statements. -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ IIRC, prepared statements doesn't incur any overhead. Instead, it's supposed to enhance performance by telling SQL to 'prepare' via compilation. So if you're comparing performance between the overhead of base64 vs prepared statement, then the difference would be quite clear, especially when the table(s) is/are more than a couple hundred thousand rows and the queri(es) are complex. This is not mention the added complexity into the application where managing and expanding it would incur real (developer time) overhead, IMO.
Re: [PHP] Re: Secure data management
On Tue, Oct 4, 2011 at 6:07 PM, Jeremiah Dodds jeremiah.do...@gmail.comwrote: On Tue, Oct 4, 2011 at 7:51 PM, Stuart Dallas stu...@3ft9.com wrote: As for the overhead I very much doubt there's much difference between that and the overhead of prepared statements. Probably not. As an aside, I'm really struggling to find a case where it'd be worth base64-encoding the queries like that unless you were both concerned about someone sniffing your queries over the wire and sure that they wouldn't think to base-64 decode them. Not to mention that if your grand idea to prevent eavesdropping is simple transforms, If that's the case, then SSL would be a better solution since it also protects the authentication process. In then end, I still don't see base64 as a viable solution. you've got a larger problem on your hands. It *will* work, as mysql's base64 decoder won't evaluate the decoded string as a statement, afaik, but it will also expand the size of stuff by around 30% while having a, imo, much better solution widely available.
Re: [PHP] Re: Secure data management
On Tue, Oct 4, 2011 at 6:10 PM, Stuart Dallas stu...@3ft9.com wrote: On 5 Oct 2011, at 02:02, Tommy Pham wrote: On Tue, Oct 4, 2011 at 5:51 PM, Stuart Dallas stu...@3ft9.com wrote: On 5 Oct 2011, at 01:13, Tommy Pham wrote: On Tue, Oct 4, 2011 at 4:49 PM, Stuart Dallas stu...@3ft9.com wrote: On 5 Oct 2011, at 00:45, Tommy Pham wrote: On Tue, Oct 4, 2011 at 4:11 PM, Stuart Dallas stu...@3ft9.com wrote: On 5 Oct 2011, at 00:04, Mark Kelly wrote: Hi. On Tuesday 04 Oct 2011 at 21:39 Stuart Dallas wrote: http://stut.net/2011/09/15/mysql-real-escape-string-is-not-enough/ Thanks. I followed this link through and read the full message (having missed it the first time round), and while I find the idea of using base64 to sanitise text interesting I can also forsee a few difficulties: It would prevent anyone from accessing the database directly and getting meaningful results unless the en/decode is in triggers, or maybe stored procedures. No more one-off command-line queries. How would you search an encoded column for matching text? I'd be interested in any ideas folk have about these issues, or any others they can envisage with this proposal. Base64 encoding will work when the native base64 functions are available in MySQL which will allow you to base64 encode the data into a statement like INSERT INTO table SET field = FROM_BASE64(?php echo base64_encode($data); ?) sorta thing. I'm still not a massive fan of that idea given that prepared statements are an option, but it would work. Inserting and updating isn't the problem. I think Mark referring to is how would that be implemented in this simple type of query: SELECT * FROM my_table WHERE col_name LIKE '%key word%'; If there's no viable mean to filter the data, that storage method/medium is rather pointless, IMHO. Go back and read what I wrote again. Base64 is only being used to transmit the data to MySQL - it's being stored in the database in its decoded form. The question still applies as how would you safeguard that 'key word' transmission, especially against SQL injection. I suppose one could do it this way: SELECT * FROM my_table WHERE col_name LIKE CONCAT('%', FROM_BASE64(?php echo base64_encode($data); ?), '%') Is the overhead worth it to warrant that kind of safeguard? That's just a simple query with a simple search criteria. What about in the case of subselect and multi-table joins? That would indeed be logical if base64 was your chosen method of protection, but I think prepared statements are a far more elegant solution. As for the overhead I very much doubt there's much difference between that and the overhead of prepared statements. IIRC, prepared statements doesn't incur any overhead. Instead, it's supposed to enhance performance by telling SQL to 'prepare' via compilation. So if you're comparing performance between the overhead of base64 vs prepared statement, then the difference would be quite clear, especially when the table(s) is/are more than a couple hundred thousand rows and the queri(es) are complex. This is not mention the added complexity into the application where managing and expanding it would incur real (developer time) overhead, IMO. Prepared statements incur an additional hit against the DB server to prepare the statement. The cost of using base64 in the manner suggested is minimal, regardless of the size of the data. The MySQL query analyser is intelligent enough to know that from_base64('xyz') is a constant expression and will therefore only evaluate it once. Yes, as in your example, if you're inserting 1 row. What if: $hobbies = array('bicycling', 'hiking', 'reading', 'skiing', 'swimming'); * base64 method pseudo code: loop the $hobbies foreach ($hobbies as $hobby) INSERT INTO hobbies SET `name` = FROM_BASE64(?php echo base64_encode($hobby); ?) end loop * prepared statement pseudo code prepare statement INSERT INTO hobbies SET `name` = ? bind param $hobby loop the $hobbies for ($i = 0; $i count($hobbies); $i++) $hobby = $hobbies[i]; execute statement end loop There would be a difference in performance since the the expression has to be reevaluated, including the function FROM_BASE, every time versus one time evaluation of prepared statement. As for the added complexity, if you have SQL statements all over your code then yes it will add a time overhead, but any codebase of a significant size should be using a centralised API for database access such that changes like this have a very limited scope. Isn't that one of the major points of OOP? Still, what about new developers, having to remember that additional (and most likely unneeded) complexity, to the project which they would like to build additional modules/plugins for? -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/
Re: [PHP] book quest
On Wed, Sep 28, 2011 at 5:29 PM, Jim Lucas li...@cmsws.com wrote: On 9/28/2011 3:26 PM, Bastien Koert wrote: On Wed, Sep 28, 2011 at 6:20 PM, Kirk Bailey kbai...@howlermonkey.net wrote: The best book for a beginner? No, don't tell me php.net, I hear that one already, and while it is indeed good, I want something in a dead tree edition I can canny around and smoke as needed. -- end Very Truly yours, - Kirk Bailey, Largo Florida kniht +-+ | BOX | +-+ think -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I had great success with Wrox PHP Programming and PHP Essentials by Julie C. Meloni The latter is dated, but was clearly written. PHP Essentials (first edition) by Julie C. Meloni was the first book about PHP that I ever bought. I did not find it very useful. The second book was Core PHP First Edition by Leon Atkinson. It was more like an encyclopedia/dictionary with some decent examples. Around 2001 I started participating the general mailing list. I haven't bought another book on PHP since. PHP.net manual, the php-general mailing list and the wonderful members of this list, and Google have provided answers for all the questions I have ever needed to ask since. Jim Lucas Is there something wrong with the PHP.net manual? Or you just want something physical to be able read any where and stay unplugged? If the latter and there's nothing wrong with the official manual, try downloading the chm or single html file and print as you go. No need to lug around thick that manual/reference ;) Regards, Tommy
Re: [PHP] PHP5 cgi Suexec htaccess rewrite issue
On Thu, Sep 29, 2011 at 5:43 AM, Shaun Morrow morrow.sh...@gmail.comwrote: I am running a server with cPanel on and want to have php run as a cgi with Suexec enabled I cannot seem to rectify an issue, when I set the handler to cgi, my rewrite rules on one of my sites stop working Sample url: http://examplesite.com/ad/123-abcde/ The rewrite rule for this is below; RewriteEngine on RewriteBase / RewriteRule ^ad/([0-9]+)(.*)$ ./index.php/ads/ads/action/viewAd/frmAdsID/$1/adTitle/$2 [L] Currently the php 5 handler is dso, and the rewrite rule works perfectly. If the handler is set to cgi, the rewrite rule does not work and I the site just displays the home page. I am at a loss and would appreciate some help. Thanks in advance! Did you make the changes accordingly in php.ini? I recall that cgi/fastcgi requires different configuration than from isapi type - dll/dso. I don't know how httpd handles impersonation on *nix platform as I've never had to configure it that way. Here's a few from the php.ini ; The root of the PHP pages, used only if nonempty. ; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root ; if you are running php as a CGI under any web server (other than IIS) ; see documentation for security issues. The alternate is to use the ; cgi.force_redirect configuration below ; http://php.net/doc-root ; cgi.force_redirect is necessary to provide security running PHP as a CGI under ; most web servers. Left undefined, PHP turns this on by default. You can ; turn it off here AT YOUR OWN RISK ; **You CAN safely turn this off for IIS, in fact, you MUST.** ; http://php.net/cgi.force-redirect ; if cgi.nph is enabled it will force cgi to always sent Status: 200 with ; every request. PHP's default behavior is to disable this feature. ; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. PHP's ; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok ; what PATH_INFO is. For more information on PATH_INFO, see the cgi specs. Setting ; this to 1 will cause PHP CGI to fix its paths to conform to the spec. A setting ; of zero causes PHP to behave as before. Default is 1. You should fix your scripts ; to use SCRIPT_FILENAME rather than PATH_TRANSLATED. ; http://php.net/cgi.fix-pathinfo ; FastCGI under IIS (on WINNT based OS) supports the ability to impersonate ; security tokens of the calling client. This allows IIS to define the ; security context that the request runs under. mod_fastcgi under Apache ; does not currently support this feature (03/17/2002) ; Set to 1 if running under IIS. Default is zero. ; http://php.net/fastcgi.impersonate Note that the above is from old config file and is configured for PHP to run as FastCGI on IIS7.5. There maybe recent changes regarding httpd and impersonation. Go through the php.ini and make all relevant changes regarding 'cgi'. Regards, Tommy
Re: [PHP] book quest
On Thu, Sep 29, 2011 at 10:12 AM, George Langley george.lang...@shaw.cawrote: On 2011-09-29, at 8:53 AM, Andy McKenzie wrote: Is there something wrong with the PHP.net manual? Or you just want something physical to be able read any where and stay unplugged? If the latter and there's nothing wrong with the official manual, try downloading the chm or single html file and print as you go. No need to lug around thick that manual/reference ;) Regards, Tommy I didn't find that there was anything wrong with the PHP.net manual, except that it wasn't a book about learning to program. It's a fantastic reference guide; if I can't remember what order the inputs to that one function go in, it's my first resort. But I prefer to read paper for learning theory, and I find it more useful to flip through pages trying to find something I half remember than to click through links. Put simply, I like to learn the basics from books rather than web pages. -- And as the OP said, something that they can carry around - websites don't always cut it on the morning commute! (Although I hope the OP wouldn't smoke anything!) I too prefer books, as they are usually organized as a training course, starting you with the basics and walking you through a logical progression of learning, as well as giving real-world lessons and experience. Not saying that php.net is or isn't, but more often than not, the manuals that come with software are organized by sections or features, and do not give you the basics from which to start. It's no good to start with This is the drawing tool, if you don't know how to create a canvas to draw on. Reference books/sites are good once you know the basics on proper techniques, best practices and sensible workflows, and you can now expand into the full features that the software can offer. Plus, they can target your skills and desired learning - am currently researching Drupal, and have found some books that teach the basics on using it within its limits, and then others that teach how to build your own modules and plugins. Depending on what you are looking for, you can quickly target the skills you need to learn. And, is easier to make your notes in the margins on a piece of paper! Having said that, one of the main books I used for PHP was Apress' Beginning PHP and MySQL, which is now in a 4th edition: http://www.apress.com/9781430231141 It provided a logical approach to both technologies and how to integrate them, all in one book. Then get one that focuses on security. O'Reilly has one (or more), but the one I picked up was Securing PHP Web Applications: http://www.amazon.ca/Securing-PHP-Applications-Tricia-Ballad/dp/0321534344 and was a good read. I just wish book publishers offered an upgrade path if you bought an earlier edition, the way software publishers do! Perhaps that will be the greatest advantage an iPad or Kobo will have over paper. George Langley Multimedia Developer @Andy and George From the layout of the official manual, whilst it doesn't have the traditional method of explaining as textbooks, to me, it does however progress as you mentioned: Installation and Configuration - same as any PHP book I've seen though the other books may not explain all different methods and/or different platforms as the official. +1 Language Reference - Basic Syntax - Types - Variables - Constants - Expressions - Operators - Control Structures - Functions - etc... @George, As for morning commute, if you're driving, you shouldn't be reading anything. :) That's why I mentioned 'print'. Printing as you read/progress means carrying less than entire book. Any decent book will range in about 400+ pages. Another good side to printing as you go is that a thick book wouldn't seem overwhelming for beginners as to how much information they have to digest and absorb, especially someone who is new to IT and not used to reading thick books/manuals. As for the book giving real world experiences, that's only to give you small idea of what you _may_ encounter. Personally, I find that too broad and in depth to encompass in a book unless it's a(n) auto/biography. A good example to that is accessing database. How do you explain to someone new which he/she should use and why: straight access via client library, ODBC, PDO, abstraction/wrappers, ORM, and/or any combination there of. Although this requires some understanding of PHP, I don't recall any book hinting or briefly explaining all the possible methods of DB access. A long time ago, I wrote an abstraction wrapper that would allow me to access any DB that PHP supports and allow simultaneous connections to same and/or different DBs because my need was there. That same wrapper would allow DB specific operations too. IIRC, this was long before various PDO drivers, namely MS SQLServer, were available and became popular.
Re: [PHP] Getting meta data (of any type) for an XML file being from it's URL.
On Thu, Sep 29, 2011 at 9:09 AM, Richard Quadling rquadl...@gmail.comwrote: Hi. I'm looking to process very large XML files without the need of first downloading them. To that end, SimpleXMLIterator('compress.zlib:// http://www.site.com/products.xml.gz') is working perfectly. But a downside is that I have no information of my progress. Is there any mechanism available to get a position within the XML stream? I can use libxml_set_streams_context() to set a context (so I can provide POST data if needed for the HTTP request), but I can't see how to gain access to the stream within the libxml code (SimpleXML uses libxml). At the most basic, what I'm looking for is to be able to record a percentage complete. Even with compression, I'll be reading some bytes from a stream (either from http or from compress.zlib) and I want to know where I am in that stream. The HTTP header will tell me how big the file is (so that can easily be a HEAD request to get that data). Even if I DO save the file locally first, I still can't get a position. If I use the SimpleXMLIterator::count() method, I am unsure as to what will happen if I am using a stream (rather than a local file). If I use ... $xml = new SimpleXMLIterator(...); $items = $xml-count(); foreach($xml as $s_Tag = $o_Item) { ... } will the XML file be cached somewhere? Or will that depend upon the originating server supporting some sort of rewind/chunk mechanism? Any suggestions/ideas? Richard. -- Richard Quadling Twitter : EE : Zend : PHPDoc @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea Richard, Only think I can think of is break up into 2 parts. 1st part use cURL for the down streams and monitor it's progress. 2nd part is XML parsing. If you want to do both simultaneously and only if the remote supports chunked encoding/transfer, you could use multiple handles of cURL into numerical indexed array variable containing the chunks for XML parsing. This could be memory intensive if the file is very large, depending whether you free the elements in the array as you progress. So if memory consumption is a major concern, you may want to save to the file locally until the import/migration is done as there maybe a situation where you'll need to review the data and, thus, saving the time and bandwidth of having to re-download the data. Regards, Tommy
Re: [PHP] Getting meta data (of any type) for an XML file being from it's URL.
On Thu, Sep 29, 2011 at 3:27 PM, Tommy Pham tommy...@gmail.com wrote: On Thu, Sep 29, 2011 at 9:09 AM, Richard Quadling rquadl...@gmail.comwrote: Hi. I'm looking to process very large XML files without the need of first downloading them. To that end, SimpleXMLIterator('compress.zlib:// http://www.site.com/products.xml.gz') is working perfectly. But a downside is that I have no information of my progress. Is there any mechanism available to get a position within the XML stream? I can use libxml_set_streams_context() to set a context (so I can provide POST data if needed for the HTTP request), but I can't see how to gain access to the stream within the libxml code (SimpleXML uses libxml). At the most basic, what I'm looking for is to be able to record a percentage complete. Even with compression, I'll be reading some bytes from a stream (either from http or from compress.zlib) and I want to know where I am in that stream. The HTTP header will tell me how big the file is (so that can easily be a HEAD request to get that data). Even if I DO save the file locally first, I still can't get a position. If I use the SimpleXMLIterator::count() method, I am unsure as to what will happen if I am using a stream (rather than a local file). If I use ... $xml = new SimpleXMLIterator(...); $items = $xml-count(); foreach($xml as $s_Tag = $o_Item) { ... } will the XML file be cached somewhere? Or will that depend upon the originating server supporting some sort of rewind/chunk mechanism? Any suggestions/ideas? Richard. -- Richard Quadling Twitter : EE : Zend : PHPDoc @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea Richard, Only think I can think of is break up into 2 parts. 1st part use cURL for the down streams and monitor it's progress. 2nd part is XML parsing. If you want to do both simultaneously and only if the remote supports chunked encoding/transfer, you could use multiple handles of cURL into numerical indexed array variable containing the chunks for XML parsing. This could be memory intensive if the file is very large, depending whether you free the elements in the array as you progress. So if memory consumption is a major concern, you may want to save to the file locally until the import/migration is done as there maybe a situation where you'll need to review the data and, thus, saving the time and bandwidth of having to re-download the data. Regards, Tommy An afterthought, handling streams and parsing at the same may require sophisticated XML node validations as the node maybe split between the transferred chunks.
Re: [PHP] 'Mobile' PHP
Have you looked at Quercus to see if it could run on Android? If it could, you can then run your PHP code then.
Re: [PHP] 'Mobile' PHP
On Fri, Sep 23, 2011 at 11:37 AM, Lester Caine les...@lsces.co.uk wrote: Tommy Pham wrote: Have you looked at Quercus to see if it could run on Android? If it could, you can then run your PHP code then. http://techblog.aasisvinayak.**com/deploy-php-applications-** in-google-app-engine/http://techblog.aasisvinayak.com/deploy-php-applications-in-google-app-engine/popped up while I was searching. The bit I'm still wasting time on at the moment is how to deploy it as a stand alone application on the tablet I have, but I'm not sure that I can pull stuff yet as the 'android marketplace' sites complain that my 'phone is not recognised' :) -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/wiki/?page=**contacthttp://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.php From the link you gave, looks like it uses Quercus after all. So you might want to see if you could just Quercus running 1st.
Re: [PHP] How can I check for characters in a $_POST[] variable?
On Thu, Sep 22, 2011 at 7:55 AM, Eric eric_justin_al...@cfl.rr.com wrote: I have this problem when using php because my computer recognizes the characters . and .. as an existing file when I use file_exists. Also I want to check $_POST[username] for characters other then A-Z a-z and 0-9. If it contains anything other then, I would like to prompt the user but I can't seam to use foreach properly and I don't know how to itterate through the post variable with a for loop while loop or do while loop. $pattern = '/^[A-Za-z0-9]/'; /* http://php.net/control-structures.foreach */ foreach ($_POST as $key = $value) { /* http://php.net/function.preg-match */ if (preg_match($pattern, $value) 0) { /* prompt user */ } }
Re: [PHP] Re:
On Thu, Sep 22, 2011 at 9:25 AM, Eric eric_justin_al...@cfl.rr.com wrote: Thanks Very much I used, preg_match('/[[:punct:]]/', $_POST['username']) !== 0 and it works without errors. The reason I can't just use is_file which I wish I could is because windows doesn't allow question marks or some wierd character. It decides to not allow php to make the file if there are odd ball characters. It is a very unfortunate mistake in my code that I wish php would ignore and just make the file ?. To prevent possible future warnings and errors use: if (isset($_POST['username']) preg_match('/[[:punct:]]/', $_POST['username']) !== 0)
Re: [PHP] PHP installations, usage, and popularity
On Tue, Sep 20, 2011 at 5:00 AM, Bastien phps...@gmail.com wrote: On 2011-09-20, at 12:05 AM, Tommy Pham tommy...@gmail.com wrote: ASP? Not ASP.NET? Wow... I haven't any new sites deployed in ASP in almost 10 years. IIRC, ASP is nothing more but bunch of spaghetti codes and no OOP. That's why attendance/registration is so low. Only main web (server side) development languages are ASP.NET (C#), Java, and PHP (listed as alphabetical order - not based on demand/popularity). You'd probably say Perl and/or Python too. IMO, best way to convince the administration is job search for ASP under IT category and show them the results vs search for PHP ;) No need for long explanations and comparisons since the point of having students certified is that they could get a job quickly. Best wishes, Tommy Ha, tommy, My workplace app is classic asp and it sucks! I'll let you decide which sucks ;-). It's over 1300 files, and spaghetti isn't the word. It's failure points are so many that the pen test tools used created reports of 3000 pages. I have been pushing to move to php for years but the geniuses at the top told me that php was a 'hobbiest language'. Note this same person told me that we were moving to c# because it had the most examples on the msdn network pages. ( yes, I know it's an account setting in the msdn network :-) ) Bastien You can tell those 'geniuses' that IBM, a 40 year old 500 pound gorilla that started the PC industry, doesn't think so. Google 'IBM PHP' shows 99,500,000 results. The first link http://www.ibm.com/systems/i/software/php/index.html shows how their systems run PHP. *Open to Innovation* Are you looking to develop or deploy Web applications? PHP, the leading scripting language for Web applications, provides an open and easy to use alternative and gives you access to thousands of open source applications and scripts. Thousands of IBM i customers around the world have downloaded Zend’s PHP products for i for a wide variety of web application development and deployment initiatives. .. i ... refers to their i series servers. Also, ask them what does IBM stand for and why would a company with that name supports PHP strongly. And if that doesn't open their mind up, ask them of what they think about Oracle. Then Google Oracle PHP, showing 199,000,000 results, and let them think if it's still a hobbyist language. Oracle, another almost 40 year old 500 pound gorilla, started the commercial RDBMS industry. The examples can go on and on... ;) Regards, Tommy
Re: [PHP] Re: While on the topic of PHP Web Site Stats - SharePoint...
I don't know about external facing and 'most web sites use SharePoint' but SharePoint is mainly used in conjunction with other midsize/enterprise MS applications such as Exchange, SQLServer and other MS products, including SSO integration with Active Directory. I've yet to see it used as standalone with only MS SQLServer. If you want to use a CMS without having the need to use any other enterprise, or midsize, MS apps, it's expensive to deploy as you'll need to deploy on Windows. On top of that, the recent version Foundation 2010 is a PAIN IN THE *SS to deploy and maintain with any SQL Express version. Don't even think about developing it further on the Foundation 2010. Buying MS SQLServer just for the sake of SharePoint only is not worthwhile as that cost is even higher. Furthermore, SharePoint 2010, even the free version Foundation, is very hardware demanding. Simply put, if your company currently using any MS products, Exchange, SQLServer, etc. and is midsize+, then it maybe justifiable to use SharePoint, not just the free version. Else, if you just need a CMS that's the lowest TCO and easier to maintain, stick w/ PHP and Open Source, IMO. Regards, Tommy
Re: [PHP] PHP installations, usage, and popularity
ASP? Not ASP.NET? Wow... I haven't any new sites deployed in ASP in almost 10 years. IIRC, ASP is nothing more but bunch of spaghetti codes and no OOP. That's why attendance/registration is so low. Only main web (server side) development languages are ASP.NET (C#), Java, and PHP (listed as alphabetical order - not based on demand/popularity). You'd probably say Perl and/or Python too. IMO, best way to convince the administration is job search for ASP under IT category and show them the results vs search for PHP ;) No need for long explanations and comparisons since the point of having students certified is that they could get a job quickly. Best wishes, Tommy
Re: [PHP] Which versions of Apache will PHP 5.3.6 work with??
On Fri, Mar 25, 2011 at 10:52 AM, Curtis Tammany curtis.tamm...@urs.com wrote: Help!! I am in a Windows environment (XP SP3 for development and Server 2003 for production. I have to upgrade to PHP 5.3.6. It does not appear to work with either Apache 2.2.11 or the new 2.2.17 from Apache Lounge. Apache will run by itself but when PHP is installed, it adds: #BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL PHPIniDir C:\Program Files\PHP536\ LoadModule php5_module C:\Program Files\PHP536\php5apache2_2.dll #END PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL Restarting Apache causes the following: httpd.exe - Application Error : The instruction at 0x0096c1bf referenced memory at 0x100058a8. The memory could not be written. Thanks in advance, Curtis Curtis, IIRC, you can't run VC9 (Visual Studio 2008) binary with VC6 binary smoothly, which I believe where you got the official binary distributions, PHP and httpd, respectively. Here's the info from [1]. There used to be a VC6 binary release for PHP v5.3.3 at windows.php.net but I don't see a VC6 build for v5.3 now. Any way, since you're using using Windows, why not just run it as FastCGI? It runs fine on Win2003 (x86), Win7 x64, Win08 (x86 x64), and Win08r2. Are using a specific Apache module that's why you need to use httpd? If so, you could use the (non official) Apache Lounge's binary. The windows binary is build with original sources from ASF ( http://httpd.apache.org ) and contains the latest patches. It is build with the latest Windows® Platform SDK and Visual Studio C++ 2008 aka VC9, which have improvements in areas like Performance, MemoryManagement and Stability over the .msi binary from the ASF site which is build with VC6. LoadRunner (Load Testing Software Suite) shows that there are improvements in performance using Apache built with VC 2008. That performance gain can be affected by numerous factors (use of scripting language such as Perl, PHP, Python, etc…as well as the actual scripts themselves). LoadRunner testing does show a marked improvement for Apache compiled under VC 2008 in stability under rigorous condition. Minimum system required: Windows 7, Windows Server 2008 R2, Windows Vista, Windows Server 2008, Windows XPSP3 and Windows Server 2003 R2. Regards, Tommy [1] http://www.apachelounge.com/download/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Which versions of Apache will PHP 5.3.6 work with??
On Fri, Mar 25, 2011 at 12:12 PM, Tommy Pham tommy...@gmail.com wrote: On Fri, Mar 25, 2011 at 10:52 AM, Curtis Tammany curtis.tamm...@urs.com wrote: Help!! I am in a Windows environment (XP SP3 for development and Server 2003 for production. I have to upgrade to PHP 5.3.6. It does not appear to work with either Apache 2.2.11 or the new 2.2.17 from Apache Lounge. Apache will run by itself but when PHP is installed, it adds: #BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL PHPIniDir C:\Program Files\PHP536\ LoadModule php5_module C:\Program Files\PHP536\php5apache2_2.dll #END PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL Restarting Apache causes the following: httpd.exe - Application Error : The instruction at 0x0096c1bf referenced memory at 0x100058a8. The memory could not be written. Thanks in advance, Curtis Curtis, IIRC, you can't run VC9 (Visual Studio 2008) binary with VC6 binary smoothly, which I believe where you got the official binary distributions, PHP and httpd, respectively. Here's the info from [1]. There used to be a VC6 binary release for PHP v5.3.3 at windows.php.net but I don't see a VC6 build for v5.3 now. Any way, since you're using using Windows, why not just run it as FastCGI? It runs fine on Win2003 (x86), Win7 x64, Win08 (x86 x64), and Win08r2. Are using a specific Apache module that's why you need to use httpd? If so, you could use the (non official) Apache Lounge's binary. The windows binary is build with original sources from ASF ( http://httpd.apache.org ) and contains the latest patches. It is build with the latest Windows® Platform SDK and Visual Studio C++ 2008 aka VC9, which have improvements in areas like Performance, MemoryManagement and Stability over the .msi binary from the ASF site which is build with VC6. LoadRunner (Load Testing Software Suite) shows that there are improvements in performance using Apache built with VC 2008. That performance gain can be affected by numerous factors (use of scripting language such as Perl, PHP, Python, etc…as well as the actual scripts themselves). LoadRunner testing does show a marked improvement for Apache compiled under VC 2008 in stability under rigorous condition. Minimum system required: Windows 7, Windows Server 2008 R2, Windows Vista, Windows Server 2008, Windows XPSP3 and Windows Server 2003 R2. Regards, Tommy [1] http://www.apachelounge.com/download/ argh.. didn't read it well . I was typing it while on the phone :))... Anyway, if you don't need to use any Apache module, then go with FastCGI. Goodluck! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-WIN] Re: [PHP] Which versions of Apache will PHP 5.3.6 work with??
On Fri, Mar 25, 2011 at 1:44 PM, Pierre Joye pierre@gmail.com wrote: On Fri, Mar 25, 2011 at 8:12 PM, Tommy Pham tommy...@gmail.com wrote: There used to be a VC6 binary release for PHP v5.3.3 at windows.php.net but I don't see a VC6 build for v5.3 now. Any way, since you're using using Windows, why not just run it as FastCGI? It runs fine on Win2003 (x86), Win7 x64, Win08 (x86 x64), and Win08r2. Apache module works just fine and is in many situations much faster than fcgi. I've never tested the difference for performance. If that's the case, any particular reason to stop support ISAPI for IIS then? or is FastCGI faster than ISAPI for IIS? Prior to upgrading to PHP v5.3 and Windows 64bit, I had faster initial response time from ISAPI. Now with FastCGI, the initial response takes longer. As for performance difference through repeated requests, I don't notice the difference between ISAPI v5.2 and FastCGI v5.3. Are using a specific Apache module that's why you need to use httpd? If so, you could use the (non official) Apache Lounge's binary. There are no official builds of Apache, but convenience builds. Cheers, -- Pierre @pierrejoye | http://blog.thepimp.net | http://www.libgd.org I've meant official in the sense that one could download from the official/mirror site. Thus it's more trust worthy, in terms of non malicious code. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] opening a new window from php script
On Fri, Mar 25, 2011 at 2:59 PM, Grega Leskovšek legr...@gmail.com wrote: I am working on CMS designed to those who are unfamiliar with a computer world and I want to offer a task where on a push of a button it will save current working page in textarea/s and open this page in a new tab or in a new window. PHP is server side. push of a button is client side. Google javascript+onClick. I googled some, but am still not sure how can I do it. Do I have to use target=_new - I can not do this - I am working this for my University seminar and it has to be valid HTML5. Please help me improve my plan 1. I check wheter the user is using windows, linux, mac and then show appropriate possibility of all browsers for the targeted platform (WIN:IE,SA,FF,CH,OP, LINUX:FF.CHROMIUM and I need help for the mac also besides SA and FF what does it have among browsers?) Have you tried to google for browser versions and platform? While searching for the same thing long time ago, I found a site that lists them. Also, note that since you'll be using onClick for push of a button, beware of Javascript version difference among the browsers. IIRC, IE is supports 1.3 and FF supports 1.9. Haven't tested the others so couldn't tell you. 2. When the browser clicks button with the image of browsers inside anchor I target _new and location of the current file ?1 How can I offer option to open a new window not a new tab? ?2 How can I avoid the target attribute? ?3 How can I make a click on an image to produce action - or what do You suggest me to use - I would prefer img element not button with an image - how can I do this? Once I will finish it I will offer here software to everybody so I will be able to get some response and improve it and this is one of the major problems otherwise it is already functional. Please help me, thanks in advance - or ? You think I could do this better in JS? -- When the sun rises I receive and when it sets I forgive - http://moj.skavt.net/gleskovs/ Always in Heart, Grega Leskovšek I don't know if you have Flash in your tool belt but have you considering using it? It may simply your life with various browsers and their versions across different platforms. Note: Flash does tend to be sluggish in terms of loading time and how much of what you need the Flash to do. Regards, Tommy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Probem with go-pear.bat
On Sun, Mar 13, 2011 at 5:49 PM, Alejandro Crosa alec...@ymail.com wrote: Hi...I try install pear by executing the go-pear.bat file, but I get a follow message: The go.pear.phar.dll is not a image valid of windows. Please, any help is important for me. Thanks. Alejandro See http://pear.php.net/manual/en/installation.getting.php -- 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 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. 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. -- 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 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. Multi-language support and yet 'toward a more optimized C implementation'? 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 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 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? 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. Do you want your vacation disturbed? Except in the case of an emergency, I don't. :) 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. We have a DBA, developer (also the manager), and I'm the system/network/telecom admin. We all have cross discipline experience and train ourselves in areas we lack for basic support. Every one of us don't have a problem taking a month vacation 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 leaving country. How fast and well do you someone can be cross trained to learn C? Even if just basic support? As for printf, PHP has that and print. Regarding learning and using C, I had only 1 quarter of it in college and that was back in the early '90s. I don't remember C as an 'over complicated in an optimization standpoint', IIRC, I just had problems with memory optimization, but that's another issue. But I haven't used it since other than scanning the some source code for compilations W(A/I)MP x64 stack. About optimization, isn't it more in terms of modular design then including more languages than is necessary? If PHP is sluggish, wouldn't be best to bring it up to the PHP developers? SQL = back end data storage PHP = processing input/output, including back
Re: [PHP] Re: Delaying $(document).ready() in jQuery until php script finish
We're going way off-topic. Perhaps start a new thread? :) -- 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 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? -- 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:31 AM, David Hutto smokefl...@gmail.com wrote: 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. 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? 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
Re: [PHP] Re: Delaying $(document).ready() in jQuery until php script finish
On Sat, Mar 12, 2011 at 2:40 AM, David Hutto smokefl...@gmail.com wrote: 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. Then you obviously didn't read my example fully. Isn't Javascript/Flash a language? Javascript/Flash provides what PHP lacks, client side. If PHP has performance issues, you're introducing complexity by adding C into the mix when the performance issues should be brought to the PHP developers' attention, as stated before. If you really have issues with PHP's performance, why even bother to include PHP then? Why not just do C to crank out HTML, JS, and CSS since portability isn't a concern as you've stated? My nose isn't in PHP's asshole. I code in C# (ASP.NET and Winforms) when my need is there. In some of those instances, I had to use PInvoke because C# didn't provide the functionality I need. So I don't have problems using multi-language solution. To me, your proposal just add complexity into something that should have been properly addressed in the first place. This brings right along with the discussion about PHP implementing threads. If you need threads for better performance and since PHP doesn't provide it, then I do see use for C. Other than that, I don't ATM. 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? Are you reading it correctly? The 'No, the problem lies in the error ...' isn't my comment... 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. Yes, he showed me his coursework and tried to get the PhD. Due to a family emergency, he couldn't complete it at that time. Yes, we all saw each other's resume and CV. And cross trained to provide support in the areas where anyone of us lacks the basics so we could provide full 24/7 support in the event that there are 2 of 3 IT members available for _any reason_: vacation, family emergency, etc... 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
Re: [PHP] Check for open file
On Fri, Mar 4, 2011 at 7:09 AM, Steve Staples sstap...@mnsi.net wrote: Depending on the size of the file, wouldn't this fall under the 2gb limitation on windows 32bit OS? I ran into this problem on a project I was working on, and ended up switching to Python (but that is a WHOLE other conversation) just food for thought, since I am not sure of the size of files they are dealing with. Steve Jumping in late. I've been too busy. Steve, I think you're probably referring to FAT32 file system. IIRC, NTFS doesn't have that low limit. [1] Regards, Tommy [1] http://technet.microsoft.com/en-us/library/cc938937.aspx -- 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
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). 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