Jump to content

davehardyuk

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

About davehardyuk

  • Birthday 10/25/1982

Contact Methods

  • Website URL
    http://www.dhardy.co.uk

Profile Information

  • Gender
    Not Telling
  • Location
    Plymouth, UK

davehardyuk's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi guys, i have this code: [code]print " <body marginheight=\"0\" marginwidth=\"0\" leftmargin=\"0\" rightmargin=\"0\"> <object id=\"MediaPlayer\" width=\"360\" height=\"69\" classid=\"CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95\" type=\"application/x-oleobject\"> <param name=\"FileName\" Value=\"$fileid\"> <param name=\"ShowControls\" value=\"true\"><param name=\"ShowStatusBar\" value=\"true\"> <param name=\"ShowStatusBar\" value=\"true\"><param name=\"ShowDisplay\" value=\"false\"> <param name=\"autostart\" value=\"true\"> <EMBED SRC=\"$fileid\" WIDTH=\"360\" HEIGHT=\"69\" AUTOSTART=\"FALSE\" TYPE=\"audio/mpeg\"></EMBED> </object>";[/code] Which pulls in a variable called $fileid. The problem is, sometimes the fileid has an apostrophe in the filename and it can't be played. Any ideas on how to get around it? Thanks, Dave
  2. Hi Guys, I need the code to be able to search a folder and all folders within it, and then all folders within those sub-folders. The following code will search a folder and all subfolders in it, but i'm not sure how to get it to carry on searching within those subfolders and so on... [code]<?php $searchstring = $_REQUEST['searchstring']; if ($searchstring == ""){ print "Please enter some text to search for!"; return; } $dir=opendir("media"); $files=array(); while (($file=readdir($dir)) !== false) { if ($file != "." and $file != ".." and $file != "index.php" and $file != "fileupload-class.php" and $file != "icon.gif" and $file != "launch.gif" and $file != "download.php" and $file != "index.asp" and $file != "images" and $file != "login_check.asp" and $file != "main.php" and $file != "delete.gif" and $file != "images" and $file != "delete.php" and $file != "spacer.gif" and $file != "ianstanton" and $file != "play_all.m3u" and $file != "play_all_shuffle.m3u") { array_push($files, $file); } } closedir($dir); sort($files); foreach ($files as $file){ $ext = explode('.', $file); $extension = $ext[count($ext)-1]; if (($extension == "mp3")&&(eregi("$searchstring", $file))) { print "<table width='220' border='0'> <tr><td align='left' valign'top'><a href='http://audiostation/playmedia.php?fileid=http://audiostation/media/$file&download=yes' target='player'><img src='images/music_icon.gif' alt='$file' border='0'></a><td></td><td width='205' style='font-family: Arial, Helvetica, sans-serif; font-size:10px;'><strong><a style='color:001F63;' class='body' href='playmedia.php?fileid=http://audiostation/playmedia.php?fileid=http://audiostation/media/$file&download=yes' target='player'>$file</a></strong></td></tr></table>"; } if ($extension  !=  "mp3") { $dir=opendir("media/$file"); $album=$file; $files=array(); while (($file=readdir($dir)) !== false) { if ($file != "." and $file != ".." and $file != "index.php" and $file != "fileupload-class.php" and $file != "icon.gif" and $file != "launch.gif" and $file != "download.php" and $file != "index.asp" and $file != "images" and $file != "login_check.asp" and $file != "main.php" and $file != "delete.gif" and $file != "images" and $file != "delete.php" and $file != "spacer.gif" and $file != "ianstanton" and $file != "play_all.m3u" and $file != "play_all_shuffle.m3u") { array_push($files, $file); } } closedir($dir); sort($files); foreach ($files as $file){ $get = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF']; $cur_dir = dirname($get); $DirNow = dirname($get); $DirUp = dirname($DirNow); $ext = explode('.', $file); $extension = $ext[count($ext)-1]; if (($extension == "mp3")&&(eregi("$searchstring", $file))) { print "<table width='220' border='0'> <tr><td align='left' valign'top'><a href='http://audiostation/playmedia.php?fileid=media/$album/$file&download=yes' target='player'><img src='images/music_icon.gif' alt='$file' border='0'></a><td></td><td width='205' style='font-family: Arial, Helvetica, sans-serif; font-size:10px;'><strong><a style='color:001F63;' class='body' href='playmedia.php?fileid=media/$album/$file&download=yes' target='player'>$file</a></strong></td></tr></table>"; } } } } ?>[/code] It basically checks the first folder for mp3 files that have the search text in it, if it finds a mp3 it displays it, if it finds a folder, it will then search that for mp3s and display them, but then i can't get it to search the next folders if it finds one! Any ideas? I'm sure it's quite easy but can't figure it out. Thanks alot, Dave
  3. Actually I think I should be ok if i just knew the code to open subdirectories within the folder "media". Sorry my first confusing post! Thanks, Dave
  4. Hi Guys, Currently i can get a page to scan files in a folder, if they're mp3's list them, otherwise open up the subfolder and display those mp3s that include the text as links, but can't get it to go into the next subfolder! my code is as follows: (apologies for the bad formatting!) [code]<?php $searchstring = $_REQUEST['searchstring']; if ($searchstring == ""){ print "Please enter some text to search for!"; return; } $dir=opendir("media"); $files=array(); while (($file=readdir($dir)) !== false) { if ($file != "." and $file != ".." and $file != "index.php" and $file != "fileupload-class.php" and $file != "icon.gif" and $file != "launch.gif" and $file != "download.php" and $file != "index.asp" and $file != "images" and $file != "login_check.asp" and $file != "main.php" and $file != "delete.gif" and $file != "images" and $file != "delete.php" and $file != "spacer.gif" and $file != "ianstanton" and $file != "play_all.m3u" and $file != "play_all_shuffle.m3u") { array_push($files, $file); } } closedir($dir); sort($files); foreach ($files as $file){ $ext = explode('.', $file); $extension = $ext[count($ext)-1]; if (($extension == "mp3")&&(eregi("$searchstring", $file))) { print "<table width='220' border='0'> <tr><td align='left' valign'top'><a href='playmedia.php?fileid=http://audiostation/media/$file&download=yes' target='player'><img src='images/music_icon.gif' alt='$file' border='0'></a><td></td><td width='205' style='font-family: Arial, Helvetica, sans-serif; font-size:10px;'><strong><a style='color:001F63;' class='body' href='playmedia.php?fileid=http://audiostation/media/$file&download=yes' target='player'>$file</a></strong></td></tr></table>"; } if ($extension  !=  "mp3") { $dir=opendir("media/$file"); $files=array(); while (($file=readdir($dir)) !== false) { if ($file != "." and $file != ".." and $file != "index.php" and $file != "fileupload-class.php" and $file != "icon.gif" and $file != "launch.gif" and $file != "download.php" and $file != "index.asp" and $file != "images" and $file != "login_check.asp" and $file != "main.php" and $file != "delete.gif" and $file != "images" and $file != "delete.php" and $file != "spacer.gif" and $file != "ianstanton" and $file != "play_all.m3u" and $file != "play_all_shuffle.m3u") { array_push($files, $file); } } closedir($dir); sort($files); foreach ($files as $file){ $ext = explode('.', $file); $extension = $ext[count($ext)-1]; if (($extension == "mp3")&&(eregi("$searchstring", $file))) { print "<table width='220' border='0'> <tr><td align='left' valign'top'><a href='playmedia.php?fileid=http://audiostation/media/$file&download=yes' target='player'><img src='images/music_icon.gif' alt='$file' border='0'></a><td></td><td width='205' style='font-family: Arial, Helvetica, sans-serif; font-size:10px;'><strong><a style='color:001F63;' class='body' href='playmedia.php?fileid=http://audiostation/media/$file&download=yes' target='player'>$file</a></strong></td></tr></table>"; } } } } ?>[/code] I'm wanting to create a search page that will search the folder "media" and all of it's subfolders for mp3 files and then list them as links to playmedia.php?fileid= --mp3 url here -- I'm getting the search text and putting it into a variable called $searchstring Any help would be greatly appreciated! Thanks in advance! Dave
  5. Sorted it now! Needed \\$file for some reason. Although i now need it to copy index.php and overite any existing index.php file, but only if it exists, otherwise just copy it. Any ideas how to do this? Thanks, Dave
  6. Just tried that but comes up with the same error. Here's what it gives me: Warning: copy(F:\iTunes$file\index.php) [function.copy]: failed to open stream: No such file or directory in c:\Inetpub\wwwroot\list.php on line 27 The wwwroot has read/write for any user. I know that $file is holding the folder as it's being printed out on the same page! Also for some reason it's taking out the backslash before the variable which i presume is why it's not working! Thanks alot, Dave
  7. Hi Guys, I have this code: [code]$source_file = 'copy/index.php'; $dest_file = 'F:\iTunes\$file\index.php'; copy($source_file, $dest_file); [/code] I want it to copy index.php to a location that includes a variable ($file) that holds a folder name but it doesn't seem to like it. Any ideas? Thanks in advance! Dave
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.