As various kinds of peer-to-peer (P2P) applications become popular and widely known to people all around the world, research on P2P networks has received considerable interest. Recent studies show that various problems like free-riding and content pollution have influenced the working performance and development of P2P networks. In this paper, we propose a distributed, resource-based reputation rating mechanism to improve the chance that participating peers get authentic resources in a content polluted environment. The rating mechanism can be widely applied to different peer-to-peer networks. Simulation results show that the rating mechanism effectively helps nodes to construct right view towards other nodes and protects honest nodes from polluted contents.