I have combined and modified codes from Twitter's API and Facebook Connect in order to create a working sample that would let webpage viewers to share or publish a link (from a certain site) to their Twitter and Facebook accounts - simultaneously.
For the Twitter login, I prefer to use oAuth, since Basic authorization/authentication is very unsecure and would be terminated soon.
Here are some helpful developer links to get you started Ü
Facebook Connect Tutorial1
Twitter API wiki
Beginner’s Guide to OAuth – Part I: Overview
Of course, a few modification of my code would let you update your status using a dynamic text, but I'll leave that task to you.