How To Encode Ip Address In Mysql Database With Php
Posted On Thu Aug 02, 2007 By hostman In Snippets forums topics about simple codes to make programming fun Forums
if you want to insert user information like the user's ip address, but don't want to put the dots in the ip address, there is a better way. like many forums websited, for example, phpbb, they encode the ip address of the poster, so they use this fucnctions to encode and decode, its an effecient way to manage information in your database.
here and example:
CODE:
here and example:
CODE:
function encode_ip($dotquad_ip){
$ip_sep = explode('.', $dotquad_ip);
return sprintf('%02x%02x%02x%02x', $ip_sep[0], $ip_sep[1], $ip_sep[2], $ip_sep[3]);
}
function decode_ip($int_ip){
$hexipbang = explode('.', chunk_split($int_ip, 2, '.'));
return hexdec($hexipbang[0]). '.' . hexdec($hexipbang[1]) . '.' . hexdec($hexipbang[2]) . '.' . hexdec($hexipbang[3]);
} tacal Thu Aug 02, 2007
very good information
Related Content
Information
Forums »
Snippets forums topics about simple codes to make programming fun »
How To Encode Ip Address In Mysql Database With Php
Snippets forums topics about simple codes to make programming fun »
How To Encode Ip Address In Mysql Database With Php
Title: How To Encode Ip Address In Mysql Database With Php
Description: How To Encode Ip Address In Mysql Database With Php
Tags: how ,to ,encode ,ip ,address ,in ,mysql ,database ,with ,php
Info: This Post Has Been Viewed 0 Times Since
Date: Thu Aug 02, 2007
Author hostman Received 1 Replies #1373
Date: Thu Aug 02, 2007
Author hostman Received 1 Replies #1373
Share
URL: 

Embed: 

To embed this topic, just copy the code from the "Embed" box. Once you've copied the code, just paste it into your website or blog to embed it
BBCODE:: 

BBCODE is use on forums. You can put this code on all your BBCODE enabled forums like PhpBB, vBulletin® and others. Just Copy and Paste this code on your Posts and Replies on your forums
wallpaperama | Wallpapers | Forums | Terms Of Service
copyright © 2013 wallpaperama - All Rights Reserved - Last Updated Mon May 06, 2013 (-8 GMT)
Powered by: Webune Forums V5
copyright © 2013 wallpaperama - All Rights Reserved - Last Updated Mon May 06, 2013 (-8 GMT)
Powered by: Webune Forums V5