How the Sorting Hat Was Born
Soon, tension ran high; someone brought up the topic of who would be let into the school. Three of the four were for everyone; pure blood, muggle, or half-blood. One of the four wanted only pure blooded magicians, feeling that muggle borns could not be trusted. So, that is how the four houses became, each named after the founding sorcerers: Gryffindor, Hufflepuff, Ravenclaw, and Slytherin. The wizards, had handpicked the students whom the felt worthy to belong in their house. Soon a great discussion broke out. Who would sort the students after they died? Well, Godric Gryffindor supplied a hat, a brain was inserted, and from then on the Sorting Hat looked deep into the minds of Hogwarts students and sorted them into their houses.
House Ghosts
The Gryffindor Ghost--Sir Nicholas de Mimsy Porpington A.K.A. Nearly-Headless Nick
The Hufflepuff Ghost--The Fat Friar
The Ravenclaw Ghost--The Grey Lady
The Slytherin Ghost--The Bloody Baron
Hogwarts Protection
There are tons of bariers inside the school, as well as out. There are tons of charms to keep people that are not wanted out of the school.