What to do: If the water is coming from a plumbing problem (that is, if it’s not teeming outside), shut off the main right away—unless you have to swim to it. Newer houses typically have electrical wiring at least a foot off the ground, but if your heating plant is old, its electrical feed may be just inches off grade. The water could be electrified even if it's only ankle deep. Call an electrician or the utility to cut power to the building. If it's a burst pipe, call a plumber. If it's a rainstorm, sit tight and wait for the water level to drop before attempting a cleanup.
How to keep this from happening to you: You can't do much to prevent pipes from bursting, other than never letting them freeze. But you can protect your basement from rain-induced flooding. "Make sure your yard slopes away from the house and that your gutters are working properly," says Clark Campbell, the owner of an Atlanta basement-waterproofing company and president of the National Association of Waterproofers. If the problem is persistent, you may need to plug foundation cracks with epoxy or install a sump pump in the basement floor.