It's really easy to detect mobile Safari with PHP:

$isMobileSafari = preg_match('/(iPod|iPhone|iPad)/', $_SERVER['HTTP_USER_AGENT']);

The variable is TRUE is it's mobile Safari on an iPod, iPhone or iPad, FALSE otherwise.