Update class.php

Added checkip function