So far

February 19th, 2006 in General - No Comments

Simplicity’s coming along well. Maybe I’m lazy but after writing all that Ajax code I felt I deserved a rest. I’m still doing some brain-storming on the form handling – for now I think Simplicity will be an in-house thing.

Thomas Breton of H-Inventory( wants me to build a template for them, and to maybe bring in a knowledge of Ajax. I’m very happy that I’ve been considered worthy of joining a full-scale developer team. I’ve been cracking my brain for some time now and I haven’t been able to come up with something feasible. I don’t want to use one of those cheap templates that always float around in my head. The thing is, it doesn’t have to be too flashy – just like my site or which I like for it’s pure Simplicity.

I’ve moved from because my site got hacked and I decided to treat myself to some paid hosting (lucky me – my database wasn’t compromised). Which brings me to one question I’ve always wondered about – why do people hack into other people’s websites? This guy could easily have renamed or deleted my home page and put his – instead he wiped out all my files and directories. I really wish I could lay my hands on whoever it was.

I crossed the Forum Lurker rank on PHPFreaks last month and I’m now a forum regular. I hope to achieve guru status next month and to be more active in AjaxFreaks.


February 1st, 2006 in Coding - No Comments

I’ve been very hush-hush about this but there’s this web project I intend to start – it’s called Simplicity. I’m going to be writing in Asp.NET but just for the fun of it I’ll write a PHP version when I’m through.

If anything, Simplicity is going to be anything but simple. I’m using plenty of Ajax – which I don’t know one bit about. I ordered a book on Ajax from Amazon and I’m contemplating orderig one about Web Sevices. The thing is, I’m running out of my supply of cash – and I haven’t gotten a job yet. I don’t want to go beyond a certain level – I’ve spent only four weeks here and I’ve spent more than $1000 and my budget isn’t helping any. I intend to buy a laptop and more programming books within three weeks. I hope it works out.

Back to Simplicity – the main thing keeping me away from using PHP at this time is the handling of web server controls. I intend to write a library later that handles that but that’s not my concern now.

The obvious problem I have is themeing. I had that problem with the Asp.NET AuthWare version. I had to use dozens and dozens of repeaters – I mean, it’s not funny.

My current solution currently is to write a web control library that picks certain templates from a database and displays it according to “rules”. I hope it works – do you have any

Language – PHP

Friendly Urls

Why did I suddenly decide to create friendly Urls for AuthWare. I must tell the truth – I never really intended to. There was a stage at which I wanted to restructure it to utilise Apaches mod_rewrite.

I’ve always had this thing for not comprehending regular expressions. In fact I hardly ever use them except for my html to xhtml converter (I think the function is called html_2_xhtml()).

The only stuff this function hasn’t been able to do is exclude specific tags. I’m a very stubborn coder – which means I don’t look at others’ work until I’m convinced I’m stumped – or until I come up with mine.

Speaking of mod_rewrite, I realised it would never work out – I have both IIS and Apache on my machine and I’ve configured both to run PHP. There are some users that use Windows out there and there was no way I could see them being excluded from using my system – because IIS obviously doesn’t support rewriting except you use some third-party tool. I then remembered trying to browse some web pages and adding slashes at the end – just some idleness on my part. Was there a way to get it out? Yes, I discovered – by using $_SERVER['PATH_INFO']. I converted the ampersands (&) to slashes as well as the “?“. I created an array $temp_array by splitting – using explode().

I then created a new blank array – let’s call it $_get. For every even index x in $temp_array, I looped through $temp_array, adding an array member to $_get with key $temp_array[x] and value $temp_array[x+1]. Then I array_merge()d $_get and $_GET.

Bug List

After using that method, I discovered that my sessions were being set wrongly whenever I turned friendly urls on. The PHPSESSID was being set wrongly. No secure information is stored in the sessions – just the current page so that AuthWare remembers the last page you were viewing when you log out. For example, for index.php/mode/cat/action/viewsub/id/1, the cookie path is index.php/mode/cat/action/viewsub/id/1 which isn’t what I had in mind. I guess I have two options

  • Save everything in a MySQL database but that just increases traffic or
  • Find some way of extracting the real path of the script and then setting a cookie each time.

Linux Issues

Linux servers have a different way of interpreting $_SERVER[‘PATH_INFO’] as I found out after uploading and running phpinfo() when my friendly urls wouldn’t work. I had to insert a check and strip $_SERVER["SCRIPT_NAME"] from $_SERVER["REQUEST_URI"]. It’s currently running as expected.