This is not a complete sketch, don't waste our time with code snippets.
5908 bytes? You do know that the UNO has 2kB of RAM in total?
"wifi shield" let me expect you're talking about the Arduino WiFi shield and not any of the other WiFi shields available. Am I correct?