More phplib fun!We're using de …

More phplib fun!

We’re using default_auth on our site and thanks to some help I managed to make phplib play nicely with our template system. That is, until my boss tested it and discovered that if you enter an incorrect username/password the phplib loginform appears. Look around line 174 of auth.inc for the culprit.
After I was almost finished a long email to the phplib list I figured out what to do. If the user types in an incorrect username/password then log them in as “nobody”!
The fix to do that took all of 5 seconds and is below:

Edit local.inc, look for auth_validatelogin(), this is around line 146 of my local.inc, and modify those lines to look like the following:

if( $this->db->num_rows() )
{
    while($this->db->next_record())
    {   
        $uid = $this->db->f(“uid”);
        $this->auth[“perm”]  = $this->db->f(“perms”);
        $this->auth[“uname”] = $this->db->f(“username”);
    }
}
else
{
    // Log them in as “nobody”
    $this->auth[“perm”]  = “”;
    $this->auth[“uid”] = “nobody”;
    $uid = “nobody”;
}

When you try and login now with incorrect details the loginform will be printed again within the confines of your site templates and nobody will be the wiser as to the grief this caused you!

PostgreSQL has a feature calle …

PostgreSQL has a feature called MVCC or Multi-Version Concurrency Control. Here’s a simple example to show it in action. I think it’s like CVS for databases.

MVCC, or Multi-Version Concurrency Control, is the technology that PostgreSQL uses to avoid unnecessary locking. If you have ever used another SQL capable DBMS, such as MySQL or Access, you have probably noticed that there are times when a reader has to wait for access to information in the database. The waiting is caused by people who are writing to the database. In short, the reader is blocked by writers who are updating records.

By using MVCC, PostgreSQL avoids this problem entirely. MVCC is considered better than row-level locking because a reader is never blocked by a writer. Instead, PostgreSQL keeps track of all transactions performed by the database users. PostgreSQL is then able to manage the records without causing people to wait for records to become available.

Hectic weekend. Mel and Sharon …

Hectic weekend. Mel and Sharon got married and so did Dave and Claire. I wanted to go to both obviously but it turned out to be very difficult to motivate ourselves to drive 20 miles after enjoying the after-wedding meal and chat. I hope Dave and Claire don’t mind too much. 🙁
Thank you Sharon for mentioning me in your speech, it means a lot! *hug*
The night went really well, I haven’t enjoyed myself so much in a long time. Martina was absolutely gorgeous of course! Heads were fairly sore yesterday and didn’t do much at all though.

Both couples are off in Cyprus for the week. They chose the same country to honey moon in, both ladies wore the same engagement ring, and both had the same little bit of poetry on their booklet/invitation! Oh, and they both got engaged around the same time last year!

Dilbert on frequent shopper cl …

Dilbert on frequent shopper clubs. I joined Xtra Vision last week and had a quick glance through the application form. Martina looked at me strangely when I started reading the terms and conditions so I just filled in the form and rented out the DVD. At home I looked through it more carefully and noticed that Xtra Vision share my details to their partner companies as part of my membership. There was no opt-out, there was no check-box. *ggrrrr*
Last Friday I got a sample of Dove shower-gel in the post… *sigh*