Use this script here to detect mobile browsers.
thanks for sharing, but i hate paying for code like on that one site. You just never know if the person actually coded it right.
you can check this a few ways in PHP:
1. UserAgent ( can be faked )
2. Screen Resolution ( getting harder now with iPad and tablets that can do 800×600+ )
4. IP info ( if from a cellular hostname, but some of these hostnames are from companies that do mobile and broadband like verizon )
all in all, its getting harder but is still doable