This is a tough one and hard to do reliably. I have given it a go in the past and it went something like this
- Obtain a database of IP addresses, plus cities and countries (http://lite.ip2location.com/database-ip-country-region-city OR http://ipinfodb.com/ip_database.php)
- Get the IP address and query for it against those tables to find the city and country
- Finally check if its in Iran using the country column
There are paid for services that can do this really quickly for you. It might take you ages to get something working that is still unreliable because you simply do not have the data. I would seriously consider http://www.maxmind.com/en/city_per - unless of course this is a completely none commercial project and $ is a no no.
If you can get the lat and long from an IP table, even without the city data then you may want to then use something like this to check for the nearest city of Javascript is an optio n - Finding nearest listed (array?) city from known location.
What about the browsers Share Location feature?