Jump to content

BenRobertson

Members
  • Posts

    15
  • Joined

  • Last visited

BenRobertson's Achievements

Newbie

Newbie (1/7)

2

Reputation

  1. Ok,Thanks for all of your help guys. Plan to focus on PHP when my 6 weeks of schools holidays start (5 days and counting). Also I will register a domain and rent a server when my parents are back from holiday.Thanks,Ben
  2. So does this mean that I would have to start renting a web server with modified permissions?
  3. Okay, so after a bit of delving into the code that is read by the browser I have discovered something that may be effecting the program. If I right click on the random audio files directory inside Google Chrome's "inspect element" interface and then press "open link in new tab" I am confronted with a page reading exactly this: Access forbidden! You don't have permission to access the requested object. It is either read-protected or not readable by the server.If you think this is a server error, please contact the webmaster. Error 403 localhost Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7 Could this mean that my local XAMPP server is not allowing me to access/play the file even though the PHP script can find it?
  4. Ok, so the PHP is working now but the play button on the audio is grayed out as you can see in this picture here: http://s1340.beta.ph...html?sort=3&o=0. The reason I can see that the PHP is being executed is if I right-click, then go "Inspect Element", then find the audio code and refresh the page you can see that the song title changes (but only in the code). Any ideas on how I can fix the issue involving the audio player being grayed out?
  5. Hey, No the file is only currently has an HTML extension as that was the first language I used. If I was to make it PHP would all of the html still run correctly?
  6. When I used Ctrl-Shift-I on Google Chrome it brought up a set of developer tools. This code here: <?php$files = glob('C:\xampp\htdocs\Audio\*.m4a');$random = array_rand($files, 2);$fname1 = $files[$random[0]];$fname2 = $files[$random[1]];?> Appeared as if it was a comment, like this: <!--?php$files = glob('C:\xampp\htdocs\Audio\*.m4a');$random = array_rand($files, 2);$fname1 = $files[$random[0]];$fname2 = $files[$random[1]];?--> I'm not sure why, would you mind explaining?
  7. It still won't work. I put the code to get a random filename above the code of the audio player and tried to no avail. I am beginning to think that the audio could be a sever related thing as all the files for the website are still stored on my pc, their just running through XAMPP in the browser. I have uploaded a screenshot of the issue here:http://s1340.beta.photobucket.com/user/RottenToads/media/tunesmashscreenschot.jpg.html?sort=3&o=0 and also the code again just to be doubly sure. Thanks <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><title>tunesmash</title><style type+text/css>body {color : black;}a {text-decoration: none; color: white;}a:hover {color: #B1B2B1;}#motto {left:33%;position:absolute;top:6%;width:5s0%;}#header {left:5%;position:absolute;top:2%;width:50%;}#upload {left:22%;position:absolute;top:12%;width:50%;}#why {left:17%;position:absolute;top:12%;width:50%;}#about {left:11%;position:absolute;top:12%;width:50%;}#home {left:5%;position:absolute;top:12%;width:50%}#credits {left:40%;position:absolute;top:94%;width:50%;}#body {left:15%;position:absolute;top:45%;width:75%;}#audio1 {left:30%;position:absolute;top:35%;width:10%;}#audio2 {left:55%;position:absolute;top:35%;width:10%;}#title {left:23%;position:absolute;top:25%;width:70%;}.bg {width: 100%;height: 100%;position: absolute;top: 0;left: 0;z-index: -5000;}</style><img src="bgindex2.jpg" class="bg"><div id=header><h2><font face=verdana color=white size=8>tunesmash.com</font></h2></div><div id=motto><font face=verdana size=5 color=white><b>smashing tunes just got better</b></div></font><div id=title><b><font face=verdana size=5 color=black>Tunesmash.com is designed to take the ridicule of bad music to the web</font></b></div><?php$files = glob('C:\xampp\htdocs\Audio\*.m4a');$random = array_rand($files, 2);$fname1 = $files[$random[0]];$fname2 = $files[$random[1]];?><div id=audio1><audio controls="controls"><source src="<?php echo $fname1; ?>" type="audio/mpeg"></audio></div><div id=audio2><audio controls="controls"><source src="<?php echo $fname1; ?>" type="audio/mpeg"></audio></div><div id=body><font face=verdana size=4><center><p>To vote, simply click on the thumbs-up icon below the song you like the most. Tunesmash will automatically refresh the page with new songs.</p><p>If you like the song then download it. Right click on whichever song you like and select "Save audio as". Choose the local save directory for the audio and itwill download.</p><p>You must be using Google Chrome as this site has HTML5 elements in it.</p><p>Click <a href=legal.html><font color=navy blue>here</font></a> to view legal notes</a></p></center></font></div><div id=credits><font face=verdana size=2 color=black><b><p>a ben robertson and alister hughes production</p></b></font></div><font face=verdana size=5.5><div id=home><a href=index.html>home</a></div><div id=about><a href=about.html>about</a></div><div id=why><a href=why.html>why</a></div><b></b><div id=upload><a href=upload.html>upload</a></div></font><a href=index.html><IMG STYLE="position:absolute; TOP:40%; LEFT:38%; WIDTH:29px; HEIGHT:37px" SRC="thumbsup.JPG"></a><a href=index.html><IMG STYLE="position:absolute; TOP:40%; LEFT:63%; WIDTH:29px; HEIGHT:37px" SRC="thumbsup.JPG"></a></body></html>
  8. Hi I set up a Local Host XAMPP server but the PHP code didn't work. Here is the code, would you mind pointing out any errors? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><title>tunesmash</title><style type+text/css>body {color : black;}a {text-decoration: none; color: white;}#motto {left:33%;position:absolute;top:6%;width:5s0%;}#header {left:5%;position:absolute;top:2%;width:50%;}#upload {left:23%;position:absolute;top:12%;width:50%;}#why {left:17%;position:absolute;top:12%;width:50%;}#about {left:11%;position:absolute;top:12%;width:50%;}#home {left:5%;position:absolute;top:12%;width:50%}#credits {left:40%;position:absolute;top:94%;width:50%;}#body {left:15%;position:absolute;top:45%;width:75%;}#audio1 {left:30%;position:absolute;top:35%;width:10%;}#audio2 {left:55%;position:absolute;top:35%;width:10%;}#title {left:23%;position:absolute;top:25%;width:70%;}.bg {width: 100%;height: 100%;position: absolute;top: 0;left: 0;z-index: -5000;}</style><img src="bgindex2.jpg" class="bg"><div id=header><h2><font face=verdana color=white size=8>tunesmash.com</font></h2></div><div id=motto><font face=verdana size=5 color=white><b>smashing tunes just got better</b></div></font><div id=title><b><font face=verdana size=5 color=black>Tunesmash.com is designed to take the ridicule of bad music to the web</font></b></div><div id=audio1><audio controls="controls"><source src="<?php echo $fname1; ?>" type="audio/mpeg"></audio></div><div id=audio2><audio controls="controls"><source src="<?php echo $fname2; ?>" type="audio/mpeg"></audio></div><div id=body><font face=verdana size=4><center><p>To vote, simply click on the thumbs-up icon below the song you like the most. Tunesmash will automatically refresh the page with new songs.</p><p>If you like the song then download it. Right click on whichever song you like and select "Save audio as". Choose the local save directory for the audio and itwill download.</p><p>You must be using Google Chrome as this site has HTML5 elements in it.</p><p>Click <a href=legal.html><font color=navy blue>here</font></a> to view legal notes</a></p></center></font></div><div id=credits><font face=verdana size=2 color=black><b><p>a ben robertson and alister hughes production</p></b></font></div><font face=verdana size=5.5><div id=home><a href=index.html>home</a></div><div id=about><a href=about.html>about</a></div><div id=why><a href=why.html>why</a></div><b></b><div id=upload><a href=upload.html>upload</a></div></font><a href=index.html><IMG STYLE="position:absolute; TOP:40%; LEFT:38%; WIDTH:29px; HEIGHT:37px" SRC="thumbsup.JPG"></a><a href=index.html><IMG STYLE="position:absolute; TOP:40%; LEFT:63%; WIDTH:29px; HEIGHT:37px" SRC="thumbsup.JPG"></a><?php$files = glob('C:\xampp\htdocs\Audio*.m4a');$random = array_rand($files, 2); // get 2 random keys that won't be the same$fname1 = $files[$random[0]];$fname2 = $files[$random[1]];?></body></html>
  9. So... For the part in my code - <source src="RIEY.m4a" type="audio/mpeg">. Would I put $fname1 were RIEY.m4a is currently positioned? Also can PHP go in any part of the code or does it have to be in say... the body section?
  10. Hi again, PHP will only work once the site is actually on a web based server, correct? Also, how to I get the two audio players to select the music once the PHP script has picked the two random audio files? Thank you very much for your time.
  11. Hi justsomeguy, Sorry to keep bothering you but would you mind explaining the issue a little more simply as I am unfamiliar with PHP. The idea of the website is that the user can choose what song they like out of two side by side songs. I have all of the music in a local directory on my PC: C:\Users\Movie\Desktop\TuneSmash\Audio. I need some help so that the website picks a random song out of that folder and the user then has the ability to play it. Would you mind implementing your code into the code that is at the top of the page? Thanks for all the help!
  12. Hey Justsomeguy, Thanks for your quick reply, I am only 13 and have been learning web coding for around 2 months now. Me and a friend at school have decided to make a website focused on comparing two random, different songs with each other. I have the website looking nice, its just that I need the two side by side audio players to select a random song from a given folder, thus allowing the user to vote on which ever song he or she likes the most. I am not familiar with PHP yet and do not physically have a server set up or rented. Thanks in advance, Ben Robertson
×
×
  • Create New...