header to mobile site and header to normal page
<p>I have chosen to be mobile things under the same with the database so it does not manage to get my page / code, do not know if it is a good idea or do you have a andne idea for it? ..</p>

<p>What I would like it to do is it to find out whether it is mobile or whether it's just a browser you are logging on.</p>

<pre><code>function db_c()
     {
         $link = @mysqli_connect('localhost', '..', '..', '..');
         if(!$link)
         {
             die('Connect Error: ' . mysqli_connect_errno());
         }
         mysqli_set_charset($link, "utf8");
         $this-&gt;mysqli = $link;


         function detect_mobile($ua=null) {
             $ua = ($ua) ? $ua : $_SERVER['HTTP_USER_AGENT'];    
             return (preg_match('/(alcatel|amoi|android|avantgo|blackberry|benq|cell|cricket|docomo|elaine|htc|iemobile|iphone|ipad|ipaq|ipod|j2me|java|midp|mini|mmp|mobi|motorola|nec-|nokia|palm|panasonic|philips|phone|playbook|sagem|sharp|sie-|silk|smartphone|sony|symbian|t-mobile|telus|up\.browser|up\.link|vodafone|wap|webos|wireless|xda|xoom|zte)/i', $ua));    
         }


         if(detect_mobile($ua) ) {
            header('Location: http://mobil.blabla.dk/');
         }
         else{
             header('Location: http://www.blabla.dk/');
         }
 }
</code></pre>

<p><strong>Error her:</strong></p>

<p>Notice: Undefined variable: ua in /home/jesperbo/public_html/blabla.dk/inc/function_php/function.php on line 39 Warning: Cannot modify header information - headers already sent by (output started at /home/jesperbo/public_html/blabla.dk/inc/function_php/function.php:39) in /home/jesperbo/public_html/blabla.dk/inc/function_php/function.php on line 43 </p>

<p>line 39 is here:</p>

<pre><code> if(detect_mobile($ua) ) {
</code></pre>

<p>line 43 is here:</p>

<pre><code>header('Location: http://www.blabla.dk/');
</code></pre>

<p>I try to take this into my hand, but then go on over and nothing will show on the page <a href="http://dk1.php.net/manual/en/function.ob-start.php" rel="nofollow">http://dk1.php.net/manual/en/function.ob-start.php</a></p>

<p>If I have done like this:</p>

<pre><code>function detect_mobile($ua=null) {
             $ua = ($ua) ? $ua : $_SERVER['HTTP_USER_AGENT'];    
             return (preg_match('/(alcatel|amoi|android|avantgo|blackberry|benq|cell|cricket|docomo|elaine|htc|iemobile|iphone|ipad|ipaq|ipod|j2me|java|midp|mini|mmp|mobi|motorola|nec-|nokia|palm|panasonic|philips|phone|playbook|sagem|sharp|sie-|silk|smartphone|sony|symbian|t-mobile|telus|up\.browser|up\.link|vodafone|wap|webos|wireless|xda|xoom|zte)/i', $ua));    
         }


         if(detect_mobile() ) {
            header('Location: http://mobil.blabla.dk/');
         }
         else{
             header('Location: http://www.blabla.dk/');
         }
</code></pre>

<p>you will see it show like this:</p>

<p>Denne webside har et loop ved omdirigering
Websiden på blabla.dk/ har forårsaget for mange omdirigeringer. Dette kan muligvis løses ved at rydde dine cookies for dette website eller ved at tillade tredjepartscookies. Hvis dette ikke hjælper, ligger problemet muligvis i din serverkonfigurationen og ikke din computer.
Her er nogle forslag:
Genindlæs denne webside senere.
Få flere oplysninger om dette problem.
Fejl 310 (net::ERR_TOO_MANY_REDIRECTS): Der var for mange omdirigeringer.</p>

<p><a href="http://billedeupload.dk/images/fOUIQ.png" rel="nofollow">http://billedeupload.dk/images/fOUIQ.png</a></p>

<p>So if I spend $ua better yet the last I show here:</p>

<p><em>Hope you can help me :)</em></p>
