Corect User Agent

Started on the old forum in January 2008 · view the original in the archive · old links redirect here

3 replies · 1,201 views · started 18 years ago · 1 min read

2 participants
alesh Lead · 604 posts #1

okay heres the thing, sumwhr around here Gumslone posted this code

function mobile_phone($_mob_ua)
{
      $_position=strpos($_mob_ua,"Nokia");
       if($_position)$_mob_ua = substr($_mob_ua, $_position,25);
       else $_mob_ua=$_mob_ua;
      $phone = explode ('/', $_mob_ua); 
      return $phone[0];
}

it shows users actualy phone model if they come at site with browsers tht shown as mozila...

4 my needs i corected it a lil bit

function mobile_phone($_mob_ua)
{
      $_position=strpos($_mob_ua,"Nokia");
       if($_position)$_mob_ua = substr($_mob_ua, $_position,25);
       else $_mob_ua=$_mob_ua;
      $phone = $_mob_ua; 
      return $phone;
}

(its the same, it just shows detailed browser) and it works!!!!!! im using Opera 8.65 and it shows tht my browser is nokia n80 (before - mozila)

but why if i browsing with opera mini it still shows freakin opera and not nokia n80????????????????????????????????

is it posible 2 make it show phn model when u browsing with opera mini?????????????

eeeeerrr....

kiss Senior · 294 posts #2

okay heres the thing, sumwhr around here Gumslone posted this code

function mobile_phone($_mob_ua)
{
      $_position=strpos($_mob_ua,"Nokia");
       if($_position)$_mob_ua = substr($_mob_ua, $_position,25);
       else $_mob_ua=$_mob_ua;
      $phone = explode ('/', $_mob_ua); 
      return $phone[0];
}

it shows users actualy phone model if they come at site with browsers tht shown as mozila...

4 my needs i corected it a lil bit

function mobile_phone($_mob_ua)
{
      $_position=strpos($_mob_ua,"Nokia");
       if($_position)$_mob_ua = substr($_mob_ua, $_position,25);
       else $_mob_ua=$_mob_ua;
      $phone = $_mob_ua; 
      return $phone;
}

(its the same, it just shows detailed browser) and it works!!!!!! im using Opera 8.65 and it shows tht my browser is nokia n80 (before - mozila)

but why if i browsing with opera mini it still shows freakin opera and not nokia n80????????????????????????????????

is it posible 2 make it show phn model when u browsing with opera mini?????????????

//////////////////////////////////////////// in every file you have this code: $brws = explode(" ",$HTTP_USER_AGENT); $ubr = $brws[0]; change it whit this and you get your answer: $brws = $HTTP_USER_AGENT; $ubr = $brws; good luck External image (may be gone) /////////////////////////////////

www.inbuzunar.mobi -Your mobile portal pocket

alesh Lead · 604 posts #3

ugh but then ill get looooooooooooooooooong browser as hell....

it will take half of page lol and if i came with opera 8.65 it will show mozilla and nt nokia n80

eeeeerrr....

alesh Lead · 604 posts #4

lol i found it... HTTP_X_OPERAMINI_PHONE and HTTP_X_OPERAMINI_PHONE_UA i tried and it shows my corect user agent... N80-1 nd nt opera

eeeeerrr....

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close