stirk Posted August 3, 2009 Share Posted August 3, 2009 I have basic knowledge of PHP syntax and thats about it. anyway... say i have x amount of people coming to a webpage. i want about 20% of the users to see a certain message. how can i accomplish this? I was thinking about using their IP address. addresses ending in 0 and 1 see the message 2-9 do not. is this possible? for all i know there is a much simpler solution, but as i said i know virtually nothing of PHP. thanks for your time. Link to comment https://forums.phpfreaks.com/topic/168714-a-humble-inquiry-regarding-ip-addresses/ Share on other sites More sharing options...
jonsjava Posted August 3, 2009 Share Posted August 3, 2009 that actually would most likely work. Just remember: 1 is the most common number, 5 is the second most common number. I saw a graph on this, so if you were to calculate based upon the number that has the percentage closest to 20%, you would only need to watch for that number, rather than 2 numbers. I'm bashing my brain in trying to remember what that graph was called. Link to comment https://forums.phpfreaks.com/topic/168714-a-humble-inquiry-regarding-ip-addresses/#findComment-890101 Share on other sites More sharing options...
stirk Posted August 3, 2009 Author Share Posted August 3, 2009 ahh awesome. ill look for information regarding the digits. if worse comes to worse ill just do trial and error. now could you just throw me a quick outline of the code i should use? sorry im asking to be spoonfed but itd save me a whole lot of time. Link to comment https://forums.phpfreaks.com/topic/168714-a-humble-inquiry-regarding-ip-addresses/#findComment-890112 Share on other sites More sharing options...
plznty Posted August 3, 2009 Share Posted August 3, 2009 Could you have it so that there is a random number generated from 1-5, then if it is a 1 then it echos "your msg". Link to comment https://forums.phpfreaks.com/topic/168714-a-humble-inquiry-regarding-ip-addresses/#findComment-890114 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.