Showing posts with label PHP. Show all posts
Showing posts with label PHP. Show all posts

Thursday, February 15, 2007

PHP code

I have heard from several developers that they hate PHP, but I have to admit that every time I need example code to help me do something the PHP documentation has never let me down. Why is that? The PHP documentation allows user comments, just like a blog and the comments are displayed at the bottom of every PHP command. For instance, I needed to find a way to read an MP3 file MP3 files and return it to any browser to allow the user to save the file to their computer. Sounds easy, but it turns out the code is quite complex. I searched google for "read MP3 PHP" and found sample code that did not work, and then saw one line at the bottom of the sample that used a PHP function I had not heard of before called "fpassthru". When I went to PHP fpassthru, I learned that using fpassthru is actually much slower than feof and fread. The code I am using was taken from the post named file downloads verified by session vars : 22-Oct-2005 03:36.

Saturday, January 13, 2007

PHP changes

I have been using PHP to maintain a couple of web sites for years and I just moved to another web hosting provider and now I am in the middle of changing every one of my PHP scripts. I am using a freeware PHP bulletin board that just stopped working. I check into it and find out that it was assumed every where that a form posting data would set global variables for every form element. For instance, if I have a form element of <input type="text" name="email"> then the function that read that would have a statement of "global $email". I ended up switching all of the globals to use a syntax of $_REQUEST['email'] and now it is all working, well almost. In that same forum code I have a login that is saved to a cookie and that is not working. It used $SCRIPT_URL but that does not work. Who knows how long that will take to figure out? I go to the friend who has never let me down PHP Documentation. The best thing about it is the comments added by users that often has sample code...

Wednesday, January 10, 2007

web server host

I helped some friends find a new web hosting service and I picked HostMonster.com because they needed tons of disk space for conference sessions and support for their existing PHP code. For $4.95/month we got 200 GB and support for either PHP or RubyOnRails. I am pleased so far as they even have an on-line chat service that did not install anything on my Mac computer!