2718.us blog » php4 http://2718.us/blog Miscellaneous Technological Geekery Tue, 18 May 2010 02:42:55 +0000 en hourly 1 http://wordpress.org/?v=3.0.4 Note to Self: Validate Input before using it in SQL Queries http://2718.us/blog/2008/04/15/note-to-self-validate-input-before-using-it-in-sql-queries/ http://2718.us/blog/2008/04/15/note-to-self-validate-input-before-using-it-in-sql-queries/#comments Tue, 15 Apr 2008 18:53:51 +0000 2718.us http://2718.us/blog/?p=21 Right, of course, I should be doing this already, but having magic quotes in PHP4 may hvae made me a bit lazy in some instances, and just like I’ve been going through and fixing register_globals dependence… As I read here,

Both register_globals and Magic Quotes were implemented in PHP to help beginners who were learning to program in PHP or new to programming in general. One thing I noticed about the upgrade was that neither of the problems I encountered were major, but also that they weren’t related to the actual upgrade to version 5, as they both should have been taken care of already. It brings up the discussion of a good programmer versus a bad/lazy programmer. Most of the sites that had any issues, and the few that had major issues were ones that I had taken over and was hosting but didn’t initially create. The sites were not built so long ago that there was an excuse for using both register_globals and magic quotes, and it shows that having programming standards is important, and that keeping up to date with programming trends and upgrades to the programming language are very important. I’m glad I caught this before I upgraded to verion 6 when I possibly would have had a much harder time solving the problem.

]]>
http://2718.us/blog/2008/04/15/note-to-self-validate-input-before-using-it-in-sql-queries/feed/ 1
php5 is fun http://2718.us/blog/2008/04/08/php5-is-fun/ http://2718.us/blog/2008/04/08/php5-is-fun/#comments Tue, 08 Apr 2008 23:15:21 +0000 2718.us http://2718.us/blog/?p=9 A few weeks ago, I upgraded my primary server to some version of php5 (from php4).  It’s been some time since I moved from php3 to php4 (even though I still have some files with a .php3 extension), but I don’t remember it being a huge change.  I upgraded because there was some small feature I wanted…  actually two small features I wanted that weren’t in php4.  One of them was all the curl_multi_ stuff (which parallelized the retrieval of the various LJ clone stats.txt files, making the cache update for that site a much much shorter process).  I don’t, offhand, remember what the other one was, I just know I ran into it again in the past few days and it was some other function that didn’t exist until php5.

Now, what I didn’t know when I did the upgrade was that php5 defaults to having register_globals off.  This is a very good thing.  I’ve been working hard for the past year to make sure any code I was working on didn’t rely on register_globals.  What I didn’t do however, was make sure that any code that was already in use on my server didn’t need register_globals.  This led to a weekend of digging through server error logs to find the scripts that needed to be fixed (if they could easily be fixed) or patch specific chunks of code wholesale by forcing register_globals on in .htaccess.

Lately, though, I’ve been playing with objects/classes.  I like the changes in the object/class stuff in php5 (even though I’m very oldskool and OOP still feels very strange to me, I keep trying to make OOP stuff work).  Komodo Edit, however, doesn’t seem to like it when I use php5 things like protected and private functions and variables.  I suspect this is because my macs have php4 somewhere and Komodo Edit is using the actual php executable to run syntax checks.  I haven’t yet found an easy way to deal with this, since I don’t want to just install php5 over the php4 that’s part of the base OS X install.

]]>
http://2718.us/blog/2008/04/08/php5-is-fun/feed/ 0