473,785 Members | 2,798 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Map IP to another creative unique identifier

5 New Member
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?
Nov 8 '07 #1
3 1558
jx2
228 New Member
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?
they dont have to register but they can type theirs names register name for a session and job done - for those who wont type name in use something like : "anonymous1 2" ; of course for each person another number

btw. IP isnt realy good idea i thing you should try cookies or sessions for that kind of jobs

premade code/? no no no :-) try do it on your own personaly i dont like to use others ppl scripts cose you can never be sure abot them and debaging or changing them to my needs usualy takes longer ten typing new code

good luck

jx2
Nov 8 '07 #2
Atli
5,058 Recognized Expert Expert
Hi.

Have you considered allowing your posters to add a name to their posts?

Alternatively you could somehow interpret their IP addresses into colors.
For example, each IP address is represented by four 8bit integers (0-255), which is incidentally the exact same method used to store 32bit ARGB colors...
Granted, you may want to leave out the alpha byte there.

I recommend that you take a look at the following functions to implement it:
imagecreatetrue color
imagefilledrect angle
imagecoloralloc ate

(Check out imagefilledelli pse for a code example, very similar to the rectangle function)
Nov 8 '07 #3
nothing1
30 New Member
You can use the ip by creating an array of four then you have two options

1. Create colored DIV: using the array but getting rid of one you can put them back together and create different colors
ex.
128.66.0.175 = #336600

[PHP]$ip = $_SERVER['REMOTE_ADDR'];
$ip_numbers = explode('.', $ip);
if ($ip_numbers[0] <= 150){
$color = '33';
}else{
$color = '66';}
if ($ip_numbers[1] <= 150){
$color2 = '33';
}else{
$color2 = 'FF';}
if ($ip_numbers[3] <= 150){
$color3 = 'CC';
}else{
$color3 = '00';}[/PHP]

USE
[HTML]<DIV class="user" style="backgrou nd-color: #<?php echo $color.$color2. $color3 ;?>" ></DIV>[/HTML]
NOTE: You can make it more varied by adding more if statements. not tested

2. Call an image: you can also add up the numbers and make if statements to create a request for an image.

[PHP]$ip = $_SERVER['REMOTE_ADDR'];
$ip_numbers = explode('.', $ip);
$total = sum($ip_numbers );
if ($total <= 200){
$img = 'http://mysite.com/images/greenbox.gif';
}elseif($total <= 300 ){
$img = 'http://mysite.com/images/bluebox.gif';
}elseif($total <=400){
$img = 'http://mysite.com/images/redbox.gif';
} else{
$img = 'http://mysite.com/images/graybox.gif';
}
[/PHP]
NOTE: This one too you can add more IF statements to get more variety.not tested

USE
[HTML]<img src="<?php echo $img ?>" />[/HTML]

I know there are some errors in there but you should get the picture and be able to fix it.
Nov 8 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
2710
by: Kilroy Programmer | last post by:
Is there a way to store a unique numeric identifier (say, for example, an int) into a TreeNode, so that when the TreeNode is checked (since CheckBoxes is enabled) the eventhandler AfterCheck() can examine the responsible Node's identifier to see which TreeNode triggered the event? Analyzing the Node's Text string is undesirable because it would mean performing a string compare to a set of predefined strings. This is slower and not easily...
3
6447
by: RGow | last post by:
Hi all, I need to get a unique identifier for tables created in DB2 v8.1. I can't use the table name because I want to use the identifier as part of a trigger name and the table names are already at the maximum allowed length. Originally, I wanted to make use of the SYSCAT.TABLES.TABLEID "internal identifier" but found that it is not unique. Surely DB2 must have some unique object identifiers somewhere that can be accessed by providing
6
30712
by: Paul Bromley | last post by:
Ok - I have given up on trying to find the active IP address for a given PC. For licensing purposes I need to retrive a unique identifier from the PC that the program is installed on. The Hard disk serial number would do fine, but on Googling it seems that some of the sample code will now laways work on W2K, and not without administrator rights. Hence my question - how can I consistently get a UNIQUE PC identifier using vb.net 2003 - not...
4
10123
by: ba.hons | last post by:
Hello all, Was wondering if anyone could provide some info on what could be a possible solution to a problem am having. I have to generate a Unique Identifier in C# which I will use to assign to a user, i dont really need the Unique Identifier's to be sequential so i was considering using system.time.hour + system.time.minute. + system.time.second, but am worried about daylight savings and also people altering the time on the host PC.
2
6210
by: Ken | last post by:
Hi, I have a form whose control source is a view from SQL server 2005 database. The view has a primary key that is a unique identifier field with keys generated by newid() function from SQL server 2005. Anyhow when I try to view/assign the unique identifier field and debug/ use watchlist I get this "????????" for the value of the unique identifier. I am able to create a text box with this unique identifier field and view it. Its just when...
4
4265
by: Rob Stevens | last post by:
Is there some sort of unique identifier in every treenode that is consistent? I was looking at the handle of every treenode, but it appears that the handle changes everytime the tree is built. I have seen in some databases where they store the treenodes they are using some serial number of the node. I don't have a clue what that is, but can someone tell me if there is something that is unique to every node.
1
1704
by: SirTKC | last post by:
Hi, Here is the following scenario. I do have a master table with related subforms from wich I need to create a revision. But I need to duplicate the content of the subforms and link them to the new entry in the master table. Each string possess its unique identifier number.
4
2370
by: Mufasa | last post by:
I'm looking for a way to get a truly unique identifier for a machine for our client software. I'd like to have it so that there's little or no setup by the end user. (We set up the machines and then ship them out for most cases but some of our customers do provide their own machines.) Our concern is if somebody takes one of our machines and ghosts it so they have a complete copy of the machine, it will allow them to continue working. We...
13
3714
by: mliptak | last post by:
I'm trying to implement logging in my application, so that each log message has its unique identifier, e.g. log(identifier, text) What I want to achieve is that the compiler screams if the log() with 'identifier' is also used in some other place in the code which would make the 'identifier' not unique. Is that something that can be achieved in C++? Thanks
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9481
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10155
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9953
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8978
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7502
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6741
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5383
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3655
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.