Hi there,
I have a simple question which isn't related to Directadmin, which is the reason it's posted here.
I want to create a simple PHP script which will play a random number of MP3 files, the numbers can be changed as an example: have the script play 1 to 4 mp3's, etc.
The script will read information about the selected playing file from a text file stored on the server with the MP3 or Mp3's, and the script should display on the site, the information stored in the text file for the specific MP3 or mp3's being played
For instance: If I play a file called test,mp3, the script should also open a file called test.txt. The test.txt will have information such as artist, albam, time, etc for the test.mp3 file. This information in test.txt should be displayed on the page that the script is included on, while test.mp3 is being played, and once it's over, close the test.txt file. When test1.mp3 plays, open test1.txt and test1.mp3's information should replace test.mp3's information with test1.mp3's info on the site.
Is this setup possible? And if so, would someone be willing to either create a simple script? or give an example script for me to modify?
If I read the PHP manual correct, I know that there is the rand function which should allow me to do something like, as an example:
Which will tell PHP to play up to 4 MP3 files at a time. It's quite possible that's the right function, from what I saw, but as I'm rusty at PHP after not using it for a while, I forget.
I appreciate any help that can be provided.
P.S.: I failed to mention, the MP3's and text files will be in a specific directory and thus the script should have a directory variable to read from.
I have a simple question which isn't related to Directadmin, which is the reason it's posted here.
I want to create a simple PHP script which will play a random number of MP3 files, the numbers can be changed as an example: have the script play 1 to 4 mp3's, etc.
The script will read information about the selected playing file from a text file stored on the server with the MP3 or Mp3's, and the script should display on the site, the information stored in the text file for the specific MP3 or mp3's being played
For instance: If I play a file called test,mp3, the script should also open a file called test.txt. The test.txt will have information such as artist, albam, time, etc for the test.mp3 file. This information in test.txt should be displayed on the page that the script is included on, while test.mp3 is being played, and once it's over, close the test.txt file. When test1.mp3 plays, open test1.txt and test1.mp3's information should replace test.mp3's information with test1.mp3's info on the site.
Is this setup possible? And if so, would someone be willing to either create a simple script? or give an example script for me to modify?
If I read the PHP manual correct, I know that there is the rand function which should allow me to do something like, as an example:
PHP:
rand(1-4)
I appreciate any help that can be provided.
P.S.: I failed to mention, the MP3's and text files will be in a specific directory and thus the script should have a directory variable to read from.
Last edited: