curl http://exitlist.torproject.org/exit-addresses | grep -o -e "ExitAddress [^ ]*" | sed "s/ExitAddress //" > ipban.txt
If you run this in a bash terminal, it'll download a list of tor exit nodes from the tor project, format it in a nice, easy to use format, and save it to a file named ipban.txt.
You might want to set up, eg. a cron job to run this and update the file every once and a while.
Then, you just need to make your script deny anyone with one of these ip addresses. Then, nobody can access your site over tor.
This is what that command gives me at the moment:
http://pastebin.com/0iM6GrkM