Pls help me , how to Short browser

Started on the old forum in August 2012 · view the original in the archive · old links redirect here

13 replies · 811 views · started 14 years ago · 1 min read

5 participants
weet2012 Junior · 12 posts #1

hello frnd. how to short a browser in script Mobile chat wml ? help me guys. i need ur help huys. give me the code.

$XTREME$ Developer · 82 posts #2

short means what do you mean ?

weet2012 Junior · 12 posts #3

i want 15 maxlength browser . i've no idea if users joined use 100 letters in the browser. pls give me the code bro ...

nimeshka Developer · 180 posts #4

weet2012 wrote: i want 15 maxlength browser . i've no idea if users joined use 100 letters in the browser. pls give me the code bro ...

Limit the Length of the mysql field for browser to 15 characters bro...

Or try this,

$browser  = $_SERVER['HTTP_USER_AGENT'];

$browser = substr($browser, 0, 15);  // will return the first 15 characters from the browser

// then do your stuff here

External image (may be gone)

I'm Proud to be a Sri Lankan!

weet2012 Junior · 12 posts #6

where im holding the code bro ?

nimeshka Developer · 180 posts #7

weet2012 wrote: where im holding the code bro ?

Where you show the browser name...........But Limiting it with that way might end up with a ugly result like half of the words etc..rather it is good if u use a function like explode and break the names u need....

External image (may be gone)

I'm Proud to be a Sri Lankan!

Ghost Senior · 366 posts #8

i dont know what your trying to accomplish. but it makes no sense what so ever.

my script already cuts down the browser name to names like.

$user = explode ('/', $_SERVER['HTTP_USER_AGENT']);
echo $user[0];

opera mozilla chrome safari etc etc.

and the users themselfs cannot modify the outcome of this result. so i see this as a futial attempt at coding something that doesnt need fixing.

but each to their own.

<?php include ('Ghost'); if ($Post == true) { echo ' ![](http://destrukt.dk/ico/phpdeveloper.jpg) alt='coding-talk.com!!' />'; echo 'Sharing Is Caring!'; } else { echo ' ![](http://img98.imageshack.us/img98/6476/av3ro4.jpg) alt='the username GHOST has been comprimised!' />'; echo 'OMG SOMEBODY HELP ME!!'; } ?>
arnage Lead · 811 posts #9

Actualy they can and usualy do because UA is user input. 🙂 And by that, what if there isn't / slash in it... 🙂

<!DOCTYPE html PUBLIC "-//***WAPFORUM**.**RS***
Ghost Senior · 366 posts #10

well ive never come across a situation where the user has been able to modify the outcome of what his browser name displays at, but ill take your word for it.

and your solution would be to do what?

<?php include ('Ghost'); if ($Post == true) { echo ' ![](http://destrukt.dk/ico/phpdeveloper.jpg) alt='coding-talk.com!!' />'; echo 'Sharing Is Caring!'; } else { echo ' ![](http://img98.imageshack.us/img98/6476/av3ro4.jpg) alt='the username GHOST has been comprimised!' />'; echo 'OMG SOMEBODY HELP ME!!'; } ?>
Ghost Senior · 366 posts #12

well thats given me something to think about at least. although that snippet seems like alot of work just to grab a browser name and dump it into a .txt file. wether its a temp dump or a permenent one.

but thanks though.

<?php include ('Ghost'); if ($Post == true) { echo ' ![](http://destrukt.dk/ico/phpdeveloper.jpg) alt='coding-talk.com!!' />'; echo 'Sharing Is Caring!'; } else { echo ' ![](http://img98.imageshack.us/img98/6476/av3ro4.jpg) alt='the username GHOST has been comprimised!' />'; echo 'OMG SOMEBODY HELP ME!!'; } ?>
arnage Lead · 811 posts #13

Welcome. 😉 But i think that everything less than that is meaningless, for it structure as it covers check for empty server var, it can be isset but with no value, and sets the word Browser if is, checks if there is / slash and if not sends it to check and cut if its longer that 10 chars, if is / slash there it goes to see what there is, as for browser reading many of phones is gonna display Mozilla even when it totally different models, not to mention manufactors, here is covered Nokia phones not to display Mozilla when its Nokia or if in first string is model to display, for example, NokiaN97, not Nokia. Similar goes for IEMobile and Android... So, that function can only be extended, and plus better over strstr() as it uses strpos() is faster and clearly faster than regex and preg_match(). 😉

<!DOCTYPE html PUBLIC "-//***WAPFORUM**.**RS***
nimeshka Developer · 180 posts #14

Well...Actually browser is a user input as I see....and of course user can change the browser name showing...there are many proxies which can do that..

I think it is better to use explode function like this.

$user = explode (" ", $_SERVER['HTTP_USER_AGENT']); 

now dont tell if his bowser has no spaces, haha. If there is a browser name like that which has no spaces. then use the function I mentoned in the above post which will get the first 15 characters of the browsr name.

External image (may be gone)

I'm Proud to be a Sri Lankan!

Write your reply now; next you create a free account (or sign in) and it is posted right away. 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