/sbin/ifconfig wlan0 will give you an IP address, if you are connected. also, the RX/TX counters will not be 0. you should not need root access for this.
if [ "x`/sbin/ifconfig wlan0 |grep UP`" != x ] ; then echo 'Connection' else echo 'No connection' fi
if [ "x`/sbin/ifconfig wlan0 |grep UP`" != x ] || [ "x`/sbin/ifconfig bt0 |grep UP`" != x ] ; then echo 'Connection' else echo 'No connection' fi