JSON_ENCODE pre php 5.2

Posted May 24th, 2011 in PHP, Web Development by Jonathan

Once again I have run into an issue with one of those big hosting companies. This time it involves running an old version of php, 4.4 to be exact. While this may work for most things if you’re not getting so technical, and I didn’t really think I was, but of course it turns out something I take for granted (running php 5.3 on my production servers) caught me off guard.

I had a simple ajax call for a comment form. Send off the info and send an email out, very simple right. Well if you brush up on your php versions you’ll find that json_encode isn’t available till php version 5.2. So while the ajax call was working, my expected response was not.

So I started searching for a way to mimic the json output to send back, I cam across a post on Stack Overflow that pointed back to the PHP doc’s site on json_encode, and down in the comments boukeversteegh had posted an easy to use function to do exactly what i was looking for.

Continue Reading »

Session Time Out Notifier (PHP, Jquery)

Posted December 14th, 2010 in JQuery, PHP, Toolbox, Web Development by Jonathan

I was tooling around mint.com the other day and noticed that after a certain amount of time a notice appeared at the top of the screen to inform me that I was about to be logged out. Then after the time ran out I was returned to the login screen.

A few weeks ago, a coworker was asking if there was a better way to deal with being logged out on a backend system I put together. Once I saw the mint.com system I knew I had to try to build something like it. So I did, it’s not exactly the same because of the system I’m using but it works just as well and looks good doing it – I also wanted it to be a simple addition.

Getting started;

Have some idea of how to use jQuery, I don’t think what I’ve done here is hard – but at least understand some basic concepts like the $(document).ready() function,.fadeIn(),.click(),etc. For PHP, have an idea of $_GET variables, and header locations. Then some knowledge of Javascript itself, and an understanding of loops and counting.

Continue Reading »

A Quick Note about 1and1.com (php5)

Posted July 10th, 2010 in PHP, Web Development by Jonathan

This is merely a heads-up, reminder, cautionary tale, whatever you want to call it – but I seem to forget about it until something breaks and then after a few it dons on me that this is probably the problem. See I get so use to the servers I use at my day job, the ones that are custom built with CentOs running php5 and all the good stuff. I never have this problem.

So, and this applies to more than just 1and1 I’m sure. I’ve run into this on other hosting services – and I guess their are other ways to resolve this, but I’m going to start with my way.

So like I said, I’m use to what I have at work, PHP5. I base everything off that and this of course spills over into my contract work. So tonight I’m working on a project and I’m uploading it and trying to get it running. All I see if a odd error from adodb, missing a ending “}”. So I recopied it to the server, same thing, so I erase the entire adodb dir and try again. Still the error. So I start back tracking and spitting out all the errors I can to try and track this down. Because it’s sure as heck not a problem on my local machine.

Continue Reading »