Chosen Solution
So, when I am near modem my internet works perfectly. But when I go few meters away from modem I have full wifi connection, but he say no internet. Everything is fine with modem. I tried hard reset, reset network settings and it’s not helpful. And my iPhone 4 has a better range then iPhone 5.
It could be your wifi antenna. I had the same problem after I repaired my home and power button. So I opened the phone again and saw that the antenna was unplugged from the motherboard, plugged it back in and everything works perfectly.