What is max length of an ip address?

Hi - I am creating a table to log user sessions.  I intend to retrieve the ip address and browser type via php's $_SERVER ['REMOTE_ADDR'] and $_SERVER ['HTTP_USER_AGENT'] variables.

What is the max length of an ip address?  Also, what is the max length of the browser type variable?


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Guy Hengel [angelIII / a3]Billing EngineerCommented:
ip adress can only be xxx.xxx.xxx.xxx at least with ipv4 (the current standard)...

the full HTTP_USER_AGENT list:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ip adress


instead of trying to figure out the max length for
HTTP_USER_AGENT, cause only someone who has used every browser out there would know that
try something like this instead.
$brouwser = $_SERVER['HTTP_USER_AGENT'];
if(strstr($brouwser,"NT 5.1"))
$os = "Microsoft WindowsXP";
if(strstr($brouwser,"NT 5.0"))
$os = "Microsoft Windows2000";
if(strstr($brouwser,"MSIE 5.0"))
$brouwser = "Microsoft Internet explorer v5.0";
if(strstr($brouwser,"MSIE 5.5"))
$brouwser = "Microsoft Internet explorer v5.5";
if(strstr($brouwser,"MSIE 6.0"))
$brouwser = "Microsoft Internet explorer v6.0";

Open in new window

shafer23Author Commented:
great - thanks!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Applications

From novice to tech pro — start learning today.