[PHP] suhosin and 5.4 onwards
Ok, so I know this might start flame wars, but... here goes ;) It seems suhosin is dead as far as 5.4 goes, now, some make allegations that it is no longer needed since php has allegedly incorporated much of its safe guards, but these claims are from self proclaimed experts (a term i use very loosley) on forums and blogs. So, is the general opinion here, from actual factual experience and not because you read the same trashy bloggers as I did, in agreeance? is it genuinely true that suhosin is now irrelevant with 5.4 upwards and php is now much safer on its own? We have always appreciated its work to stop plugins and so forth escaping local jails by example open_base or some other lock-down type setting, plus injections and so forth. if php has incorporated such, thats fine, but I have no idea where to turn to ask for factual information on this, so I'm asking here and hope that a dev or someone in the inner circle knows the facts, and not rumours or sumizes, or a tleast more facts than half the self appointed gurus claim :) Thanks Nikki -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Binding object instances to static closures
This will not work. As stated in the PHP documentation Static closures cannot have any bound object A static Closure has no context of this just as with any other static object. A workaround is to pass in the Closure as a parameter to achieve a similar result. class TestClass { public static function testMethod($function) { $testInstance = new TestClass(); $function = $function-bindTo($testInstance); call_user_func_array($function, [$testInstance]); // should be true } } TestClass::testMethod(function($param){ var_dump($this === $param); }); On Fri, May 31, 2013 at 2:32 PM, Nathaniel Higgins n...@nath.is wrote: I'm talking about PHP 5.4. `bindTo` is a Closure method in PHP 5.4, and allows you to set the `$this` variable inside of a Closure. However, apparently you can't use it on Closures created inside static methods. I knew that you could create another function which would return the Closure, however, that isn't what I asked. I wanted to either use the `bindTo` method on a static Closure, or create a non-static Closure in a static method. On 31 May 2013 19:25, David Harkness davi...@highgearmedia.com wrote: On Fri, May 31, 2013 at 10:54 AM, Nathaniel Higgins n...@nath.is wrote: Is it possible to bind an instance to a static closure, or to create a non-static closure inside of a static class method? PHP doesn't have a method to do this. In JavaScript you can use jQuery's var func = $.proxy(function () { ... }, object); In fact, you cannot use $this inside a closure at all (unless 5.4 has added a way that I haven't seen yet). You can get around that by declaring a local variable to hold a reference to the instance to use with use. It looks strange here because you're also passing in $testInstance for the comparison. ?php class TestClass { public static function testMethod() { $testInstance = new TestClass(); $closure = $testInstance-createClosure($testInstance); call_user_func($closure); // should be true } private function createClosure($testInstance) { $self = $this; return function() use ($self, $testInstance) { return $self === $testInstance; } } } TestClass::testMethod(); Peace, David -- Thanks, http://nath.is @NatIsGleek http://twitter.com/natisgleek -- -- Unless otherwise specified, this conversation can be classed as confidential, and you have no permission to share all, part, or even the gist of this conversation with anyone not part of the original conversation. If in doubt, please contact be with the above links, or on my UK phone number - *07427558947*. Please be thoughtful of what time it is in the UK at your time of calling. -- Nickolas Whiting Lead Developer X Studios 321-281-1708x107
Re: [PHP] Random
Lola On Friday, May 24, 2013, Ashley Sheridan wrote: Last Hacker Always onpoint lasthack...@gmail.com javascript:; wrote: I needed something like this echo(rand(1,30)) On 5/24/13, Last Hacker Always onpoint lasthack...@gmail.comjavascript:; wrote: okay thanks tamouse and others you think am not on point hmmm? I'll show you i am. On 5/24/13, tamouse mailing lists tamouse.li...@gmail.comjavascript:; wrote: On Thu, May 23, 2013 at 3:51 PM, Last Hacker Always onpoint lasthack...@gmail.com javascript:; wrote: Hey I need code for random number 1-30 for my site. function rand_from_1_to_30() { return 4; } Did you actually try that? Thanks, Ash -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- - Nick
Re: [PHP] A Good OOP Tutorial/Read?
OO comes from the heart. You know you have it when everything you look at turn into objects, attributes, accessors, mutators, and constructors. When IBM transitioned from functional to OO level programming, they had their top level engineers walk into a room and tell their employees that 80% of their employes will not be able to make the transition. Which percent are you? Ninus Khamis (PhD) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A Good OOP Tutorial/Read?
interface Shape { public double getArea(); } class Circle implements Shape { double radius; public Circle(int double radius) { this.radius = radius; } public double getArea() { return (radius * radius * 3.1415); } } class Square implements Shape { double side; public Square(int double side) { this.side = side; } double getArea() { return (side * side); } } Please make an effort to understand polymorphic concepts of OOP as they are rudimentary. Without that one will never grasp OO Patterns (Gang of Four). Ninus. On 5/16/13, Tedd Sperling tedd.sperl...@gmail.com wrote: Thanks to both Bastien and Sebastian: While I understand that an interface is like an abstract Class, in that you don't have to flesh-out your methods, but rather where you define exactly how Classes who implement that interface will be required to flesh-out those methods. But so what? What's the point? Without giving me complicated examples, just give me one simple example that illustrates the advantage of using an interface over writing a new Class where you flesh-out whatever methods you want. After all, an interface requires the same thing, does it not? As such, I just don't see the advantage interfaces bring. Cheers, tedd _ tedd.sperl...@gmail.com http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Having a problem with clone.
Do you have a backtace for this? What is the gender class doing? Have u done a global search for keyword clone? On Friday, May 10, 2013, Richard Quadling wrote: Hi. I'm having an issue where I get ... Fatal error: Trying to clone an uncloneable object of class Smarty_Variable in xx/trunk.newbuild/includes/frontend/site_includes/classes/smarty-3.10/sysplugins/smarty_internal_template.php on line 269 This issue happens consistently on our live server and on our test server, but not on my dev setup. The issue doesn't happen if I comment out 1 line of completely unrelated code ... $o_Gender = new Gender\Gender; If I immediately follow that with ... unset($o_Gender); and have no other access to $o_Gender, I still get the error. Comment out the code, no problems. The extension is used in other parts of the system with seemingly no problem. That is, the code behaves as expected and I get no errors, but those elements don't use Smarty. The error being reported is clearly wrong. And the extension (as far as I can see) has no interaction with global elements in any way (I have to use the Gender namespace to access anything in it - which I think is correct). I've var_dump()'d a debug_backtrace() at the point of failure in the Smarty code, with and without the $o_Gender variable being defined (it isn't used in the Smarty template - so Smarty is never touching it). When I compare the 2 dumps, the only differences is in the datetime stamp elements and the object count values (there's 1 more when $o_Gender exists). My setup is on a CentOS VM running PHP V5.4.14 The live setup is on a remote CentOS server running PHP V5.3.21 The test server is on CentOS server running PHP V5.3.3 I don't know CentOS well enough to just swap out a new version of PHP. But I will be getting some help on that. Where do I start to find the problem? I have full root access to the command line test server, so I can, within reason, follow instructions to run/wrap the code in any way needed. Any help would be GREATLY appreciated!!! Thanks in advance, Richard. -- Richard Quadling Twitter : @RQuadling -- Nickolas Whiting Lead Developer X Studios 321-281-1708x107
[PHP] Introduction ... !
Hello PHP'ers! Just thought I would introduce myself to the mailing list since I've worked with PHP for almost 10 years now and yet haven't really been community active ... I've developed quite a few open-source projects over the years that I hope someone here will find as useful as I have ... they are all hosted on Github @prggmr. XPSPL - Signal Processor in PHP docpx - PHP Documentation Generator for Sphinx Again Hello Everyone! Cheers! -- Nickolas Whiting - prggmr.org - Remember to write less code that does more faster -
Re: [PHP] Holding datetimes in a DB.
On Fri, Mar 1, 2013 at 7:04 PM, Sebastian Krebs krebs@gmail.com wrote: 2013/3/2 tamouse mailing lists tamouse.li...@gmail.com On Fri, Mar 1, 2013 at 11:53 AM, Matijn Woudt tijn...@gmail.com wrote: On Fri, Mar 1, 2013 at 11:49 AM, Richard Quadling rquadl...@gmail.com wrote: Hi. My heads trying to remember something I may or may not have known to start with. If I hold datetimes in a DB in UTC and can represent a date to a user based upon a user preference Timezone (not an offset, but a real timezone : Europe/Berlin, etc.) am I missing anything? Richard. I would only use this if you're planning to have servers all around the world in different timezones, then it would be easier to interchange data. Otherwise, stick with ur local timezone and it will save you a lot of unneeded timezone conversions probably. - Matijn This may be just me, but I've always preferred my servers, database, and such to run UTC, and let users select their own time zone they'd like to see. Well, imo it depends ;) There are cases, where it is interesting to know, when from the users point of view they have created the entity (like a blog post, a comment, or something like that). The TZ is part of the data and converting it silently to UTC is always data-loss. So in most cases it is OK, but not in every :) You can still convert from entity-TZ to UTC to user-TZ later. Its just one additional step. Regards, Sebastian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- github.com/KingCrunch I have found that it's always best to stick to UTC ... regardless of anything else ... since saving the users local and going to and from can easily be wrapped into a single entry/exit function and I've had to many instances where it was saved as local and it came back to bite simply to save a few minutes. That said this is something I feel should be documented since for many newcomers they usually don't think about timezones until it becomes a problem ... Cheers! -- Nickolas Whiting - prggmr.org - Remember to write less code that does more faster -
Re: [PHP] Introduction ... !
On Fri, Mar 1, 2013 at 6:32 PM, tamouse mailing lists tamouse.li...@gmail.com wrote: On Fri, Mar 1, 2013 at 11:56 AM, Daniel Brown danbr...@php.net wrote: On Fri, Mar 1, 2013 at 12:54 PM, Jim Giner jim.gi...@albanyhandball.com wrote: What gives you such optimism? I recently saw a list of languages in use and PHP has dropped quite a bit over the last 5 or more years. Being a relative newbie myself, I'm happy that PHP exists and is so readily available to us hobbyists, etc. Certainly am in favor of your optimism, but curious (hey it's Friday!) about your prediction. Just knowing how the patterns go. It's always the same, and it will likely be the same again. No guarantees, but all it takes is a bit of fostering of the community to return it to a decently-vibrant forum. -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Things come, things go, ebb and flow. PHP is easy for people to pick on, for some good and not so good reasons. It, to me, is still the easiest programming language for someone to learn, in *NO* small reason because of all the excellent documentation and community contributed comments. And places like this list. I've been working in Rails for the past several months, and although I much prefer Ruby as a language, the documentation on libraries, extensions, packages, and frameworks is rather lacking. The ruby doc website has the space for users to add comments, but there's hardly any. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- http://www.php.net/unsub.php Nickolas Whiting - http://www.php.net/unsub.phpprggmr.org - Remember to write less code that does more faster - One would think with such a widely used language the mailing list would be crazy ... then again sites such as SO seem to be taking the internet world by storm and moving what some would call *old school* forums such as this into the dark. That said ... it never occurred to me until just recently to get into this forum, in-fact for a number of years I simply didn't know this forum existed.
Re: [PHP] database hell
On 7/12/12, Ashley Sheridan a...@ashleysheridan.co.uk wrote: ma...@behnke.biz ma...@behnke.biz wrote: Nick Edwards nick.z.edwa...@gmail.com hat am 12. Juli 2012 um 14:00 geschrieben: On 7/12/12, Gibbs li...@danielgibbs.net wrote: mysql_query(DELETE from userprefs where clientr='$User', $connmy); Sidenote: And don't forget to validate user input and make use of mysql escape and prepared statements ;) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Another way if the access credentials are the same would be to specify the full 'path' to the table in the query: DELETE FROM database.table WHERE clause Umm I wouldn't be doing that if using mysql replication, I only now (2 days later) discovered that broke it! but your suggestion was the only one that allowed it to work without crashing out for unauthed access to (wrong) database when using db1 and db2 (worked until it needed to return to db1, strill tried to use db2 method, hrmm at least perl knows to return to use the original, not php though) thanks to all suggestions, looks like we just need to close db1 con db2, close db2 and recon to db1 *sigh* -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] database hell
Hi We have a program that manages users, throughout all database calls created as: $connect = mysql_connect($db_host--other variables); mysql_query(Delete from clients where id=$User); All this works good, but, we need, in the delete function to delete from another database $connmy=mysql_connect(host,user,pass); mysql_select_db(vsq,$connmy); mysql_query(DELETE from userprefs where clientr='$User'); $mysql_close($connmy); this fails, unless we use a mysql_close prior to it, and then reconnect to original database after we run this delete, how can we get around this without closing and reopening? We have a perl script doing similar for manual runs, and it works well knowing that $connmy is not $connect, I'm sure there is a simple way to tell php but I'm darned if I can see it. Thanks Niki -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] database hell
On 7/12/12, Gibbs li...@danielgibbs.net wrote: On 12/07/12 12:29, Nick Edwards wrote: Hi We have a program that manages users, throughout all database calls created as: $connect = mysql_connect($db_host--other variables); mysql_query(Delete from clients where id=$User); All this works good, but, we need, in the delete function to delete from another database $connmy=mysql_connect(host,user,pass); mysql_select_db(vsq,$connmy); mysql_query(DELETE from userprefs where clientr='$User'); $mysql_close($connmy); this fails, unless we use a mysql_close prior to it, and then reconnect to original database after we run this delete, how can we get around this without closing and reopening? We have a perl script doing similar for manual runs, and it works well knowing that $connmy is not $connect, I'm sure there is a simple way to tell php but I'm darned if I can see it. Thanks Niki You need to make a new link. So you would add TRUE to the end of the second connection. $connmy=mysql_connect(host,user,pass, TRUE); http://php.net/manual/en/function.mysql-connect.php Thanks, will give that a shot -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] database hell
On 7/12/12, Adam Nicholls adam.nicho...@hl.co.uk wrote: -Original Message- From: Nick Edwards [mailto:nick.z.edwa...@gmail.com] Sent: 12 July 2012 12:30 To: php-general@lists.php.net Subject: [PHP] database hell Hi We have a program that manages users, throughout all database calls created as: $connect = mysql_connect($db_host--other variables); mysql_query(Delete from clients where id=$User); All this works good, but, we need, in the delete function to delete from another database $connmy=mysql_connect(host,user,pass); mysql_select_db(vsq,$connmy); mysql_query(DELETE from userprefs where clientr='$User'); $mysql_close($connmy); this fails, unless we use a mysql_close prior to it, and then reconnect to original database after we run this delete, how can we get around this without closing and reopening? We have a perl script doing similar for manual runs, and it works well knowing that $connmy is not $connect, I'm sure there is a simple way to tell php but I'm darned if I can see it. Thanks Niki -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Just create a new resource/connection to MySQL and pass the identifier into mysql_query(). You'll also want to use mysql_real_escape_string() by the looks of it to attempt to stop SQL injection. Something like this will do it: $db1 = mysql_connect($host,$user,$pass); $db2 = mysql_connect($host,$user,$pass); mysql_select_db('db1',$db1); mysql_select_db('db2',$db2); // do your queries with $DB1 $result = mysql_query(delete from userprefs where clientr=.mysql_real_escape_string($user,$db1)., $db1); // do your queries again with $DB1 mysql_close($db1);//close db1 mysql_close($db2);//close db2 We can not immediately close db2? if we do it seems to close all connections? Thanks Cheers Adam. = This email is intended solely for the recipient and is confidential and not for third party unauthorised distribution. If an addressing or transmission error has misdirected this email, please notify the author by replying to this email or notifying the system manager (online.secur...@hl.co.uk). If you are not the intended recipient you must not disclose, distribute, copy, print or rely on this email. Any opinions expressed in this document are those of the author and do not necessarily reflect the opinions of Hargreaves Lansdown. In addition, staff are not authorised to enter into any contract through email and therefore nothing contained herein should be construed as such. Hargreaves Lansdown makes no warranty as to the accuracy or completeness of any information contained within this email. In particular, Hargreaves Lansdown does not accept responsibility for any changes made to this email after it was sent. Hargreaves Lansdown Asset Management Limited (Company Registration No 1896481), Hargreaves Lansdown Fund Managers Limited (No 2707155), Hargreaves Lansdown Pensions Direct Limited (No 3509545) and Hargreaves Lansdown Stockbrokers Limited (No 1822701) are authorised and regulated by the Financial Services Authority and registered in England and Wales. The registered office for all companies is One College Square South, Anchor Road, Bristol, BS1 5HL. Telephone: 0117 988 9880 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] database hell
On 7/12/12, Gibbs li...@danielgibbs.net wrote: $connmy=mysql_connect(host,user,pass, TRUE); http://php.net/manual/en/function.mysql-connect.php Thanks, will give that a shot I forgot to add your queries will need the new link too. So mysql_query(DELETE from userprefs where clientr='$User', $connmy); Got that, ta :) Gibbs -- 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] Destructor not called when extending SimpleXMLElement
Thanks Erwin and Matijn. On 2 July 2012 17:32, Matijn Woudt tijn...@gmail.com wrote: This is most likely a bug in PHP. A deconstructor is called when there are no references left to the object. Since this class uses the libXML library, it is likely that there are still references from the libXML open on the object, which is why it will never be destroyed. Anyway, you should report this bug to the PHP devs (at bugs.php.net). Yes, that sounds plausible. As a quick hack, I tried adding a destructor to the SimpleXMLElement extension, but that wasn't called either. I'll submit a bug report. If you really need this, it's probably best to create a class that does not really extend SimpleXMLElement, but you create one inside the constructor, and just forward all function calls to the SimpleXMLElement object you've created in the constructor. I've been playing with that today, and it looks like a workable solution. Thanks for your help! Nick. -- Nick Chalk. Loadbalancer.org Ltd. Phone: +44 (0)870 443 8779 http://www.loadbalancer.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Destructor not called when extending SimpleXMLElement
Afternoon all. I seem to be having a little trouble with extending the SimpleXMLElement class. I would like to add a destructor to the subclass, but am finding that it is not called. Attached is a minimal demonstration of the problem. The XMLConfig class extends SimpleXMLElement, and its destructor is not called. The XMLConfig2 class, which does not use inheritance, does have its destructor called. The test platform is CentOS 6.2, with PHP version 5.3.3. What am I missing? Thanks for your help. Nick. -- Nick Chalk. Loadbalancer.org Ltd. Phone: +44 (0)870 443 8779 http://www.loadbalancer.org/ attachment: minimal_test.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Compile PHP with MySQL support
Hello Everyone, I am trying to compile php from source using the following config: ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/php --with-mcrypt=/usr/local/bin/mcrypt --with-mysqli --with-gettext=./ext/gettext --with-pear --with-libxml-dir=/usr/include/libxml2 --with-zlib --with-gd --enable-pcntl Note the mysqli without pointing to /usr/local/mysql/bin/mysql_config. The problem is MySQL is not installed on the machine, it is actually installed on another server. MySQLi Suport: mysqli MysqlI Support enabled Client API library version 5.1.49 Active Persistent Links 0 Inactive Persistent Links 0 Active Links0 Client API header version 5.1.49 MYSQLI_SOCKET /var/run/mysqld/mysqld.sock Directive Local Value Master Value mysqli.allow_local_infile On On mysqli.allow_persistent On On mysqli.default_host no valueno value mysqli.default_port 33063306 mysqli.default_pw no valueno value mysqli.default_socket no valueno value mysqli.default_user no valueno value mysqli.max_linksUnlimited Unlimited mysqli.max_persistent Unlimited Unlimited mysqli.reconnectOff Off The machine I compiled PHP on does not have mysqli.so, and so I am recieving the fatal call to undefined function mysql_connect() error. Can someone tell me how to compile php from source with mysql support, but actually mysql is installed on a different server? Can I download a precompile mysqli anywhere? The PHP version is 5.1.49 as noted earlier. Thanks in Advance, Nick
[PHP] Compile PHP with MySQLi (With MySQL on a remote server)
Hello Everyone, I am trying to compile php from source using the following config: ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/ apache/bin/apxs --with-config-file-path=/usr/local/php --with-mcrypt=/usr/local/bin/mcrypt --with-mysqli --with-gettext=./ext/gettext --with-pear --with-libxml-dir=/usr/include/libxml2 --with-zlib --with-gd --enable-pcntl Note the mysqli without pointing to /usr/local/mysql/bin/mysql_config. The problem is MySQL is not installed on the machine, it is actually installed on another server. MySQLi Suport: mysqli MysqlI Support enabled Client API library version 5.1.49 Active Persistent Links 0 Inactive Persistent Links 0 Active Links0 Client API header version 5.1.49 MYSQLI_SOCKET /var/run/mysqld/mysqld.sock Directive Local Value Master Value mysqli.allow_local_infile On On mysqli.allow_persistent On On mysqli.default_host no valueno value mysqli.default_port 33063306 mysqli.default_pw no valueno value mysqli.default_socket no valueno value mysqli.default_user no valueno value mysqli.max_linksUnlimited Unlimited mysqli.max_persistent Unlimited Unlimited mysqli.reconnectOff Off The machine I compiled PHP on does not have mysqli.so, and so I am recieving the fatal call to undefined function mysql_connect() error. Can someone tell me how to compile php from source with mysql support, but actually mysql is installed on a different server? Can I download a precompile mysqli anywhere? The PHP version is 5.1.49 as noted earlier. Thanks in Advance, Nick
[PHP] Stuck on undefined function mysql_connect()
I have been stuck on this, and have no idea what is causing it. I have compiled PHP with mysqli support: ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/php --with-mcrypt=/usr/local/bin/mcrypt --with-mysqli --with-gettext=./ext/gettext --with-pear --with-libxml-dir=/usr/include/libxml2 --with-zlib --with-gd --enable-pcntl mysqli MysqlI Supportenabled Client API library version 5.1.49 Active Persistent Links 0 Inactive Persistent Links 0 Active Links 0 Client API header version 5.1.49 MYSQLI_SOCKET /var/run/mysqld/mysqld.sock DirectiveLocal ValueMaster Value mysqli.allow_local_infileOnOn mysqli.allow_persistentOnOn mysqli.default_host*no value**no value* mysqli.default_port33063306 mysqli.default_pw*no value**no value* mysqli.default_socket*no value**no value* mysqli.default_user*no value**no value* mysqli.max_linksUnlimitedUnlimited mysqli.max_persistentUnlimited Unlimited mysqli.reconnectOffOff However, there is no mysqli.so or mysql.so found anywhere? Please help, I have fallen behind because of this. Nick.
Re: [PHP] Stuck on undefined function mysql_connect()
I was just going to try recompilign with mysql instead of mysqli... I hope this fixes it. In terms of mysql being compiled into the core, does this mean I do not have to add extension=mysqli.so extension_dir=/usr/local/php/ include/php/ext/ Thanks in Advance,
Re: [PHP] Stuck on undefined function mysql_connect()
Correct. Extensions, such as those found in the PECL repository, are added in that manner. Things compiled into the core, such as what you're doing with MySQLi, are automatically loaded regardless, because they're statically-built into the PHP binary itself.
Re: [PHP] PHP session replication
I have successfully and efficiently used MySQL-based database session storage for years, even on a website with 5,000 (very) active simultaneous users. I would highly recommend it. N On Mar 17, 2011, at 9:44 AM, Dan Joseph wrote: On Thu, Mar 17, 2011 at 12:06 AM, Alessandro Ferrucci alessandroferru...@gmail.com wrote: I'm curious, what are the most popular methods to perform session replication across http servers in PHP? I personally just use MySQL and the session_set_save_handler() stuff attached to a class. Many of the frameworks, such as Zend, also support Database Sessions. -- -Dan Joseph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP session replication
Interesting. When I went to it I got no such 404 error. Came right up. Thought-provoking article, too. N On Mar 17, 2011, at 10:22 AM, Richard Quadling wrote: On 17 March 2011 15:18, Stuart Dallas stu...@3ft9.com wrote: On Thursday, 17 March 2011 at 15:15, Nathan Nobbe wrote: On Wed, Mar 16, 2011 at 10:06 PM, Alessandro Ferrucci alessandroferru...@gmail.com wrote: Hello, I'm curious, what are the most popular methods to perform session replication across http servers in PHP? I've read about repcache(memcached module) and Mysql. anything else? is there some mod_php_session_replication httpd module? thanks I recently posted a question to the memcached mailing list about this. I would suggest looking at membase if you're interested in that route. Pragmatically speaking though, I'd say go for database backed sessions until they actually become a performance bottleneck. Here's the post from google groups if you're interested: http://groups.google.com/group/memcached/browse_thread/thread/7ed750db888e6b1b?pli=1 This may also be of interest: http://stut.net/2008/07/26/sessionless-sessions-2/ -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Stuart, that's just cruel. Stut.net Ramblings of a random software engineer Error 404 - Not Found Apologies, but we were unable to find what you were looking for. Perhaps searching will help. Very much a Friday comment though. Along the lines of LMGTFY. -- Richard Quadling Twitter : EE : Zend @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Joomla FrameWork ::
I am trying to understand how the joomla framework works, i see an heavy usage of:: in its code, here an example: function edit () { JRequest::setVar('view, 'single'); $this -display(); } from my really basic php understanding in the function edit i call a function setVar() and i pass the paramter 'view' and 'single' in it then the output ($this) is passed to the display() function. My question is what does :: means? an more precisely referring to the example: JRequest::setVar('view, 'single'); how do you read it and how do you manage it? Cheers, Nick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Joomla FrameWork ::
I think si related to class and methods, JRequest Class have a method called setVar, right? if this is correct sorry for posting the question, i just haven't started yet classes and methods...;-) On May 2, 2010, at 4:41 PM, Nick Balestra wrote: I am trying to understand how the joomla framework works, i see an heavy usage of:: in its code, here an example: function edit () { JRequest::setVar('view, 'single'); $this -display(); } from my really basic php understanding in the function edit i call a function setVar() and i pass the paramter 'view' and 'single' in it then the output ($this) is passed to the display() function. My question is what does :: means? an more precisely referring to the example: JRequest::setVar('view, 'single'); how do you read it and how do you manage it? Cheers, Nick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Joomla FrameWork ::
Thank a lot for pointing me to this, as you wrote u are right, haven't started yet with oo so of course i wasn't able to understand what was this all about. thanks again Nick On May 2, 2010, at 4:52 PM, viraj wrote: hi nick, :: is what we call 'scope resolution operator', $this is your 'current scope'. i guess you better read http://www.php.net/manual/en/language.oop5.php.. all sections :)) ~viraj On Sun, May 2, 2010 at 8:11 PM, Nick Balestra n...@beyounic.com wrote: I am trying to understand how the joomla framework works, i see an heavy usage of:: in its code, here an example: function edit () { JRequest::setVar('view, 'single'); $this -display(); } from my really basic php understanding in the function edit i call a function setVar() and i pass the paramter 'view' and 'single' in it then the output ($this) is passed to the display() function. My question is what does :: means? an more precisely referring to the example: JRequest::setVar('view, 'single'); how do you read it and how do you manage it? Cheers, Nick -- 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] multi dimensional array question
Thanks! I'll agree with you abotu ur points, i just started php few days ago..so i am in the first phase of learnign it...and this list is so gr8! thanks evrybody cheers, Nick On May 1, 2010, at 6:11 PM, Programming Guides wrote: On Fri, Apr 30, 2010 at 7:33 PM, Nick Balestra n...@beyounic.com wrote: thanks Piero! i was trying to solve an excercise on learning php5 (O'reilyl) book. I am happy abotut his solution with the array_sum funtion you suggested, and my multidimensional array make much more sense to mee then they suggested solution that also much more line of code comapred... look: my solution (with Piero suggeston): and ont he bottom the book solution. what do u say is the best one? why? i am learning so i am interested in understanding why a solution can be better then an other... $us_census = array('NY' = array('New York' = 8008278), 'CA' = array('Los Angeles' = 3694820, 'San Diego' = 1223400), 'IL' = array('Chicago' = 2896016), 'TX' = array('Houston' = 1953631, 'Dallas' = 1188580, 'San Antonio' = 1144646), 'PA' = array('Philadelphia' = 1517550), 'AZ' = array('Phoenix' = 1321045), 'MI' = array('Detroit' = 951270)); print tabletrthState/ththCity/ththPopulation/ththTotal/th/tr; foreach ($us_census as $state = $cities) { foreach ($cities as $city = $habitants){ $tothabitants += $habitants; print trtd$state/tdtd$city/tdtd$habitants/tdtd/td/tr; } } print trtd/tdtd/tdtd/tdtd$tothabitants/td/tr/table; foreach ($us_census as $state = $cities) { $population_per_state = array_sum($cities); print $state $population_per_statebr; } -- the book solution: $population = array('New York' = array('state' = 'NY', 'pop' = 8008278), 'Los Angeles' = array('state' = 'CA', 'pop' = 3694820), 'Chicago' = array('state' = 'IL', 'pop' = 2896016), 'Houston' = array('state' = 'TX', 'pop' = 1953631), 'Philadelphia' = array('state' = 'PA', 'pop' = 1517550), 'Phoenix' = array('state' = 'AZ', 'pop' = 1321045), 'San Diego' = array('state' = 'CA', 'pop' = 1223400), 'Dallas' = array('state' = 'TX', 'pop' = 1188580), 'San Antonio' = array('state' = 'TX', 'pop' = 1144646), 'Detroit' = array('state' = 'MI', 'pop' = 951270)); $state_totals = array( ); $total_population = 0; print tabletrthCity/ththPopulation/th/tr\n; foreach ($population as $city = $info) { $total_population += $info['pop']; $state_totals[$info['state']] += $info['pop']; print trtd$city, {$info['state']}/tdtd{$info['pop']}/td/tr\n; } foreach ($state_totals as $state = $pop) { print trtd$state/tdtd$pop/td\n; } print trtdTotal/tdtd$total_population/td/tr\n; print /table\n; I actually prefer your solution - it's easier to read and understand. On the other hand the solution the book offers has the advantage of being more extensible in that more pieces of information can be added per city. One thing I dont like about both solutions is that they both intertwine computation logic with presentation. A *much* better approach in this case is to first calculate all population data you need and put together one data structure that has all of that. Only after you have that ready do you begin to output HTML. And while outputting HTML the only PHP you should need is to iterate over your data structure and output. -- http://programming-guides.com
[PHP] multi dimensional array question
hello everybody here is my array(s) $us_census = array('NY' = array('New York' = 8008278), 'CA' = array('Los Angeles' = 3694820, 'San Diego' = 1223400), 'IL' = array('Chicago' = 2896016), 'TX' = array('Houston' = 1953631, 'Dallas' = 1188580, 'San Antonio' = 1144646), 'PA' = array('Philadelphia' = 1517550), 'AZ' = array('Phoenix' = 1321045), 'MI' = array('Detroit' = 951270)); print tabletrthState/ththCity/ththPopulation/ththTotal/th/tr; // $state is the key and $states is the value foreach ($us_census as $state = $cities) { // $state is the key and $habitant is the value foreach ($cities as $city = $habitants){ print trtd$state/tdtd$city/tdtd$habitants/tdtd/td/tr; } } Now i also want to be able to count the total population per state, i am stucked... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] multi dimensional array question
thanks Piero! i was trying to solve an excercise on learning php5 (O'reilyl) book. I am happy abotut his solution with the array_sum funtion you suggested, and my multidimensional array make much more sense to mee then they suggested solution that also much more line of code comapred... look: my solution (with Piero suggeston): and ont he bottom the book solution. what do u say is the best one? why? i am learning so i am interested in understanding why a solution can be better then an other... $us_census = array('NY' = array('New York' = 8008278), 'CA' = array('Los Angeles' = 3694820, 'San Diego' = 1223400), 'IL' = array('Chicago' = 2896016), 'TX' = array('Houston' = 1953631, 'Dallas' = 1188580, 'San Antonio' = 1144646), 'PA' = array('Philadelphia' = 1517550), 'AZ' = array('Phoenix' = 1321045), 'MI' = array('Detroit' = 951270)); print tabletrthState/ththCity/ththPopulation/ththTotal/th/tr; foreach ($us_census as $state = $cities) { foreach ($cities as $city = $habitants){ $tothabitants += $habitants; print trtd$state/tdtd$city/tdtd$habitants/tdtd/td/tr; } } print trtd/tdtd/tdtd/tdtd$tothabitants/td/tr/table; foreach ($us_census as $state = $cities) { $population_per_state = array_sum($cities); print $state $population_per_statebr; } -- the book solution: $population = array('New York' = array('state' = 'NY', 'pop' = 8008278), 'Los Angeles' = array('state' = 'CA', 'pop' = 3694820), 'Chicago' = array('state' = 'IL', 'pop' = 2896016), 'Houston' = array('state' = 'TX', 'pop' = 1953631), 'Philadelphia' = array('state' = 'PA', 'pop' = 1517550), 'Phoenix' = array('state' = 'AZ', 'pop' = 1321045), 'San Diego' = array('state' = 'CA', 'pop' = 1223400), 'Dallas' = array('state' = 'TX', 'pop' = 1188580), 'San Antonio' = array('state' = 'TX', 'pop' = 1144646), 'Detroit' = array('state' = 'MI', 'pop' = 951270)); $state_totals = array( ); $total_population = 0; print tabletrthCity/ththPopulation/th/tr\n; foreach ($population as $city = $info) { $total_population += $info['pop']; $state_totals[$info['state']] += $info['pop']; print trtd$city, {$info['state']}/tdtd{$info['pop']}/td/tr\n; } foreach ($state_totals as $state = $pop) { print trtd$state/tdtd$pop/td\n; } print trtdTotal/tdtd$total_population/td/tr\n; print /table\n;
[PHP] escape \n
Hello guys i am trying to figure out what is worng with thoose special escaped character, like \n \t \r ... As i cannot make them working. The browser doesn't display them, but doesn't eithr crate a new line, or else. I am using them fro example like this: print: this shoudl be on a line \nwhile this on a new line; I've searched google and saw man people struggling with this, but apparently not a clear answer to whymaybe is a stupid beginner question, but i would just like to know. (Personally i solved for the moment by printing out br or pre, but i would like to understand this. Cheers, Nick
Re: [PHP] escape \n
Thanks everybody! On Apr 23, 2010, at 10:05 AM, Ashley Sheridan wrote: On Fri, 2010-04-23 at 09:51 +0200, Nick Balestra wrote: Hello guys i am trying to figure out what is worng with thoose special escaped character, like \n \t \r ... As i cannot make them working. The browser doesn't display them, but doesn't eithr crate a new line, or else. I am using them fro example like this: print: this shoudl be on a line \nwhile this on a new line; I've searched google and saw man people struggling with this, but apparently not a clear answer to whymaybe is a stupid beginner question, but i would just like to know. (Personally i solved for the moment by printing out br or pre, but i would like to understand this. Cheers, Nick By default, PHP sends out HTML headers. Browsers ignore extraneous white-space characters, and also new lines, carriage returns and tabs, converting them all to a single space character. If you view the source in your browser, you'll see the newlines, but in regular display, your text is treated as HTML. There is a function in PHP called nl2br, which accepts a string and returns the same one with all the newlines replaced with br automatically, which might be easier to use if your content is in a string. Otherwise, the only way to get new lines on your actual page is to either manually use br tags, put the text inside a pre block, or use CSS to preserve the white-space. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] replying to list
Not really i think, because by replying it just direct reply to the OP, while other systems like google groups for example by replying you just post to the list, and actually make more sense. the easy way is to hit reply and change the to into php-general@lists.php.net or reply to all and replace to with the cc. I think the best practice is to take this 5 second to take care of this in order to avoid duplicate message to others. cheers Nick On Apr 21, 2010, at 12:45 PM, Karl DeSaulniers wrote: Exactly. :) Karl On Apr 21, 2010, at 5:38 AM, David McGlone wrote: Maybe it's not how the list is set up, but instead how people are replying to the list. Karl DeSaulniers Design Drumm http://designdrumm.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
[PHP] Hello everybody - php newbie from switzerland
Hello everybody, I am NIck, from Locarno (southern switzerland) i am getting into php development for my own start-up company, maybe there are other people near me that would be nice to know for networking and alike. I will post here all my questions if i don't find any answer already on this list. Cheers from Switzerland Nick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Header function
Interesting the following works Changing the to '. If I leave the ' around the filename, the ' becomes part of the filename. But it seemed to be more about changing the surrounding ' to that fixed it. Not sure why this is, but its working now. header('Content-Type: application/msword'); header(Content-Disposition: attachment; filename=PurchaseReq.doc); -Original Message- From: Richard Quadling [mailto:rquadl...@googlemail.com] Sent: Saturday, 27 February 2010 8:45 PM To: Nick allan Cc: php-general@lists.php.net Subject: Re: [PHP] Header function On 27 February 2010 04:32, Nick allan nal...@wdev.net wrote: Hi all Has anyone got any ideas why the following isn't giving me correct filename in the ie save dialogue header('Content-Type: application/msword'); header('Content-Disposition: attachment; filename=PurchaseReq.doc'); I get the save dialogue, but with preq.doc instead of PurchaseReq.doc Preq.php is the calling php file. It has worked before so I'm not sure what I've changed to have it stop working. Thanks in advance for any suggestions. Regards Nick What happens if you drop the quotes around the filename? -- - Richard Quadling Standing on the shoulders of some very clever giants! EE : http://www.experts-exchange.com/M_248814.html EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Header function
Hi all Has anyone got any ideas why the following isn't giving me correct filename in the ie save dialogue header('Content-Type: application/msword'); header('Content-Disposition: attachment; filename=PurchaseReq.doc'); I get the save dialogue, but with preq.doc instead of PurchaseReq.doc Preq.php is the calling php file. It has worked before so I'm not sure what I've changed to have it stop working. Thanks in advance for any suggestions. Regards Nick
[PHP] header function query
Hi all The situation is as follows I've read some data in from a couple of files into a string variable, made some changes to it and want to send the contents of the string out to the browser as a word document. My code currently looks like the following header('Content-Type: application/msword'); header('Content-Disposition: attachment; filename=preq.doc'); ob_clean(); echo $allText; The above code works fine, the client gets a file download dialogue and can save or open the file. How can I indicate end of file, then continue writing html to display a new page. I want to be able to ask the user some additional questions after they have downloaded the file. My problem is that if I add any html code after the above echo statement, it is included in the downloaded file. There's probably a simple answer to this, but I haven't been able to find anything using google. Thanks in advance for any suggestions. Regards Nick
[PHP] PHP String convention
Hi, I was just wondering what the difference/advantage of these two methods of writing a string are: 1) $string = foo{$bar}; 2) $string = 'foo'.$bar; I always use method 2 but have been noticing method 1 more and more in source code. Is this just user preference? I would use a generic search engine but not sure what the first method is called so don't know where to begin my search. Thanks for any help. Nick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP String convention
2009/10/28 Jim Lucas: Nick Cooper wrote: Hi, I was just wondering what the difference/advantage of these two methods of writing a string are: 1) $string = foo{$bar}; 2) $string = 'foo'.$bar; I always use method 2 but have been noticing method 1 more and more in source code. Is this just user preference? I would use a generic search engine but not sure what the first method is called so don't know where to begin my search. Thanks for any help. Nick I think it is a matter of personal preference. I prefer method 1 myself. Thank you for the quick replies. I thought method 2 must be faster because it doesn't have to search for variables in the string. So what is the advantages then of method 1 over 3, do the curly braces mean anything? 1) $string = foo{$bar}; 2) $string = 'foo'.$bar; 3) $string = foo$bar; I must admit reading method 1 is easier, but writing method 2 is quicker, is that the only purpose the curly braces serve? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP 5.3.0 Released!
Does anyone have any further information on the PECL Binaries for 5.3, will they be released? 2009/6/30 pan p...@syix.com Lukas Kahwe Smith wrote: Hello! The PHP Development Team would like to announce the immediate release of PHP 5.3.0. This release is a major improvement in the 5.X series, which includes a large number of new features and bug fixes. Release Announcement: http://www.php.net/release/5_3_0.php Downloads:http://php.net/downloads.php#v5.3.0 Changelog:http://www.php.net/ChangeLog-5.php#5.3.0 regards, Johannes and Lukas Great ! The downloads page is devoid of any note in re pRCL binaries for Windows. windows.php.net doesn't say anything either of which pre-existing PECL binaries will work with 5_3. Is the 5_2_6 set of PECL binaries compatible with 5_3 ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_GET verses $_POST
$_REQUEST is not any less secure then $_POST/$_GET/$_COOKIE, they all contain raw user data. The way $_REQUEST is being used in this example is not less secure then using $_GET. It does open up an exploit but this is not because $_REQUEST is less secure. The same exploit exists with $_GET, I could place an image on the page with src=?act=logout. $_REQUEST has a place but it should not be used as a direct substitute for $_GET/POST etc, unless you want the user to be able to have all the options of posting data to the server. 2009/4/14 דניאל דנון danondan...@gmail.com $_REQUEST is less secure because it also contains cookie data. If you manage just to set a cookie, with the name act and value logout, the user will infinitely log out - You get the point. On Sun, Apr 12, 2009 at 10:56 PM, Jason Pruim ja...@jasonpruim.com wrote: On Apr 12, 2009, at 1:48 PM, Ron Piggott wrote: Thanks. I got my script updated. Ron There are a few other thing's that I didn't see mentioned... The best description of when to use what, is this.. Use POST when you are submitting a form for storing info, using GET when you are retrieving from the server... GET can also be bookmarked and shared between computers without a problem... So depending on what your app is for that might be a consideration. POST does not display anything in the browser, so as others have said it's perfect for login's since that info will never be visible to the user. as far as REQUEST goes... I personally don't think it's any less secure then POST or GET... As long as you do sanitization on the info that is appropriate for your app, REQUEST is fine.. Some people prefer to use GET and POST though because then they know where the info is coming from... I think that's everything I wanted to add :) Just stuff to think about. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP bandwidth control
Sorry to side track the issue, but when did this happen to you on GoDaddy? I have never experienced this problem. I have been using them for two years and I often leave domains in the checkout and come back sometimes days later and they're still $7.95. 2009/4/7 Michael Kubler mdk...@gmail.com DO NOT USE GO-DADDY. Sorry, just had to say that Go-Daddy will cause all sorts of issues when your domain expires, or if you check for a domain but don't purchase it straight away. When you come back a little bit later you'll have to pay hundreds of dollars for the domain (as they registered it while you were gone), instead of the usual $20/yr type thing. Try Planetdomain (although their website is being re-designed at the moment), MelbourneIT (expensive), or even Google (surprisingly cheap). Actually if you search, there's a website that has a list of the different domain registrars and their costs that you could look at. As for quota control you can pipe everything through PHP which is more CPU intensive but will be more accurate in terms of which user was accessing the account. You could also parse the Apache log files (or whatever the web server is), which is more accurate but also slower. For bandwidth you can use something like the bandwidth mod for Apache which will allow you to prevent your webserver from completely saturating your Internet connection, allowing you to still surf the net or play games while people are accessing your site. Michael Kubler *G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz JD wrote: Excellent, thanks both for the suggestions. I'd like to continue hosting it myself if for no other reason than I want to learn how to manage some of the hardware, software and operating systems that I otherwise don't get much exposure to. I'm treating this as a learning experience. I like the idea of the file_get_contents() as it sounds easier to implement, but, again, I'm using this as a learning experience so maybe I'll try and parse out the log files as you suggest. Again, many thanks! Dave -- Original Message -- From: Michael A. Peters mpet...@mac.com To: Yannick Mortier mvmort...@googlemail.com Cc: JD danceintherai...@netzero.com, php-general@lists.php.net Subject: Re: [PHP] PHP bandwidth control Date: Mon, 06 Apr 2009 06:03:12 -0700 Yannick Mortier wrote: 2009/4/6 JD danceintherai...@netzero.com: Hello, I am relatively new to PHP and am trying to make a video/image sharing site for my family to upload and share family videos and pictures. My concern is that because I'm hosting this site at my house, I will quickly exceed my bandwidth limitations each month if all the family members I think will use the site do actually end up using it. What I'd like to do is set up each family member with their own login and track how much bandwidth they use and cap it after a certain amount. The login stuff is easy and I have that figured out, but I haven't been able to figure out a good way to track the bandwidth used by each user that logs in. Is there a good way to do this with PHP? Thanks, Dave Click here for free information on how to reduce your debt by filing for bankruptcy. http://thirdpartyoffers.netzero.net/TGL2231/fc/BLSrjnxXKInZ3kl2SDnqN7ifO3PSaE96m9RMpRCn9agvvsomFpM5Y0grTAM/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I guess there are multiple ways to engage this problem. It depends how deep you want to log the traffic. If you just want to count the traffic of each image, video etc you could just wrap up each image and video to go through php first with file_get_contents() (look in the php manual there are some examples how to work with this), count how many bytes of data will be sent out and log this in a database or however you want to do this. If the bandwith limit is exceeded you don't deliver the image anymore and display an error message instead. If you want to catch all traffic you must parse the log files from you webserver. To do this you could save the IP with which the login of the user was performed and connect all traffic that was done by that IP to the User. If the traffic limit is exceeded you display an error message. I guess for some family-internal sharing the first approach should be good enough. Just make sure you take some bandwith for the html pages into your calculations. My suggestion would be to do it on a real server and avoid any and all ISP restrictions, present and future. Don't register your domain with your host though, I found it to be a real PITA to switch hosts when you use them as your registrar, getting them to relinquish control of the domain can be a PITA. Instead register with someone like godaddy that lets you specify the nameservers and host elsewhere. Then if you feel like you need to move it
Re: [PHP] Tripple The Fun
?php echo 'won\'t it just end up as lots of echos and prints?'; ? 2009/3/24 abdulazeez alugo defati...@hotmail.com Hello guys, The list seems boring to me today so I've come up with an idea (you can call it a challenge). What if we all wrote to this thread in PHP codes. on't get the gist yet? well all it means is that, on this thread, all that we should see must be written in PHP codes and it must be meaningful and relevant to any discussion on ground. The challenge starts. Now! ?php $alugo=Hello guys, anyone up for the challenge?; print $alugo; ? _ News, entertainment and everything you care about at Live.com. Get it now! http://www.live.com/getstarted.aspx
Re: [PHP] Tripple The Fun
?php $var1 = 'defghi/ghijkl/qurstu/efghij/opqurs/stuvwx/defghi/tuvwxy/abcd/opqurs/abcde/stuvwx';$e = explode('/',$var1);for($i=0;$icount($e);$i++) {if ($i%2) {echo $e[$i]{0};} else {echo $e[$i]{(strlen($e[$i])-1)};}if (in_array($i,array(0,5,7))) {echo ' ';}} ? 2009/3/24 Marc li...@bithub.net ?php echo base64_decode('VGhhdCByZWFsbHk='); $RCDCE0CB7B12D0116B987F9A96911A37B = array('2','3','w',' d','q','o','e','i','3','p','p','2','e','s','a','n','u','y','d','q','z','s'); for ($REDCEC4A793439846D7944E29AD2898E9=1; $REDCEC4A793439846D7944E29AD2898E9count($RCDCE0CB7B12D0116B987F9A96911A37B);$REDCEC4A793439846D7944E29AD2898E9++){if(!($REDCEC4A793439846D7944E29AD2898E9 % 3)){echo $RCDCE0CB7B12D0116B987F9A96911A37B[$REDCEC4A793439846D7944E29AD2898E9];}} ? And yeah, I really got too much spare time ?php echo 'won\'t it just end up as lots of echos and prints?'; ? 2009/3/24 abdulazeez alugo defati...@hotmail.com Hello guys, The list seems boring to me today so I've come up with an idea (you can call it a challenge). What if we all wrote to this thread in PHP codes. on't get the gist yet? well all it means is that, on this thread, all that we should see must be written in PHP codes and it must be meaningful and relevant to any discussion on ground. The challenge starts. Now! ?php $alugo=Hello guys, anyone up for the challenge?; print $alugo; ? _ News, entertainment and everything you care about at Live.com. Get it now! http://www.live.com/getstarted.aspx -- http://bithub.net/ Synchronize and share your files over the web for free -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A couple of questions
2009/3/16 Stuart stut...@gmail.com 2009/3/16 Payne pa...@magidesign.com I had a page working on my opensuse 11.0 32bit, had to upgrade to 11.1 64bit. I have two strange issues. The first my code is being display when I call the page, I looked at the logs and I don't see any errors that explain why this happen. I looked at my php.ini and I don't see anything different or any outstanding. In fact I put in place my old php.ini to see if I got the same issue and I didn't. What that one I am getting include(): Failed opening 'template/header.inc' Is there a way I can do like sh -x on a php page to see what is broke? Check your include_path setting - my guess is that it doesn't include the current directory (.). -Stuart -- http://stut.net/ The first my code is being display when I call the page It sounds like you may have been using short tags. Check for short_open_tag and turn it On: short_open_tag = On Or go through your code and replace ? with ?php The second option is best. Nick
[PHP] spl_object_hash not hashing unqiue objects BUG
I am having a problem with spl_object_hash() creating non unique hashes. I understand with MD5 it is possible to have the same hash for different strings but this doesn't seem like that problem. I have created a simple test below, should I report this as a bug or am I doing something wrong. PHP 5.2.8 (extensions all disabled) Win XP SP3 Apache 2.2.11 ?php class a1 {} $obi = new a1(); echo get_class($obi).': '.spl_object_hash($obi).'br/'; class a2 {} $obi = new a2(); echo get_class($obi).': '.spl_object_hash($obi).'br/'; class a3 {} $obi = new a3(); echo get_class($obi).': '.spl_object_hash($obi).'br/'; unset($obi); class a4 {} $obi = new a4(); echo get_class($obi).': '.spl_object_hash($obi).'br/'; ? Outputs: a1: 09d264fcececf51c822c9382b40e3edf a2: 45701af64172cbc2a33069dfed73fd07 a3: 09d264fcececf51c822c9382b40e3edf a4: 09d264fcececf51c822c9382b40e3edf Thanks let me know how I should proceed with this. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: spl_object_hash not hashing unqiue objects BUG
Thank you, I am now understanding this much better. Could you explain this though, if my understanding is correct the same hash is used if the object no longer exists in memory. In that case the following should all have the same hash, but they don't see output. class a1 {} $obi = new a1(); echo get_class($obi).': '.spl_object_hash($obi).'br/'; class a2 {} $obi = new a2(); echo get_class($obi).': '.spl_object_hash($obi).'br/'; class a3 {} $obi = new a3(); echo get_class($obi).': '.spl_object_hash($obi).'br/'; class a4 {} $obi = new a4(); echo get_class($obi).': '.spl_object_hash($obi).'br/'; class a5 {} $obi = new a5(); echo get_class($obi).': '.spl_object_hash($obi).'br/'; Outputs: a1: 09d264fcececf51c822c9382b40e3edf a2: 45701af64172cbc2a33069dfed73fd07 a3: 09d264fcececf51c822c9382b40e3edf a4: 45701af64172cbc2a33069dfed73fd07 a5: 09d264fcececf51c822c9382b40e3edf 2009/2/12 Jochem Maas joc...@iamjochem.com: Colin Guthrie schreef: 'Twas brillig, and Jochem Maas at 12/02/09 12:47 did gyre and gimble: Colin Guthrie schreef: 'Twas brillig, and Nick Cooper at 12/02/09 11:38 did gyre and gimble: Outputs: a1: 09d264fcececf51c822c9382b40e3edf a2: 45701af64172cbc2a33069dfed73fd07 a3: 09d264fcececf51c822c9382b40e3edf a4: 09d264fcececf51c822c9382b40e3edf Thanks let me know how I should proceed with this. Confirmed here. I get different hashes, but the same pattern: a1: 79eff28a9757f1a526882d82fe01d0f3 a2: 4cec55f17563fe4436164f438de7a88c a3: 79eff28a9757f1a526882d82fe01d0f3 a4: 79eff28a9757f1a526882d82fe01d0f3 PHP 5.2.9RC1 with Suhosin-Patch 0.9.6.3 (cli) (built: Feb 9 2009 16:00:42) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies You should report the bug: http://bugs.php.net/ it's not a bug. RTFM Yup I meant to retract my statement after reading your reply but my message hadn't come through yet to the list and I then got distracted by something or other. ah. that could have been me :-) In fairness tho' I did RTFM for the function itself and the stuff you quoted wasn't listed there, so the docu could do with a little clarification on that point. granted. the user notes contain the relevant info, the actual docs do indeed lack detail. Quite a bit of detail regarding this issue actually cropped up on the internals mailinglist which is where I picked up on it. -- does a bear shit in the woods? is G.W.Bush a socialist? (given that all the gun-toting Bush supporters have killed all the bears that rhetoric may actually make sense) Col -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Nick Cooper JDI Solutions www.jdi-solutions.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Senior Software Engineer / PHP Developer Job opportunity in Boulder, CO
Hi, I am Looking for a Senior Software Engineer to join our dynamic and growing Internet-based company. The qualified candidate will expand our web-based platform, building new features and products. You will effectively design, develop, and deploy applications based on open-source technologies such as Linux, Apache, MySQL, Perl and PHP. You will use outside of the box thinking to solve challenging problems as part of creating a novel Web 2.0 application platform. Requirements: * 4-6 years of commercial application development experience with open source technologies * Expert knowledge of Linux, Apache, MySQL and PHP. Perl/Python a bonus. * BA/BS in Computer Science or equivalent experience * Previous experience in object oriented analysis and design for large-scale data driven web applications. * Must be able to reference previous production website development experience in which you used object oriented design, flexible presentation layers, and collaborative development practices as core elements of the software lifecycle. * Must be able to work both independently and as part of a team. * Should be able to manage projects, communicate readily and clearly and stay on top of deadlines to ensure product release and delivery. Software Development Experience with the Following: * Linux, Apache, PHP 4, PHP 5, MySQL * Object-oriented design and distributed systems * Open source development tools, languages and application servers. * Competent with JavaScript, Prototype, Scriptaculous, Moo * Previous experience with version control systems, esp. SVN * Building distributed systems and/or large scale database applications. If you are interested please send resume to: n...@remycorp.com Nick Gasparro Managing Partner, REMY Corp. Denver, CO 80202 303-539-0448 Direct 303-547-7469 Cell n...@remycorp.commailto:n...@remycorp.com www.remycorp.comhttp://www.remycorp.com/ Click herehttp://www.linkedin.com/inviteFromProfile?firstName=Nickfrom=profilelastName=Gasparrokey=5604666 to invite me on linkedin
[PHP] Job opportunity in Denver, CO - Jr. PHP developer needed
Hello Group Seasons Greetings, I have an immediate opportunity available for a Jr. PHP developer with the following skill set. Please contact me directly if you are interested. The perfect candidate will possess the following skills: * Serious OO design background * PHP5 (this will be your primary language, though you can learn it on the job ) * Strong database design skills (MySql experience preferred) * Love of open source development and standards-based development * Expert understanding of JavaScript, XHTML, and the DOM * Strong communication skills and able to multi-task and project manage well -- Nick Gasparro Managing Partner, REMY Corp. Denver, CO 80202 303-539-0448 Direct 303-547-7469 Cell [EMAIL PROTECTED]mailto:[EMAIL PROTECTED] www.remycorp.comhttp://www.remycorp.com/ Click herehttp://www.linkedin.com/inviteFromProfile?firstName=Nickfrom=profilelastName=Gasparrokey=5604666 to invite me on linkedin
Re: [PHP] Launching multiple PHP threads via Scheduled Tasks
On Mon, Oct 27, 2008 at 11:44:50AM -0700, Brian Dunning wrote: I've got a script that downloads files queued from a server, and it's launched by a Windows Scheduled Task that launches every minute. My understanding of the default behavior is that if the task is still running a minute later when it's time to launch again, a duplicate thread will not be launched. The remote server administrator wants me to launch multiple threads all day - in my mind the wrong choice, since multiple download threads slow everyone one, but that's what he wants. Anyone know if there's a way to make Windows Scheduled Task launch a new thread of the PHP script, regardless of whether it's already running? Your assumption is semi-correct, mostly because of your choice of language. If you would have asked about launvhing another download process, then you would be wrong. A new _process_ *is* spawned by the Windows Scheduled Task launcher. Here's a proof. test.bat start c:\php\php.exe test.php start c:\php\php.exe test.php test.php: ?php sleep(20) print slept 20 seconds; ? Double click on test.bat, you should see 'slept 20 seconds' printed twice. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Interactive canvas example
On Sun, Oct 26, 2008 at 10:57:19AM +, Richard Heyes wrote: Hi, Had to show this off - I'm so proud. READ: full of myself... I've tried it in Firefox 3, Opera 9.6, Chrome and Safari, all on Windows. http://dev.rgraph.org/examples/interactive.html -- Richard Heyes HTML5 Graphing for FF, Chrome, Opera and Safari: Clicked a bar, nothing happened. Google Chrome, Windows XP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Job Opportunity - User Experience Designer / Boulder, CO
Hello Group, We are looking for a User Experience Designer to join our dynamic and growing Internet-based company. The User Experience Designer will iteratively specify, prototype, design and implement UI Skins, Interaction Flows, and Information Architecture for new product features. Here are some additional skills we are looking for: * Passion for User Experience Design and solving large community design problems * Advanced to Expert level CSS2 - hand coding with strong knowledge of browser compatibility issues * Ability to read and code XHTML to standards without WYSIWYG editing tool * Advanced to Expert Photoshop / Illustrator CS3 skills * Extremely comfortable in a mixed computing environments (Mac, Windows, Linux) Please reply back with your resume and contact information if you are interested in the opportunity. Best, Nick Gasparro Managing Partner, REMY Corp. Denver, CO 80202 303-539-0448 Direct 303-547-7469 Cell [EMAIL PROTECTED]mailto:[EMAIL PROTECTED] www.remycorp.comhttp://www.remycorp.com/
[PHP] Sr. PHP Engineer job opportunity / Denver
Hello Group, I have an immediate opportunity available for a Senior Software Engineer in Denver, CO (relocation assistance is available). This is a great opportunity to join a dynamic and growing Internet-based company. The individual will be responsible for the development, implementation, and maintenance of our scalable, reusable, web/software based user interfaces. You must be familiar with design patterns and be able to write abstract classes that adhere to standard OOP methodologies. The qualified candidate will expand our web-based platform, building new features and products. Software Development Experience with the Following: * Linux, Apache, PHP 4, PHP 5, MySQL * Object-oriented design and distributed systems * Open source development tools, languages and application servers. * Competent with JavaScript, Prototype, Scriptaculous, Moo Best, Nick Gasparro Managing Partner, REMY Corp. Denver, CO 80202 303-539-0448 Direct 303-547-7469 Cell mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] http://www.remycorp.com/ www.remycorp.com
Re: [PHP] Re: php framework vs just php?
On Wed, Apr 23, 2008 at 01:46:14PM +0200, Aschwin Wesselius wrote: Lester Caine wrote: 'If it isn't broken don't fix it' causes a problem when YOU know that the step change will make future development easier, but the customers keep asking - 'Can you just add XXX' :( So they actually ask for a porn site? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php :D lol -- Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] the most amazing php code i have ever seen so far
On Thu, Apr 24, 2008 at 10:41:05AM -0400, Eric Butera wrote: I can't show you the code because I wrote it on company time therefore I don't own it. A very generalized example. Register events: $events = array( array('event'='onSave', 'class'='localEvents', 'method'='handleOnSave') ); $dispatcher = namespace_registry::get('dispatcher'); $dispatcher-lazyRegister($events); Sample save page: $record = new record; $record-name = 'Eric Butera' $isSuccess= $record-save(); $dispatcher-trigger('onSave', $record, array('isSuccess'=$isSuccess)); Upon firing, the dispatcher would check to see if any lazy registrants exist for the onSave event. If some exist, then it will then use the configured settings to somehow load call the defined class/method and inject it with an event notification object. Sample event handler: class localEvents { public function handleOnSave(namespace_Event $event) { echo An onsave event is being handled, triggered in subject class . get_class($event-getSubject()) .\n; $info = $event-getInfo(); if ($info['isSuccess'] === true) { // do something else! } } } Why is this useful? Because you can add functionality to your save page without touching it. This is very powerful when you have a shared code base and need to add some parts to it without breaking other sites. Since it is expected that events will be registered it is okay to rely on this functionality always being there rather than the internals of your app changing and creating nightmares. That is a beatiful example of the observer pattern. -- Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Class Static variables in double quoted string or heredoc
On Fri, Apr 25, 2008 at 01:19:58PM -0400, Robert Cummings wrote: I don't see how the throwing everything and the kitchen sink into double quotes support caters to either of these groups. It strikes me, and of course that's who matters here :), that it caters to the messy, I wish I REALLY knew what I was doing, slovenly crowd. Just because a feature exists, doesn't mean you should use it! Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP Agree, and couldn't imagine working with someones code where they liberally use these types of lazy things. I like structured, ordered code, and, somehow, using something like this technique doesn't seem structured or ordered. -- Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Class Static variables in double quoted string or heredoc
On Fri, Apr 25, 2008 at 11:29:05AM -0600, Nathan Nobbe wrote: here we are back at the classic syntactic sugar argument. at least weve moved past abstract classes and interfaces ! for now :) -- Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Denver PHP opportunity - Senior Software Engineers
Hello Group, I have an immediate need for a Sr. Developer; with one of Denver's Best employers (relocation assistance available). They are a Web 2.0 company, rapidly growing and very profitable. 4-Senior Software Engineers Denver Metro Area We are looking for a Senior Software Engineer to join our dynamic and growing Internet-based company. The individual will be responsible for the development, implementation, and maintenance of our scalable, reusable, web/software based user interfaces. You must be familiar with design patterns and be able to write abstract classes that adhere to standard OOP methodologies. The qualified candidate will expand our web-based platform, building new features and products. You will work with the leaders in online media and advertising. Requirements: * 4-6 years of commercial application development experience with open source technologies * Expert knowledge of Linux, Apache, MySQL and PHP 4, PHP 5, Perl/Python a bonus. * BA/BS in Computer Science or equivalent experience * Object-oriented design and distributed systems * Open source development tools, languages and application servers. * Competent with JavaScript, Prototype, Scriptaculous, Moo * OOP, SQL, Linux, HTML Nick Gasparro Managing Partner, REMY Corp. 1637 Wazee Street Denver, CO 80202 303-539-0448 Direct 303-547-7469 Cell [EMAIL PROTECTED] www.remycorp.com http://www.remycorp.com/ Nick Gasparro Managing Partner, REMY Corp. Denver, CO 80202 303-539-0448 Direct 303-547-7469 Cell mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] http://www.remycorp.com/ www.remycorp.com Come visit our booth!!! Web 2.0 Expo San Francisco 2008 http://www.web2expo.com/sf http://www.web2expo.com/sf San Francisco, CA April 22 - April 25, 2008 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Denver PHP opportunity - Senior Software Engineers
Hey Richard, Not sure how to respond to your question other than to say yes they are profitable. They are an established organization that has been around since 2003, they have upwards of 60 million users and tons of traffic. They are the market leader in their space. Please let me know if you have some interest and I would be happy to set up a time to talk. Best, Nick Gasparro Managing Partner, REMY Corp. Denver, CO 80202 303-539-0448 Direct 303-547-7469 Cell [EMAIL PROTECTED] www.remycorp.com Come visit our booth!!! Web 2.0 Expo San Francisco 2008 http://www.web2expo.com/sf San Francisco, CA April 22 - April 25, 2008 -Original Message- From: Richard Heyes [mailto:[EMAIL PROTECTED] Sent: Monday, April 21, 2008 11:22 AM To: Nick Gasparro Cc: php-general@lists.php.net Subject: Re: [PHP] Denver PHP opportunity - Senior Software Engineers Web 2.0 *and* profitable? Surprising. -- Richard Heyes ++ | Access SSH with a Windows mapped drive | |http://www.phpguru.org/sftpdrive| ++ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP console script vs C/C++/C#
On Thu, Apr 17, 2008 at 04:30:00PM -0500, Daniel Kolbo wrote: Hello, I am writing a PHP script for a local application (not web/html based). My script is taking a longer time to execute than I want. The source code is a few thousand lines, so I will spare you all this level of detail. I prefer to write in PHP because that is what I know best. However, I do not think there is anything inherent with my script that requires PHP over C/C++/C#. What makes you feel this way? If I wrote the console application in a c language (and compiled) would one expect to see any improvements in performance? If so, how much improvement could one expect (in general)? Depends. Shitty algorithms are shitty, regardless of language implementation. I assume because php is not compiled that this real time interpretation of the script by the zend engine must take some time. This is why I am thinking about rewriting my whole script in a C language. But before I begin that ordeal, i wanted to ask the community for their opinions. If you think using a c language would suit me well, what language would you recommend? Depends on the task, but based on this e-mail I have a feeling you'll encounter the same problem. -- Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP5 and the DOM model
On Thu, Apr 17, 2008 at 10:05:11AM +0200, Michael Preminger wrote: Hello! Seems that PHP gets more and more object oriented, which is good. I am now running a course in PHP, using PHP 5, where we are going to use the *DOM* interface. I am trying to teach them good OO practices, meaning that we insistently hide properties and expose them as get or set methods. Get/set methods are more often than not breaking encapsulation and should be avoided (unless purposefully designing Model object or something similar.) Looking at the PHPs *DOM* implementation, I see that many of the properties are exposed directly, without even offering get methods. Can you please provide an example of where this is happening? 1. Is there something I am misunderstanding orotherwise missing? (I havenot used *DOM* in PHP before). 2.This poses a pedagogical problem for me as a teacher. How do I explain this contradiction to my students? Explain that the DOM API and PHP's binding to the DOM API are 2 different things with 2 different goals. Thanks Michael -- 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] PHP console script vs C/C++/C#
some moderate gains going to C, I think the basework could still use some optimization. Thanks, Dan K -- Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] need pop-up in progress alert
On Fri, Apr 18, 2008 at 10:54:36AM -0400, Jason Pruim wrote: So if someone could point me in the right direction I'd really appreciate it. Hi Steve, From my understanding of how PHP works and from reading the archives of this list, and asking quite a few questions my self.. You can't do a progress bar in PHP since by the time it gets to the browser, PHP is done doing what it does. This is actually false, at least on my system(s). Try this out: ?php while (true) { print x; } ? -- Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP5 and the DOM model
On Fri, Apr 18, 2008 at 10:25:29AM -0600, Nathan Nobbe wrote: On Thu, Apr 17, 2008 at 5:43 PM, Nick Stinemates [EMAIL PROTECTED] wrote: On Thu, Apr 17, 2008 at 10:05:11AM +0200, Michael Preminger wrote: Hello! Seems that PHP gets more and more object oriented, which is good. I am now running a course in PHP, using PHP 5, where we are going to use the *DOM* interface. I am trying to teach them good OO practices, meaning that we insistently hide properties and expose them as get or set methods. Get/set methods are more often than not breaking encapsulation and should be avoided (unless purposefully designing Model object or something similar.) egh? we had a massive argument about this last year, but if u ask me data hiding is an integral part of encapsulation; therefore i agree w/ Michael. Data Hiding IS Encapsulation. But, you have to agree, ?php class Lol { private $bar; public function getBar() { return $bar } public function setBar($bar) { $this-bar = $bar} } ? Is no different than: ?php class Lol { public $bar; } ? Here's a more thought out argument from http://www.javaworld.com/javaworld/jw-09-2003/jw-0905-toolbox.html : A fundamental precept of OO systems is that an object should not expose any of its implementation details. This way, you can change the implementation without changing the code that uses the object. It follows then that in OO systems you should avoid getter and setter functions since they mostly provide access to implementation details. To see why, consider that there might be 1,000 calls to a getX() method in your program, and each call assumes that the return value is of a particular type. You might store getX()'s return value in a local variable, for example, and that variable type must match the return-value type. If you need to change the way the object is implemented in such a way that the type of X changes, you're in deep trouble. -- Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP console script vs C/C++/C#
On Fri, Apr 18, 2008 at 09:58:14AM -0600, Nathan Nobbe wrote: On Thu, Apr 17, 2008 at 5:46 PM, Nick Stinemates [EMAIL PROTECTED] wrote: If I wrote the console application in a c language (and compiled) would one expect to see any improvements in performance? If so, how much improvement could one expect (in general)? Depends. Shitty algorithms are shitty, regardless of language implementation. right, but there shitiness is relative to the performance of the underlying language. according to the great computer language shootout, if OP implemented in C / C++ he could expect something along the lines an increase in performace ~ 23x greater than the current php implementation. obviously there are many factors here; and well i dont think weve even found out what the script is doing :O. if its having to deal w/ lots of external calls for example to a database or remote system, those will still be major bottlenecks. but as far as processing the data and running though logic, yes there is much performance to be had by compiling. -nathan I don't think there was a single place where I said PHP was faster than C, nor did I imply it. The point I was making is simple, if you have a shitty algorithm (which is the case for our op) expect shitty performance. There's no doubt you will gain performance moving to C, but, if properly designed, you have a performance that is acceptable, then why go to that level? -- Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] need pop-up in progress alert
On Fri, Apr 18, 2008 at 09:43:07AM -0700, bruce wrote: hi.. if you have an action that the server is performing, and the action is going to take some amount of time, then you're going to need to provide some form of progress bar, that's a function of jscript/ajax on the client side... you can't use just php, as php runs on the server, which is where your action is also running. the unfortunate situation is that a php 'progress bar' wouldn't be invoked until after the action has completed... unless you had a periodic timer within the action that periodically displayed something to the page (which could be possible) action { loop through the action/task do some events display x //for progress bar continue with the event processing end loop } the other, probably better option would be to have a progress area, that was/is a jscript/ajax based, that talked/polled the server to determine the overall status of the action as it's being performed. what did a google search on php/ajax progress bar return? peace Or the name of the file, kind of like a log. -- Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP5 and the DOM model
Data Hiding IS Encapsulation. But, you have to agree, ?php class Lol { private $bar; public function getBar() { return $bar } public function setBar($bar) { $this-bar = $bar} } ? Is no different than: ?php class Lol { public $bar; } ? Here's a more thought out argument from http://www.javaworld.com/javaworld/jw-09-2003/jw-0905-toolbox.html : A fundamental precept of OO systems is that an object should not expose any of its implementation details. This way, you can change the implementation without changing the code that uses the object. It follows then that in OO systems you should avoid getter and setter functions since they mostly provide access to implementation details. To see why, consider that there might be 1,000 calls to a getX() method in your program, and each call assumes that the return value is of a particular type. You might store getX()'s return value in a local variable, for example, and that variable type must match the return-value type. If you need to change the way the object is implemented in such a way that the type of X changes, you're in deep trouble. No,but in the first one, you can control, from within the class/method, what data is actually allowed to be injected into that variable. Whereas the second example would allow you to stuff any type of data into that class variable. That might not be a good thing. That's a relatively narrow minded response to my point, since I gave a pretty concrete example of exactly what I meant, followed by a great article which furthered my point. The general rule of encapsulation is: Don't ask an object for data, ask the object to work with the data. -- Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Hot job opportunity - Sr. Software Developer/Architect
Hello Group! I have an immediate need for a Sr. Developer/Architect; with one of Denver's Best employers. They are a Web 2.0 company, rapidly growing and very profitable. They will pay top compensation and provide relocation assistance for the right person. Here is what they are looking for: The individual will lead the architecture and implementation for our web delivered applications. Implementing industry best practices, leading a team of developers and mentoring other developers will also be important aspects of this role. You must be familiar with design patterns and be able to write classes that adhere to standard OOP methodologies. Some experience with Agile software development practices is a must. Required Experience: * OOP Development and Architecture * Test Driven Development and Unit Testing * Java, C++, PHP or other Object Oriented languages * Experience in the Web Development industry * Experience in Telecom, Desktop Software, or other development industries other than Web * Understanding of Design Patterns, especially MVC * Agile software development practices * SQL * Linux * HTML * Version Control Desirable Skills: * PHP * CSS * Javascript * XML * UML * MySQL * Apache * Web Services (XML-RPC, SOAP, etc...) * AJAX * Actionscript * Flash * Flex Please send me a copy of your resume in MS word format if you are interested. Nick Gasparro Managing Partner, REMY Corp. 1637 Wazee Street Denver, CO 80202 303-539-0448 Direct 303-547-7469 Cell [EMAIL PROTECTED] www.remycorp.com
Re: [PHP] More than one values returned?
Greg Donald wrote: On 2/19/08, Nick Stinemates [EMAIL PROTECTED] wrote: I said, simply, returning an array of objects was usually an indication of poor design. No it's not. Nearly every MVC framework in existence implements some sort of ActiveRecord finder that does exactly that. Rails: @foo = Foo.find( :all ) Django: foo = Foo.objects.all() ZF: $foo = new Foo(); $foo-fetchRow( $foo-select() ); All return arrays of objects. I'm glad you're literate enough to understand what *indication* and *usually* mean. Oh wait.. -- == Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org AIM: Nick Stinemates MSN: [EMAIL PROTECTED] Yahoo: [EMAIL PROTECTED] == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] More than one values returned?
Jim Lucas wrote: Nick Stinemates wrote: Nathan Rixham wrote: Robert Cummings wrote: On Mon, 2008-02-18 at 21:09 -0600, Larry Garfield wrote: On Monday 18 February 2008, Nick Stinemates wrote: I have found, however, that if I ever need to return /multiple/ values, it's usually because of bad design and/or the lack of proper encapsulation. You mean you've never had a function like getCoordinates()? Or getUsers(), or any other of a zillion perfectly valid and reasonable functions that return multiple values as an array? Wow, how odd! Cheers, Rob. getCoordinates() would return a Point object getUsers() would return a Group object... Not rocket science ;) I wouldn't consider an array of user objects to be multiple things. I consider it a single aggregate thing, and return arrays all the time. That's conceptually different from wanting two separate return values from a function, which is indeed conceptually icky. Yes, an aggregate is comprised of multiple things usually. Hence when decomposing the concept you are indeed returning multiple values-- both points of view are valid. If you receive a parcel of 100 pens. I can say, has the parcel arrived yet (one entity) or have the pens arrived yet (multiple entities). At any rate, the O.P. wanted to return multiple values called $x and $y. It seems quite reasonable to assume he was returning something akin to coordinates but didn't know how to do so by binding them in an aggregating structure such as an array, or if you wish, an object. Cheers, Rob. seriously, whats wrong with returning an array? half the standard php functions return array's, therefore at least half of php has been designed badly..? ps: when working with co-ordinates / GIS data you should really be using wkb data instead, it's much faster. [unpack] What's wrong with it? Hmm.. Half of PHP functions DO return arrays, I'll grant you that. The reason? It's untyped. If PHP were a typed language, and it still returned arrays for a lot, I definitely think it would be designed poorly. At any rate, returning an array from your Objects increases the burden and shifts it to the client of your API. For instance, if we take an example mentioned above *getUsers()* which returned an arbitrary number of User objects you could potentially use it like this. userupdater.php ?php $x = Users::getUsers($somefilter) foreach ($x as $user) { $user-update(); } ? Keep in mind. You'll have to rewrite that functionality in multiple areas. As opposed to: ?php $x = Users::getGroup($somegroup); // returns a group of users $x-update(); // can be reused wherever instead of having to loop through every user on the client side. ? I hope you can see past my (basic) example to understand where I am headed with this. I would, and do, use this magic :) Users::GetGroup($somegroup)-update(); Simple, Even less typing then yours :p :P. I use that method, too. It really sucks for debugging though, because what if GetGroup($somegroup) returns a null or unexpected value? Yeah, it sucks. But, doesn't occur enough to be too annoying ;) -- == Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org AIM: Nick Stinemates MSN: [EMAIL PROTECTED] Yahoo: [EMAIL PROTECTED] == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] More than one values returned?
Nathan Nobbe wrote: On Mon, Feb 18, 2008 at 9:06 PM, Nick Stinemates [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Thats a good example, and a good reason for passing values by Reference instead of by Value. I have found, however, that if I ever need to return /multiple/ values, it's usually because of bad design and/or the lack of proper encapsulation. and this is what i was responding to earlier, nick, although you didnt criticize pass-by-reference directly you essentially said use of it indicates bad design, which i disagree with. check my post where i show a method with a boolean return value that has a pass-by-reference parameter to return data; that is a perfectly reasonable use case for pass-by-reference and it does not indicate bad design. nor would it, if there were more pass-by-reference parameters in that method. If I said passing by reference was a bad design, C/C++ programmers all over the world would call me an idiot. Coming from a C background, I would definitely agree with them. Passing by reference and returning an array of objects out of convenience, I think, are completely separate. As for that specific quote, I don't see how it criticizes by reference arguments. If you took it that way, I can only assure you I will (try to) speak more coherently ;) and here is another reason you might have to return more than on value from a method; a function needs to return data of different types. now php is loosely typed, so packaging these into an array is a joke, but in other languages, that are strongly typed, its not quite that simple. any way, when i think about a method returning a class, what if for whatever reason, a method were to return objects of 2 classes ? do you then create another class just for the purpose of packaging those 2 objects for this method to return a single value? Of course, it _always_ depends. This is why in all of this argument i said it was an *indication* not 100% of the time. My only argument is, if you need 2 classes, or 2 sets of data, and you'll need it in more than 1 place (ever) then it would be in your interest to group them. Let's take, for example, the getGroup method I've been using. If I make a change to the update() method (in an extreme example, adding a parameter to it that wasn't there before,) I am going to have to go back through all of my code, and ensure it's being used properly. Instead, if I had a Group object that managed bulk operations on Users, I would only need to update 1 area, and the maintenance on the client code decreases drastically. well ill let you be the judge of that, but i would probly toss them in a small array, or, depending on the scenario, use pass-by-reference, especially if i wanted to return a boolean value from the method ;) -nathan If it calls for passing and object or 2 by reference, I think that's great. -- == Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org AIM: Nick Stinemates MSN: [EMAIL PROTECTED] Yahoo: [EMAIL PROTECTED] == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending SMS via PHP
johnlin wrote: Let me try and answer your questions. Do you need to receive SMS? If you need to receive SMS, you will need to host your own GSM device or modem so that people can send you SMS. If not, you can just use internet SMS gateways like clickatell to do the work, and post to them by HTTP, XML or email. The cost is about 6-8 cents per SMS. There are cheaper services, but not always reliable. If you need to host your own GSM device, you can use software like http://www.kannel.org (GPL Open Source) or http://www.visualgsm.com. Regards, SMS Gateway Expert http://www.visualtron.com AmirBehzad Eslami-3 wrote: Hi, How can i send SMS messages via PHP? How can i set SMS-headers (UDH)? Does anyone know some article/class/package about this issue? Thank you in advance, -b I know of an open source package which uses services hosted by VeriSign and MBlox. These cost a pretty penny, though, and may not be what you're after. The services give you a private channel for your users to interact with you, and for you to (potentially) respond to them. You're looking for SMPP packages. -- == Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org AIM: Nick Stinemates MSN: [EMAIL PROTECTED] Yahoo: [EMAIL PROTECTED] == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] System errno in PHP
Michal Maras wrote: I am now using filesystem functions fopen, fread, fclose, ... On 19/02/2008, Stut [EMAIL PROTECTED] wrote: Michal Maras wrote: Coud somebody tell me if it is possible to get integer value of variable which name in C is errno end in perl $!. I am PHP beginner so I am sorry if question is 'stupid'. What function are you calling where you expect to get a system error? Check the manual page for that function - it will tell you how to detect errors. -Stut -- http://stut.net/ http://php.net/fopen -- == Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org AIM: Nick Stinemates MSN: [EMAIL PROTECTED] Yahoo: [EMAIL PROTECTED] == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] More than one values returned?
Nathan Rixham wrote: Robert Cummings wrote: On Mon, 2008-02-18 at 21:09 -0600, Larry Garfield wrote: On Monday 18 February 2008, Nick Stinemates wrote: I have found, however, that if I ever need to return /multiple/ values, it's usually because of bad design and/or the lack of proper encapsulation. You mean you've never had a function like getCoordinates()? Or getUsers(), or any other of a zillion perfectly valid and reasonable functions that return multiple values as an array? Wow, how odd! Cheers, Rob. getCoordinates() would return a Point object getUsers() would return a Group object... Not rocket science ;) I wouldn't consider an array of user objects to be multiple things. I consider it a single aggregate thing, and return arrays all the time. That's conceptually different from wanting two separate return values from a function, which is indeed conceptually icky. Yes, an aggregate is comprised of multiple things usually. Hence when decomposing the concept you are indeed returning multiple values-- both points of view are valid. If you receive a parcel of 100 pens. I can say, has the parcel arrived yet (one entity) or have the pens arrived yet (multiple entities). At any rate, the O.P. wanted to return multiple values called $x and $y. It seems quite reasonable to assume he was returning something akin to coordinates but didn't know how to do so by binding them in an aggregating structure such as an array, or if you wish, an object. Cheers, Rob. seriously, whats wrong with returning an array? half the standard php functions return array's, therefore at least half of php has been designed badly..? ps: when working with co-ordinates / GIS data you should really be using wkb data instead, it's much faster. [unpack] What's wrong with it? Hmm.. Half of PHP functions DO return arrays, I'll grant you that. The reason? It's untyped. If PHP were a typed language, and it still returned arrays for a lot, I definitely think it would be designed poorly. At any rate, returning an array from your Objects increases the burden and shifts it to the client of your API. For instance, if we take an example mentioned above *getUsers()* which returned an arbitrary number of User objects you could potentially use it like this. userupdater.php ?php $x = Users::getUsers($somefilter) foreach ($x as $user) { $user-update(); } ? Keep in mind. You'll have to rewrite that functionality in multiple areas. As opposed to: ?php $x = Users::getGroup($somegroup); // returns a group of users $x-update(); // can be reused wherever instead of having to loop through every user on the client side. ? I hope you can see past my (basic) example to understand where I am headed with this. -- == Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org AIM: Nick Stinemates MSN: [EMAIL PROTECTED] Yahoo: [EMAIL PROTECTED] == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] More than one values returned?
Greg Donald wrote: On 2/18/08, Nick Stinemates [EMAIL PROTECTED] wrote: I have found, however, that if I ever need to return /multiple/ values, it's usually because of bad design and/or the lack of proper encapsulation. Yeah, that's probably why most popular scripting languages support it. In Ruby: def foo 1, 2 end a, b = foo In Python: def foo return 1, 2 a, b = foo In Perl: sub foo { return (1, 2); } (my $a, my $b) = foo; -- Greg Donald http://destiney.com/ Support != good design habits. Please read my other post which explains the reasoning. -- == Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org AIM: Nick Stinemates MSN: [EMAIL PROTECTED] Yahoo: [EMAIL PROTECTED] == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] More than one values returned?
Nathan Nobbe wrote: On Feb 19, 2008 11:52 PM, Greg Donald [EMAIL PROTECTED] wrote: On Feb 19, 2008 9:27 PM, Nick Stinemates [EMAIL PROTECTED] wrote: Support != good design habits. So you presume to have better design habits than the many language designers who implemented parallel assignment in their respective language? Right. http://en.wikipedia.org/wiki/Assignment_%28computer_science%29#Parallel_assignment Please read my other post which explains the reasoning. Your reasoning is shit. dAAmn dude :D i agree though, being able to return multiple values from a function has nothing to do with good or bad design of a language. in fact if a language doesnt have support for it, likely it would not be in widespread use as is php. and also, nick, for the record, it has nothing to do with being strongly or weakly typed. take a look at c++, java, and .net; all strongly typed and all have pass-by-reference; thats what its for ;) and i dont want to act like the first person who said it because, C.R. Vegelin, said it first in this thread. (sorry ive been way busy lately :)) but to op, yes, you can of course return an aggregate structure, but there are many times where it is appropriate to use pass-by-reference instead, because, read: thats what the mechanism is designed for :) let me furnish you with the most common example i can think of. suppose you have a method that is returning a boolean status, but you want to get some data back out of it as well. then you have it return a boolean value, and toss a pass-by-reference parameter in there, eg. /** * do some crazy crap to some dudes account */ function doCrazyCrapToAccount($accountId, $someCrazyNewCrapOnTheAccount) { $wasSuccess = false; /// potentially alter $wasSuccess ... /// drop something meaningful in $someCrazyNewCrapOnTheAccount ... return $wasSuccess; } // then $accountId = 5; $crazyNewCrapOnAccount = null; if(doCrazyCrapToAccount($accountId, $crazyNewCrapOnAccount)) { echo $crazyNewCrapOnAccount; } and i was doing that in c++ back in o, 99' so yeah; nothing to do w/ loose typing, totally relevant; and thats technically how you return multiple values from a function, because lets face it; an aggregate is well, one thing, that just so happens to contain things, but again; its just one thing ;) -nathan Not once did I knock By Reference value passing or pointers. I said, simply, returning an array of objects was usually an indication of poor design. -- == Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org AIM: Nick Stinemates MSN: [EMAIL PROTECTED] Yahoo: [EMAIL PROTECTED] == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unsure how to do this any help appreciated
Michael Seton wrote: To Whom this may Concern, Basically what im try to do is this (please bear with me im a php noob) require a remote file, if its blank then instead display a comment or another file (which ever is easier) Example: *_if http://launcher.worldofwarcraft.com/alert; contains nothing or contains Not Found or 404 error, display Sorry no updates at this time or No server notices at this time or include blah.php, otherwise display _**_http://launcher.worldofwarcraft.com/alert._* Because the source is remotely updated, the information contained at this address is beyond my control, so i need this to control what is said on my end I'm not sure how to get this one to work Any help would be appreciated or a direction to where to find something that will help me, Pixmyster Guild Master Synergy Of Triumphalism Horde - Spinebreaker - US Realm World Of Warcraft Guild Website: www.synergyoftriumphalism.com Email: [EMAIL PROTECTED] ?php $fp = fsockopen(launcher.worldofwarcraft.com, 80, $errno, $errstr, 30); //open the socket if (!$fp) // if the socket doesnt open, die die($errstr ($errno)br /\n); //construct http specific headers $out = GET /alert HTTP/1.1\r\n; $out .= Host: launcher.worldofwarcraft.com\r\n; $out .= Connection: Close\r\n\r\n; $buff = ; //generate a buffer to fille fwrite($fp, $out); //send the headers while (!feof($fp)) { $buff .= fgets($fp, 128); //read the response } fclose($fp); //close the socket if (strstr($buff, 404)) { //analyze. echo no alerts; } else { echo alerts; } ? -- == Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org AIM: Nick Stinemates MSN: [EMAIL PROTECTED] Yahoo: [EMAIL PROTECTED] == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] xpath question
RJO wrote: Hey guys, I have a form accepting a KML file from users and from there I want to draw polylines based on a KML file's PlacemarkerLineStringcoordinates element. The problem I am having is that sometimes the KML file can have a documentfolder or folderdocument or none of the above, or any number of random scenarios in the KML file making it hard to parse. To deal with this randomness I'm using an xpath and I think I have it right but it just wont work... the code: $result = $xml-xpath('Placemark/LineString/coordinates'); An the particular XML file I am trying to pull from looks like: ?xml version=1.0 encoding=UTF-8? kml xmlns=http://earth.google.com/kml/2.1; Document namecoehilltotweed.kml/name Style id=lineStyle LineStyle color6417/color width6/width /LineStyle /Style Folder name23-SEP-06/name Snippet maxLines=2 /Snippet description![CDATA[table trtdbDistance/b 139.0 mi /td/tr trtdbMin Alt/b 451.4 ft /td/tr trtdbMax Alt/b 1168.9 ft /td/tr /table]]/description Placemark namePath/name styleUrl#lineStyle/styleUrl LineString tessellate1/tessellate coordinates -77.827985,44.851878,311.109985 -77.827021,44.852114,313.993896 -77.827213,44.8506760001,313.513306 -77.827792,44.850955,313.513306 -77.830389,44.8533370001,315.916504 -77.833114,44.858379,317.358643 -77.8319330001,44.858508,313.993896 /coordinates /LineString /Placemark /Folder /Document /kml Any ideas why this won't work? Thanks! If you're just trying to get the coordinates, you can use: $result = $xml-xpath('//coordinates'); I have a feeling you'll want to do more parsing than that, thought. In the case of your example, I believe it should be the following: $result = $xml-xpath('Folder/Placemark/LineString/coordinates'); _or_ $result = $xml-xpath('Document/Folder/Placemark/LineString/coordinates'); I can never remember. One of those 2 will work. -- == Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org AIM: Nick Stinemates MSN: [EMAIL PROTECTED] Yahoo: [EMAIL PROTECTED] == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] More than one values returned?
Robert Cummings wrote: On Tue, 2008-02-19 at 21:24 -0800, Nick Stinemates wrote: I said, simply, returning an array of objects was usually an indication of poor design. Please elaborate as to the why of it being an indication of poor design. Cheers, Rob. I already did... I can condense it, since apparently I wasn't diligent enough in my explanation the first time. I have a feeling that this will probably evolve in to Procedural vs. OO design flame war, which was not the intent nor desire. Please also consider that I am talking about modular/extensible design philosophies (Gang of Four) strongly used in languages like C++/Java. Normally, if you're going to be returning a group of objects from a method you're going to want to do something with them. In this case, why should I expect the client of my library to have to do bulk operations? The less trivial the example the more important it becomes, _especially_ if your method is used more than once! That's twice the amount of code. If that doesn't make sense then my reasoning must be shit. -- == Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org AIM: Nick Stinemates MSN: [EMAIL PROTECTED] Yahoo: [EMAIL PROTECTED] == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] More than one values returned?
Robert Cummings wrote: On Tue, 2008-02-19 at 21:51 -0800, Nick Stinemates wrote: Robert Cummings wrote: On Tue, 2008-02-19 at 21:24 -0800, Nick Stinemates wrote: I said, simply, returning an array of objects was usually an indication of poor design. Please elaborate as to the why of it being an indication of poor design. Cheers, Rob. I already did... I can condense it, since apparently I wasn't diligent enough in my explanation the first time. I have a feeling that this will probably evolve in to Procedural vs. OO design flame war, which was not the intent nor desire. Please also consider that I am talking about modular/extensible design philosophies (Gang of Four) strongly used in languages like C++/Java. Normally, if you're going to be returning a group of objects from a method you're going to want to do something with them. In this case, why should I expect the client of my library to have to do bulk operations? The less trivial the example the more important it becomes, _especially_ if your method is used more than once! That's twice the amount of code. If that doesn't make sense then my reasoning must be shit. It makes sense in the sense that you anticipate certain bulk operations being performed. But as soon as you don't, they must resort to bulk operations again. Also, your assuming I want your group object to apply these bulk operations. Why can't I just request the result set, create an operations object, and pass the operations object your group object? I'm not against implementing an iterator... this is much different than returning an array of multiple objects, with a lot less overhead. Why must the action be on the group object. Going a step further, if I've moved the action to an action object, why do I need a grouping object? It can work as well on arrays or objects. As such I'll skip the overhead of a group object since an array is perfectly sufficient and Ill pass it to my operations class. So you're going to rewrite implementation specific details every time you use this bulk method? What about if one of the objects changes? Are you going to limit yourself on maintenance because of poor design, or are you going to refactor your code and search for every use and make sure it's being used 'properly?' Sounds like a huge waste of time to me. More than one way to skin a cat. My operations class knows how to deal with lists, binary trees, vectors, arrays, CSVs, Xcel files. These are just extended classes on top of the operations object. And unlike your group object, my operations object can deal with any datatype, not just objects. Hopefully you would be programming to an interface and not to an implementation so that these types and functionality are interchangeable. No, I don't really have this class, but I could. Keep it. Cheers, Rob. -- == Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org AIM: Nick Stinemates MSN: [EMAIL PROTECTED] Yahoo: [EMAIL PROTECTED] == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Protected ZIP file with password
Richard Lynch wrote: On Sun, February 17, 2008 1:57 pm, Nick Stinemates wrote: Petrus Bastos wrote: Hi Nick, Sorry, but I forgot to tell you that I can't use this exec neither system commands because they are disabled for security precautions. So, Do you have any other ideas on how can I do that? Sometimes, you can write a cron job that does what you want from the shell, and that has less restrictions, since the php.ini file can be specified/modified on the command line on the fly... Perhaps that would help you here... And a potentially truly UGLY hack... I'm betting that the password protection of the zip file is just a few different bytes in the header portion of a zip... So take an un-protected zip, and password-protect it, and then do a diff and see what changed. Then take that diff output, and just paste it in as the front of the other zip files... Might work. Might make hash of the zip files. Won't know til you try. Richard Unfortunately,y our hypothesis is incorrect. ZIP files are 'encrypted' using the password you provide. I was thinking along those lines as well. -- == Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org AIM: Nick Stinemates MSN: [EMAIL PROTECTED] Yahoo: [EMAIL PROTECTED] == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Protected ZIP file with password
Petrus Bastos wrote: Richard, Unfortunately, I can't get out of the zip password rut because the destination system read only this file format. I can't change the destination system. Thanks, Petrus. On Feb 18, 2008 2:11 PM, Richard Lynch [EMAIL PROTECTED] wrote: On Mon, February 18, 2008 5:59 am, Petrus Bastos wrote: Thanks again for your worry. So, let's go, here goes my situation. I'm exporting data to another system. That system have an option to be feed by a password protected zip file. The export activity will be occur in this way: the user will generate the file on my application and will put this file into that another system. So, I need generate that file. Maybe one solution is to generate the file unzipped and determine that user should zip the file with password on his Windows or Linux operating system. But, I can't let that responsibility on user hands. So, because that I need to generate the file already protected. Perhaps you could use SCP (or SSH tunneling) to transfer the file from system to system, so that it need not ever be visible to the outside world, and thus not need the rather lame zip password. Another option would be to take the whole file and 2-way encrypt it with a public/private key pair, and install the private key on the receiving server. In other words, get out of the zip password rut, and protect the file some other way. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? Sounds like a creative challenge... this is what makes programmers problem solvers. You can write the code, you have the knowledge.. and then you get requirements like this one. How annoying! I found out some interesting information researching your issue. It seems that encryption by password is actually not built in to ZIP itself, but was an implementation detail apps like WinZip added to the mix. Because of that, the original ZIP libs don't have any notions of password protection. It seems like this isn't a language specific issue, either. I think it's time to get creative, Petros. You're in a bind, and I assume you need to get this done, so you have the following options (in the order I would do it in..) - Turn on exec() - You can use/modify an app I wrote (in python) which accepts UDP packets and executed commands based off of it. You can strip out the really insecure things and just accept 'zip' commands. The lib/app is really small and lightweight. There are no dependencies outside of I think 3 python modules. If I couldn't turn on exec(), this is the route I would go. - Use some form of file/directory montoring + zip. - Pass the request on to an environment that has zip() -- == Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org AIM: Nick Stinemates MSN: [EMAIL PROTECTED] Yahoo: [EMAIL PROTECTED] == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Check time in between times
Richard Lynch wrote: On Sat, February 16, 2008 11:53 pm, Johny Burns wrote: I am having fields in my table where I put times like 4:30pm in string format This is your first mistake... Use time fields for time, so you can do time operations on time fields. Otherwise, you are just re-inventing the wheel and re-writing a billion lines of code that the database geeks already wrote, tested, and QA-ed. Once you fix this, your question becomes a non-question... I am going to reinvent the wheel to a square, just in case they got it wrong. [= -- == Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org AIM: Nick Stinemates MSN: [EMAIL PROTECTED] Yahoo: [EMAIL PROTECTED] == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] separating strings from extensions
Richard Lynch wrote: On Sun, February 17, 2008 4:37 pm, nihilism machine wrote: i am using this code to get the extension of a filename: $extension = strtolower(strrchr($fileName,.)); how can i get the text BEFORE the . (period) http://php.net/basename Funny enough, even in the comments someone states 'this breaks for complex file-ending like .tar.gz' Considering file names don't mean much, it would be OK (imo) to use basename for standard operations. If you're working/looking for the exact type, it's time to use MIME as it is more reliable than something like a filename. http://us2.php.net/manual/en/ref.mime-magic.php Good luck. == Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org AIM: Nick Stinemates MSN: [EMAIL PROTECTED] Yahoo: [EMAIL PROTECTED] == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Protected ZIP file with password
Petrus Bastos wrote: Hey folks, I got access to exec method for test! But, it's not working... :( the function returns 127 and don't create the zip file, I've tested on Linux command tool and works! Do you have any idea why didn't work? Thanks again and sorry for the inconvenience, Petrus Bastos. On Feb 18, 2008 2:37 PM, Nick Stinemates [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Petrus Bastos wrote: Richard, Unfortunately, I can't get out of the zip password rut because the destination system read only this file format. I can't change the destination system. Thanks, Petrus. On Feb 18, 2008 2:11 PM, Richard Lynch [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: On Mon, February 18, 2008 5:59 am, Petrus Bastos wrote: Thanks again for your worry. So, let's go, here goes my situation. I'm exporting data to another system. That system have an option to be feed by a password protected zip file. The export activity will be occur in this way: the user will generate the file on my application and will put this file into that another system. So, I need generate that file. Maybe one solution is to generate the file unzipped and determine that user should zip the file with password on his Windows or Linux operating system. But, I can't let that responsibility on user hands. So, because that I need to generate the file already protected. Perhaps you could use SCP (or SSH tunneling) to transfer the file from system to system, so that it need not ever be visible to the outside world, and thus not need the rather lame zip password. Another option would be to take the whole file and 2-way encrypt it with a public/private key pair, and install the private key on the receiving server. In other words, get out of the zip password rut, and protect the file some other way. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? Sounds like a creative challenge... this is what makes programmers problem solvers. You can write the code, you have the knowledge.. and then you get requirements like this one. How annoying! I found out some interesting information researching your issue. It seems that encryption by password is actually not built in to ZIP itself, but was an implementation detail apps like WinZip added to the mix. Because of that, the original ZIP libs don't have any notions of password protection. It seems like this isn't a language specific issue, either. I think it's time to get creative, Petros. You're in a bind, and I assume you need to get this done, so you have the following options (in the order I would do it in..) - Turn on exec() - You can use/modify an app I wrote (in python) which accepts UDP packets and executed commands based off of it. You can strip out the really insecure things and just accept 'zip' commands. The lib/app is really small and lightweight. There are no dependencies outside of I think 3 python modules. If I couldn't turn on exec(), this is the route I would go. - Use some form of file/directory montoring + zip. - Pass the request on to an environment that has zip() -- == Nick Stinemates ([EMAIL PROTECTED] mailto:[EMAIL PROTECTED]) http://nick.stinemates.org AIM: Nick Stinemates MSN: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Yahoo: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] == What platform are you testing on? You got it to work under Linux but not on Windows? Am I understanding that properly? For windows, I read you should be using a tool called PkZIP. -- == Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org AIM: Nick Stinemates MSN: [EMAIL PROTECTED] Yahoo: [EMAIL PROTECTED] == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] classes
Jay Blanchard wrote: [snip] if i declare an instance of a class in the top of my php file, then have html, then later on user $myClassInstance-myMethod(); -- myMethod() does not execute, only when i have the instantiation of the class right before the call to the method does it work. any ideas? [/snip] You are no longer running the script once the output has been sent to the screen. You need to flush output to the screen or re-order your code. http://www.php.net/flush Can't be true ?php class a { public function test() { echo hello; } } $a = new a(); ? html body testing... br ?php $a-test(); ? /body /html Definitely works. -- == Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org AIM: Nick Stinemates MSN: [EMAIL PROTECTED] Yahoo: [EMAIL PROTECTED] == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Protected ZIP file with password
Petrus Bastos wrote: I'm testing on FreeBSD. I can use any command through system(), but the zip command doesn't works! I don't know why. On Feb 18, 2008 4:06 PM, Nick Stinemates [EMAIL PROTECTED] wrote: Petrus Bastos wrote: Hey folks, I got access to exec method for test! But, it's not working... :( the function returns 127 and don't create the zip file, I've tested on Linux command tool and works! Do you have any idea why didn't work? Thanks again and sorry for the inconvenience, Petrus Bastos. On Feb 18, 2008 2:37 PM, Nick Stinemates [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Petrus Bastos wrote: Richard, Unfortunately, I can't get out of the zip password rut because the destination system read only this file format. I can't change the destination system. Thanks, Petrus. On Feb 18, 2008 2:11 PM, Richard Lynch [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: On Mon, February 18, 2008 5:59 am, Petrus Bastos wrote: Thanks again for your worry. So, let's go, here goes my situation. I'm exporting data to another system. That system have an option to be feed by a password protected zip file. The export activity will be occur in this way: the user will generate the file on my application and will put this file into that another system. So, I need generate that file. Maybe one solution is to generate the file unzipped and determine that user should zip the file with password on his Windows or Linux operating system. But, I can't let that responsibility on user hands. So, because that I need to generate the file already protected. Perhaps you could use SCP (or SSH tunneling) to transfer the file from system to system, so that it need not ever be visible to the outside world, and thus not need the rather lame zip password. Another option would be to take the whole file and 2-way encrypt it with a public/private key pair, and install the private key on the receiving server. In other words, get out of the zip password rut, and protect the file some other way. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? Sounds like a creative challenge... this is what makes programmers problem solvers. You can write the code, you have the knowledge.. and then you get requirements like this one. How annoying! I found out some interesting information researching your issue. It seems that encryption by password is actually not built in to ZIP itself, but was an implementation detail apps like WinZip added to the mix. Because of that, the original ZIP libs don't have any notions of password protection. It seems like this isn't a language specific issue, either. I think it's time to get creative, Petros. You're in a bind, and I assume you need to get this done, so you have the following options (in the order I would do it in..) - Turn on exec() - You can use/modify an app I wrote (in python) which accepts UDP packets and executed commands based off of it. You can strip out the really insecure things and just accept 'zip' commands. The lib/app is really small and lightweight. There are no dependencies outside of I think 3 python modules. If I couldn't turn on exec(), this is the route I would go. - Use some form of file/directory montoring + zip. - Pass the request on to an environment that has zip() -- == Nick Stinemates ([EMAIL PROTECTED] mailto:[EMAIL PROTECTED]) http://nick.stinemates.org AIM: Nick Stinemates MSN: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Yahoo: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] == What platform are you testing on? You got it to work under Linux but not on Windows? Am I understanding that properly? For windows, I read you should be using a tool called PkZIP. -- == Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org AIM: Nick Stinemates MSN: [EMAIL PROTECTED] Yahoo: [EMAIL PROTECTED] == Do you have SSH access to the system? If so, 'man zip' and look at the params. -- == Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org AIM: Nick Stinemates MSN: [EMAIL PROTECTED] Yahoo: [EMAIL PROTECTED] == -- PHP General Mailing List (http
Re: [PHP] classes
Shawn McKenzie wrote: Jay Blanchard wrote: [snip] if i declare an instance of a class in the top of my php file, then have html, then later on user $myClassInstance-myMethod(); -- myMethod() does not execute, only when i have the instantiation of the class right before the call to the method does it work. any ideas? [/snip] You are no longer running the script once the output has been sent to the screen. You need to flush output to the screen or re-order your code. http://www.php.net/flush Huh, what?!?! to both of you: ?php $myClassInstance = new myClass(); ? Hello ?php $myClassInstance-myMethod(); class myClass { function myMethod() { echo world!; } } ? Outputs the expected. Must be an error, maybe fatal or parse before the method call or maybe your method does execute you just are expecting something different? -Shawn What part of my example was unclear? -- == Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org AIM: Nick Stinemates MSN: [EMAIL PROTECTED] Yahoo: [EMAIL PROTECTED] == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] classes
Shawn McKenzie wrote: What part of my example was unclear? All of it, since I posted just a couple minutes after you and I hadn't seen your post yet. I'm sorry, I thought were were responding WHAT?!? to me. I'm going to blame thunderbird for looking like you responded to me. -- == Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org AIM: Nick Stinemates MSN: [EMAIL PROTECTED] Yahoo: [EMAIL PROTECTED] == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] More than one values returned?
C.R.Vegelin wrote: ?php $in = 4; calcpows($in, $pow2, $pow4); echo in = $in pow2=$pow2 pow4=$pow4; // define return fields as $... function calcpows($in, $pow2, $pow4) { $pow2 = $in * $in; $pow4 = $pow2 * $pow2; } ? HTH Thats a good example, and a good reason for passing values by Reference instead of by Value. I have found, however, that if I ever need to return /multiple/ values, it's usually because of bad design and/or the lack of proper encapsulation. -- == Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org AIM: Nick Stinemates MSN: [EMAIL PROTECTED] Yahoo: [EMAIL PROTECTED] == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] More than one values returned?
Robert Cummings wrote: On Mon, 2008-02-18 at 18:06 -0800, Nick Stinemates wrote: C.R.Vegelin wrote: ?php $in = 4; calcpows($in, $pow2, $pow4); echo in = $in pow2=$pow2 pow4=$pow4; // define return fields as $... function calcpows($in, $pow2, $pow4) { $pow2 = $in * $in; $pow4 = $pow2 * $pow2; } ? HTH Thats a good example, and a good reason for passing values by Reference instead of by Value. I have found, however, that if I ever need to return /multiple/ values, it's usually because of bad design and/or the lack of proper encapsulation. You mean you've never had a function like getCoordinates()? Or getUsers(), or any other of a zillion perfectly valid and reasonable functions that return multiple values as an array? Wow, how odd! Cheers, Rob. getCoordinates() would return a Point object getUsers() would return a Group object... Not rocket science ;) -- == Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org AIM: Nick Stinemates MSN: [EMAIL PROTECTED] Yahoo: [EMAIL PROTECTED] == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session destruction problem
Adil Drissi wrote: Hi everybody, I need help with sessions. I have a simple authentification relying only on sessions (i don't use cookies). After the user submits his username and password, the script checks if that corresponds to a record in a mysql table. If this is the case $_SESSION['sessioname'] = $_POST['login'];. the $_SESSION['sessioname'] is checked in subsequent pages to see if the user is connected or not. The problem is after the user logs out, and after that uses the previous button of the browser he becomes connected. How can i prevent this please. Here is my logout.php: ?php session_start(); unset($_SESSION[sessioname]); session_destroy(); header(location: index.php); ? Thank you for advance Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping Is your session being set in any other place but your login page? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Protected ZIP file with password
Petrus Bastos wrote: Hey folks, Do you know how can I create a protected zip file with password? Is there anyway? I've search on the internet, but without success. Thank's in advance, Petrus Bastos. The easiest way to accomplish this would be to write a wrapper function using the zip tool provided by (almost every) Linux distribution. ?php function zip($directory, $password, $saveAs) { return exec(zip -r $saveAs -P $password $directory; } print zip(/home/nick, mypass, /tmp/homebackup.zip); ? Please note: the -P flag can be monitored on the local system so it is considered insecure. If you're going to be accepting input, you should also wrap your variables in escapeshellarg() http://us3.php.net/zip http://us.php.net/manual/en/function.exec.php from the zip manual entry THIS IS INSECURE! Many multi-user operating sys-tems provide ways for any user to see the current command line of any other user; even on stand-alone systems there is always the threat of over-the-shoulder peeking. Storing the plaintext password as part of a command line in an automated script is even worse. Whenever possible, use the non-echoing, interactive prompt to enter passwords. (And where security is truly important, use strong encryption such as Pretty Good Privacy instead of the relatively weak encryption provided by standard zipfile utilities.) == Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org AIM: Nick Stinemates MSN: [EMAIL PROTECTED] Yahoo: [EMAIL PROTECTED] == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Protected ZIP file with password
Petrus Bastos wrote: Hi Nick, Sorry, but I forgot to tell you that I can't use this exec neither system commands because they are disabled for security precautions. So, Do you have any other ideas on how can I do that? Thanks for your help, Petrus Bastos. On Feb 17, 2008 5:15 AM, Nick Stinemates [EMAIL PROTECTED] wrote: Petrus Bastos wrote: Hey folks, Do you know how can I create a protected zip file with password? Is there anyway? I've search on the internet, but without success. Thank's in advance, Petrus Bastos. The easiest way to accomplish this would be to write a wrapper function using the zip tool provided by (almost every) Linux distribution. ?php function zip($directory, $password, $saveAs) { return exec(zip -r $saveAs -P $password $directory; } print zip(/home/nick, mypass, /tmp/homebackup.zip); ? Please note: the -P flag can be monitored on the local system so it is considered insecure. If you're going to be accepting input, you should also wrap your variables in escapeshellarg() http://us3.php.net/zip http://us.php.net/manual/en/function.exec.php from the zip manual entry THIS IS INSECURE! Many multi-user operating sys-tems provide ways for any user to see the current command line of any other user; even on stand-alone systems there is always the threat of over-the-shoulder peeking. Storing the plaintext password as part of a command line in an automated script is even worse. Whenever possible, use the non-echoing, interactive prompt to enter passwords. (And where security is truly important, use strong encryption such as Pretty Good Privacy instead of the relatively weak encryption provided by standard zipfile utilities.) == Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org AIM: Nick Stinemates MSN: [EMAIL PROTECTED] Yahoo: [EMAIL PROTECTED] == Unfortunately I don't have any other ideas. Since PHP's implementation of ZIP does not have password features you're left with the following options: * Write your own implementation based on RFC * Write an interface to another app which can zip the file for you * Something else I can't think of ;x Sorry I don't have any other ideas. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] separating strings from extensions
John Meyer wrote: Børge Holen wrote: On Monday 18 February 2008 00:10:30 John Meyer wrote: Daniel Brown wrote: On Feb 17, 2008 5:37 PM, nihilism machine [EMAIL PROTECTED] wrote: i am using this code to get the extension of a filename: $extension = strtolower(strrchr($fileName,.)); how can i get the text BEFORE the . (period) You can STFW and RTFM. This list should never be your first place to ask simple questions. In any case ? $split = explode('.',strtolower($fileName)); $name = $split[0]; $ext = $split[1]; ? Flame job aside, that's going to fail on a compound extension such as .tar.gz by just returning .tar so. it.will.fail.this.one.to.txt and a fix would also fail because you would have to hardcord everygoddamn ending if thats what youre after. How many do you care to count for? I would say stick with the last dot, if its not particulary often you stumble over those .tar.bz2 endings. You could also stick with the first, i.e.: ? $split = explode('.',strtolower($fileName),1); $name = $split[0]; $ext = $split[1]; ? Or you can stop spreading bad advice and listen to Brady Mitchell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Protected ZIP file with password
Petrus Bastos wrote: Chris, Thanks for your help, but I think that package can't make what I want. But , I appreciate your help anyway and if you have any other ideas, please let me know! :) Thanks, Petrus Bastos. On Feb 17, 2008 10:38 PM, Chris [EMAIL PROTECTED] wrote: Petrus Bastos wrote: Unfortunately I don't have access to this family of methods because security policy. Lefting this way out, I didn't find anyway on how to do that. If you have any idea or know any module can do that, I'll appreciate to know too! See if the pear package does what you want: http://pear.php.net/package/File_Archive -- Postgresql php tutorials http://www.designmagick.com/ I'm sure you know what you're doing, but maybe you'd be better off letting us know the task / process to better understand what you'd like to accomplish. From there, since it's obvious that PHP does not have built in password functions, and that exec() is out of the question; maybe we can figure out how to move onward. -- == Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org AIM: Nick Stinemates MSN: [EMAIL PROTECTED] Yahoo: [EMAIL PROTECTED] == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Fwrite Function
Yuval Schwartz wrote: Hello, Can you please help me, I am writing code where I create a file and write to it from a form on a webpage and then read and display this file on the webpage. I want to change the color of the text that is written to the file. Do you know how I can do this? This is some of my code if you need clarification: * $boardFile = MessageBoard.txt; $boardFileHandle = fopen($boardFile,'a') or die(can't open file); fwrite($boardFileHandle, $name); fwrite($boardFileHandle, $talk); fclose($boardFileHandle); } $boardFile = MessageBoard.txt; $boardFileHandle = fopen($boardFile,r); $talkR = fread($boardFileHandle, filesize($boardFile)); fclose($boardFileHandle); echo $talkR;* ** ** Thanks First question is -- why aren't you using a database for this information? I would recommend sqlite (http://www.sqlite.org/) Now that that's taken care of, if you're trying to color the text on output, I would do it like this: ___ ?php $name = nick; //added for testing $talk = a message; //added for testing $NAMEFORMAT = 'font color=red'; $MESSAGEFORMAT = 'font color=blue'; $boardFile = MessageBoard.txt; $boardFileHandle = fopen($boardFile,'a') or die(can't open file); /* * Here we are going to write to the file, notice I added another line that prints a comma. This will be useful so that you can easily parse out and potentially format the 2 elements at will */ fwrite($boardFileHandle, $name); fwrite($boardFileHandle, ,); // added fwrite($boardFileHandle, $talk); fclose($boardFileHandle); $boardFile = MessageBoard.txt; $boardFileHandle = fopen($boardFile,r); /* removed $talkR = fread($boardFileHandle, filesize($boardFile)); */ while (($data = fgetcsv($boardFileHandle, 1000, ,)) !== FALSE) { /* * put 1000byte buffer to $data, this also goes 1 line at a time. */ echo $NAMEFORMAT . $data[0] . /font; // print the name echo $MESSAGEFORMAT . $data[1]; // print the text } fclose($boardFileHandle); ? If you have any questions regarding the implementation I suggest the following reading material: http://us3.php.net/manual/en/function.fgetcsv.php Good luck! == Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org AIM: Nick Stinemates MSN: [EMAIL PROTECTED] Yahoo: [EMAIL PROTECTED] == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sr. Software Engineer / PHP developer -Denver opportunities
Hello Group, I work for an executive search firm in Denver. I work with a handful of carefully selected clients that are offering excellent opportunities for PHP professionals. We are very excited to be working with these clients as they offer extraordinary opportunities and top notch compensation. Currently I have immediate openings for Sr. Software Engineers. They are great FTE positions with a fast growing, and very successful organization based in Denver (relocation Assistance provide). We are looking for Senior Software Engineers to join our dynamic and growing Internet-based company. The individuals will be responsible for the development, implementation, and maintenance of our scalable, reusable, web/software based user interfaces. You must be familiar with design patterns and be able to write abstract classes that adhere to standard OOP methodologies. The qualified candidate will expand our web-based platform, building new features and products. You will work with the leaders in online media and advertising. Requirements: * 4-6 years of commercial application development experience with open source technologies * Expert knowledge of Linux, Apache, MySQL and PHP 4, PHP 5, Perl/Python a bonus. * BA/BS in Computer Science or equivalent experience * Object-oriented design and distributed systems * Open source development tools, languages and application servers. * Competent with JavaScript, Prototype, Scriptaculous, Moo * OOP, SQL, Linux, HTML Kind regards, Nick Gasparro Managing Partner, REMY Corp. 1637 Wazee Street Denver, CO 80202 303-539-0448 Direct 303-547-7469 Cell mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] http://www.remycorp.com www.remycorp.com
[PHP] What does mean?
Hello, folks. I rember I've since this somewhere in perl and it has somethign to do with blocks of code. I came across the same thing in some PHP code. END some code END What exactly does it mean. BTW: PHP .net search breaks if you search for Regards, -- Nick __ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email __
Re: [PHP] Script to generate a site thumbnails
An example: ?php $imageMagick = convert; //name of the application using to convert the files $opts = -thumbnail 800x600 ; $fileName = my.jpg; exec($imageMagick $opts $fileName thumb.$fileName); ? Hope it helps! -- == Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org AIM: Nick Stinemates MSN: [EMAIL PROTECTED] Yahoo: [EMAIL PROTECTED] == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Month display calendar
On Sat, Jan 20, 2007 at 12:37:08AM +0800, Denis L. Menezes wrote: Dear friends. Can anyone please show me calendar scripts to make a calendar with a monthly display as shown in http://www.easyphpcalendar.com/ ? Thanks Denis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- You can take a look at: http://projects.stinemates.org/ And click on the 'View Source' link. == Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org AIM: Nick Stinemates MSN: [EMAIL PROTECTED] Yahoo: [EMAIL PROTECTED] == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php