View Single Post
Old 02-23-2009, 08:46 PM   #3 (permalink)
Lou_Gato
The Wanderer
 
Join Date: Oct 2008
Posts: 14
Thanks: 0
Lou_Gato is on a distinguished road
Default sorry..

yeah i probably should have posted the whole script..
the reason i was using opendir is because i am doing a db query right before it to make sure it does not show the files that are already stored in the database..

Code:
  <?php
			$result = mysql_query("select * from tbl_videos");

			$existing = array(0 => "noefind");
			while($row = mysql_fetch_assoc($result)){
				$existing[] = $row["trailer"];
			}
			if(!$newdir==0){
					$dir = "../video/$newdir";
			}else{
				//echo "please go back and select a category first <a href=\"addvideo.php\">Select Category to upload to</a>";
				$dir = "../video/";
			}
			// list current directory
			if (is_dir($dir)) {
				if ($dh = opendir($dir)) {
					
					while (($file = readdir($dh)) !== false) {
						if($file != '.' & $file != '..' & $file != '' & filetype($dir)=='dir'){
							
							$pieces = explode(".", $file);
							$extension = $pieces[1];

							if(array_search($pieces[0], $existing)){
								if($found == 0) { $found = 0;
								}
							}else{

								if($extension == 'wmv'){							
									//echo "$file " . filetype($dir . $file) . "<br>";
								echo "<input type='radio' name='trailer' value='".$pieces[0]."'><font color='white'> ".$file."</font><br>";
								
								}
							}
						}
					}// end while
					closedir($dh);
				}
			}
			
			
              
            ?>
Lou_Gato is offline  
Reply With Quote