dalka
03-11-2009, 12:14 PM
Hi everyone can someone help me php random mp3 code i want everytime loads home page plays new mp3.
Thanks all :D:D
Thanks all :D:D
|
||||
Random mp3dalka 03-11-2009, 12:14 PM Hi everyone can someone help me php random mp3 code i want everytime loads home page plays new mp3. Thanks all :D:D sea4me 03-11-2009, 11:22 PM would your mp3 names be numbers or letters? change chars to what letters/numbers would be allowed... function CreateRandomCode($len) { $chars = "123456789"; srand((double)microtime()*1000000); $code = '' ; $len++; for ($i=0;$i<=$len; $i++) { $num = rand() % 33; $tmp = substr($chars, $num, 1); $code = $code . $tmp; } return $code; } and on ur page it would be something like: echo CreateRandomCode(2) . ".mp3"; assuming that you have 99 mp3 and there names are gonna be : 1.mp3 2.mp3 3.mp3 ..... sea4me 03-11-2009, 11:26 PM Or just change the code on this page: http://www.codingforums.com/showthread.php?t=94922 |
| |||
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum