use the .htaccess file
I have
<Limit GET HEAD POST>
order allow,deny
deny from 200.174.151.122
deny from 203.222.151.66
deny from 212.235.110.99
deny from 213.204.212.153
deny from 216.240.136.222
deny from 24.101.46.193
deny from 24.156.24.170
deny from 24.167.75.133
deny from 66.143.183.179
deny from 67.114.147.154
deny from 68.123.196.18
deny from 69.56.208.106
deny from 69.56.215.122
deny from 69.93.129.74
deny from 69.93.207.2
deny from 69.93.38.130
deny from 69.93.48.122
deny from 80.178.68.70
deny from 80.179.0.37
deny from 80.181.182.148
deny from 80.232.169.174
deny from 80.61.129.224
deny from 82.166.67.76
deny from 82.197.197.79
allow from all
</LIMIT>
so I guess this might work
<Limit GET HEAD POST>
order allow,deny
allow from 99.999.999.99
deny from all
</LIMIT>
and just replace 99.999.999.99 with the allowed ip
Laserlight's suggestion will work but you need to add it to every script (or include the checker into every script) which may expose you to risks.