luke777 Posted December 10, 2007 Share Posted December 10, 2007 Hi right ok... this is the script i am using at the moment <?php $url[0] = "http://www.siteone.com"; $url[1] = "http://www.sitetwo.com"; $url[2] = "http://www.sitethree.com"; $url[3] = "http://www.sitefour.net"; $url[4] = "http://www.sitefive.com"; $url[5] = "http://www.sitesix.com"; srand ((double)microtime()*1000000); $randomnum = rand(0, count($url)-1); header ("Location: $url[$randomnum]"); ?> It works great but what i really need is a script so that i can control where the hits are going. What i need is a script that has the option to speficy the percentage of hits thats should go to each site out of the total traffic. For example: http://www.siteone.com - takes 40% http://www.sitetwo.com - takes 30% http://www.sitethree.com - takes 10% http://www.sitefour.com - takes 10% http://www.sitefive.com - takes 5% http://www.sitesix.com - takes 5% I hope I have explained clearly enough what i am looking for, if anyone thinks they could help me i would REALLY appreciate it!! Thanks Luke. Quote Link to comment Share on other sites More sharing options...
luke777 Posted December 10, 2007 Author Share Posted December 10, 2007 Please someone I really need this to work, sorry for double posting. ANY HELP is much appreciated!!! Quote Link to comment Share on other sites More sharing options...
rarebit Posted December 10, 2007 Share Posted December 10, 2007 easiest way is to set up another array, e.g. $l=array(0,1,2,3,4,5,0,1,2,3,0,1,0,1,0,1,0,1,0,0);, then select a random number from this and use that element from original array... p.s. you might want to shake up that array a bit! Quote Link to comment Share on other sites More sharing options...
luke777 Posted December 10, 2007 Author Share Posted December 10, 2007 I dont actually know php so i cant implement it :'( Quote Link to comment Share on other sites More sharing options...
rarebit Posted December 10, 2007 Share Posted December 10, 2007 <?php $url[0] = "http://www.siteone.com"; $url[1] = "http://www.sitetwo.com"; $url[2] = "http://www.sitethree.com"; $url[3] = "http://www.sitefour.net"; $url[4] = "http://www.sitefive.com"; $url[5] = "http://www.sitesix.com"; $l=array(0,1,2,3,4,5,0,1,2,3,0,1,0,1,0,1,0,1,0,0); srand ((double)microtime()*1000000); $randomnum = rand(0, count($l)-1); header ("Location: $url[$l[$randomnum]]"); ?> I believe that should work! Quote Link to comment Share on other sites More sharing options...
luke777 Posted December 10, 2007 Author Share Posted December 10, 2007 I guess this would work but its still "Random" Which means.... yea, its more likely to select a number that occurs more times in the list but its not as reliable as i need it to be. Do you know what i mean? I need a guaranteed 10% on the dot (or as close as possible to).... if 10% is the case for one of the sites. Mabe some kind of link "weight" setting for work.... i dont know Anyone that could come up with this would be a life saver! Quote Link to comment Share on other sites More sharing options...
rarebit Posted December 10, 2007 Share Posted December 10, 2007 if all the num's and position's are random then it should come in as near as damn it. If you wanted to, you could remove certain options after so many occurrences, until all conditions met, then reset. Quote Link to comment Share on other sites More sharing options...
luke777 Posted December 10, 2007 Author Share Posted December 10, 2007 I really appreciate your time and help rarebit but i really do need somthing more accurate/reliable. Luke. Quote Link to comment Share on other sites More sharing options...
JacobYaYa Posted December 10, 2007 Share Posted December 10, 2007 Link removed because of nipples. I PMed you a link. Quote Link to comment Share on other sites More sharing options...
rarebit Posted December 10, 2007 Share Posted December 10, 2007 you'd need a static reference (file, mysql), or is this on a per person basis, cos then you could use a session variable??? Quote Link to comment Share on other sites More sharing options...
luke777 Posted December 13, 2007 Author Share Posted December 13, 2007 you'd need a static reference (file, mysql), or is this on a per person basis, cos then you could use a session variable??? Somthing that works with php and mysql would be good it.... (im not a coder in php but this is what the script would have to do) If .... *site1count variable* is = 30 hits then redirect to a different url else send hit to site1 url etc etc etc This way i could set an exact number of hits for each site! Im sure someone here could come up with something like that for me.... Anyone that will is a star!!!!!! would REALLY appreciate it Quote Link to comment Share on other sites More sharing options...
luke777 Posted December 14, 2007 Author Share Posted December 14, 2007 SOMEONE PLEASE HELP ??? ??? ??? ??? ??? I really need this.... i can offer 3,000 unique visitors in traffic as payment to anyone that can come up with this code!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.