I first came to the U.S. on an H-1B visa, then my visa ran out, around the time that my employer went bankrupt. I stayed in the U.S. and have been doing odd jobs for the last couple months, but I just married a U.S. citizen. She would like to help me get a green card. Someone told me that I can do that without leaving the U.S., by adjusting my status, but I also read that you're not allowed to adjust status if you've worked illegally. What can I do?
You're in luck. Marrying a U.S. citizen (assuming it's a real, not a fraudulent marriage), not only qualifies you for U.S. permanent residence, it makes you an "immediate relative." Immediate relatives enjoy a number of special privileges and exceptions under U.S. immigration law.
Among these is that you are allowed to use the U.S.-based procedure known as "adjustment of status" regardless of the fact that you overstayed your visa and also regardless of having been employed in the U.S. without authorization. This comes from Section 245(c)(2) of the Immigration and Nationality Act.
Many others are not so lucky. For example, spouses of permanent residents cannot adjust status in the U.S. unless they themselves are still in lawful immigration status and have not worked without authorization. (An option for them might be to apply for their green card overseas, at a U.S. consulate, but they might face bars to returning, particularly if they ended up spending time in the U.S. unlawfully.)
For more information on your eligibility and the application process, see the "Marriage-Based Visas and Green Cards" section of Nolo's website or consult with an experienced immigration attorney.