eng15ine Posted June 13, 2010 Share Posted June 13, 2010 Hello, I would like to make it so when ever some goes to myserver.net/new it will display a link to www.anotherserver.com/rese/aos/aos/?efwefe=RANDOM-TEXT-HERE@myserver.net.com&efw=Jodk&wef&system=18410=oh&compver=885455 Where it says RANDOMTEXTHERE in bold I would like to show random text every time the page is accessed. Ive been trying to figure this out for some time, but have no idea. Help would be much appreciated! Thanks in advance! Link to comment https://forums.phpfreaks.com/topic/204622-create-random-text-in-the-middle-of-a-link/ Share on other sites More sharing options...
kenrbnsn Posted June 13, 2010 Share Posted June 13, 2010 This will produce a random string 20 characters in length: <?php $str = substr(str_shuffle(implode("",array_merge(range('a','z'),range('A','Z')))),0,20); echo $str; ?> You can make it into a function: <?php function randstr($len) { return(substr(str_shuffle(implode("",array_merge(range('a','z'),range('A','Z')))),0,$len)); } echo '<a href="http://www.anotherserver.com/rese/aos/aos/?efwefe=' . randstr(20) . '@myserver.net.com&efw=Jodk&wef&system=18410=oh&compver=885455">text</a>'; ?> Just enter the length of the string you want to generate. Ken Link to comment https://forums.phpfreaks.com/topic/204622-create-random-text-in-the-middle-of-a-link/#findComment-1071340 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.