I'm honestly no stranger to the gym, having been going off and on for several years. I was in the best shape of my life about a year-and-a-half ago when I was going to the gym with a workout partner (I'd put on 10 lbs. of lean mass at that time), but then I let life circumstances get the better of me and subsequently lost it all.
You already know what to do.
I break it down into three major areas: nutrition, rest and gym. Get a book on nutrition. Learn what foods are good for you , which are good carbs, bad carbs, all that stuff. There is no miracle supplement that will give you a perfect body. Get your diet down and then add supplements. They're supposed to supplement your diet, not be the foundation. You might want to talk to a nutrionist too. In the end it'll save you money. I work with a guy who works out like a madman. Gym 5 days a week, really heavy lifting(bad form too, he's hurt himself a few times also), but he eats crap. He was complaining the other day after his physical that his cholesterol is too high and his body fat is over 20%. He's only 27 too.
At the gym you might want to get a good trainer for a few sessions. Mainly to tailor a program for your needs. He'll also show you good form. Last thing you want to do is blow out a knee while doing heavy squats or throw your back out while doing dead lifts. Look around at your gym. You'd be amazed at how many individuals show really sloppy form and pretty much are waiting for an accident to happen.
Finally you need to rest. Look at your body as a high performance machine. You need to give it adequate time to rest, heal and build itself backup again. Drink plenty of water, get enough sleep. It's also good to have a cheat day once in a while. Go pig out on burgers and chili fries. Nothing wrong with having a day like that once in a while.
Hope this helps you out.