If you really want to program your own version of AdSense, you're going to need a heck of a lot more than a couple of articles or a plug-in. AdSense is a very sophisticated system, not least because of its ability to analyse the contents of the host pages and thereby serve ads targeted at the pages' readers. And if you are going to create your own version of AdSense, you will also need to create your own version of AdWords, which is even more complex. Have you given any thought to how you will handle campaign management, for example? Not to mention collecting revenues from advertisers and distributing it to publishers.
Even if you solve the technical issues, you will still need to recruite a large number of advertisers, and an even larger number of publishers. Have you got any plans in place for doing that?
I hate to discourage any new venture, but what you are proposing is very ambitious. I don't think you're going to find the help you need simply by asking in a forum.