View Full Version : Map IP to unique creative identifier

11-08-2007, 09:56 PM
I would like to create a system where people can post messages without registering. Rather than showing their IP address to identify which message belongs to a unique person, I would like to somehow map it to a creative/non-technical solution. For example, I think I saw somewhere someone doing it to colored boxes. So when I would post a message, in the left column would be 2 different colored boxes and in the right column would be my message. The next person posting from a different IP would have different colors. Can anyone think of any other ideas to solve a problem like this or know of any premade PHP code that might do this (for colors or equitable solutions)?

11-08-2007, 10:42 PM
This is a cool idea.

I like the colours, as humans are very good at recognizing colours.

Shapes could also be introduced...

What about patterns in the colours? Vertical lines, horizontal lines, diagonal, etc.

Creating this would be a little bit harder, as you have to take into account that people have dynamic IPs. So you have to use only the first 2 or 3 groups of digits.

11-08-2007, 10:51 PM
It is aimed to be a kind of hybrid between chat and discussion forum. If someone returns with a different IP, that will be fine for the current setup. As long as that IP is fixed during their visit to the page... which it will be. Can you think of a clever way to code this? I don't really want to create 255+ unique hand drawn images.

11-08-2007, 11:19 PM
$ip = explode('.', $_SERVER['REMOTE_ADDR']);
$backgroundcolor = dechex($ip[0]) . dechex($ip[1]) . dechex($ip[2]);

$backgroundimages = array('stripes.png', 'diag1.png', 'diag2.png'); // transparent PNGs

$image = $backgroundimages[$ip[3] % sizeof($backgroundimages)];

echo '<div style="width:100px;height:100px;background-color:#'.$backgroundcolor.';background-image: url('.$image.');"> Squares </div>';

Mine's teal :D

11-09-2007, 12:21 AM
Was it 'identicons' you saw? (http://www.docuverse.com/blog/donpark/2007/01/18/visual-security-9-block-ip-identification)
the link to the source on that page contains instructions as well as a link to a PHP implementation of something similar...