Jump to content

DaveLinger

Members
  • Posts

    268
  • Joined

  • Last visited

    Never

About DaveLinger

  • Birthday 10/24/1989

Contact Methods

  • AIM
    DaveLinger89
  • Website URL
    http://www.DaveLinger.com
  • Yahoo
    dave_s_linger

Profile Information

  • Gender
    Male
  • Location
    WV, USA

DaveLinger's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. Basically the php code finds subfolders in a "screenshots" directory of a game's directory, then lists each subdir it finds. Currently they're not sorted in terms of what order they're being printed. $dirpath = "games/{$gameid}/screens/"; $dir = opendir($dirpath); while (($filename = readdir($dir)) !== false){ if($filename != "" && $filename != "." && $filename != ".."){ if(strpos($filename, ".") === false){ echo "<div class=\"category\"><a href=\"game.php?id={$gameid}&page=screenshots&cat={$filename}\">{$filename}</a></div>"; } } }
  2. oops must of missed that this are the words I've found.. idealization idealizations linearization illegalization indefatigation liberalisation liberalization mineralization interlamination internalization liberalizations InterApplication deliberalization demineralization interapplication semihepatization sentimentalization trade-liberalization the dictionary was taken from here : ftp://ftp.ox.ac.uk/pub/wordlists/american/ this is the code I used.. in case anyone cares.. #!C:\strawberry\perl\bin #i read the dir , because it contained more than one file opendir DIR,"dex"; while ($line =readdir(DIR)){ if ($line ne /.+/){ push @array,$line; #I remember all file names in @array } } #i remove first two values of the array which are "." and ".." shift(@array); shift(@array); open TOTAL ,">dex.txt"; #checking everyfile.. foreach $val (@array){ open F,"<","dex/".$val; while ($line=<F>){ if ($line =~ /[bcdfghjklmnpqrstxyz]*i[bcdfghjklmnpqrstxyz]*e[bcdfghjklmnpqrstxyz]*a[bcdfghjklmnpqrstxyz]*i[bcdfghjklmnpqrstxyz]*a[bcdfghjklmnpqrstxyz]*i[bcdfghjklmnpqrstxyz]*o[bcdfghjklmnpqrstxyz]*/i){ print TOTAL $line,"\n"; } } close F; } awesome! Thanks! However: deliberalization demineralization semihepatization sentimentalization trade-liberalization Do not qualify
  3. I have no experience with perl, but from what I can see, there's nothing in the script preventing extra vowels from being present. Is that true or am I reading it wrong?
  4. So I was having a discussion with a friend of mine about a song called I-E-A-I-A-I-O. I read somewhere that one proposed meaning of the title is that it represents the vowels in the word I-D-E-A-L-I-Z-A-T-I-O-N. He said that it doesn't matter cause probably lots of words meet the criteria. I, however, think that VERY few words meet the criteria of having this specific 7-character vowel combination IN ORDER with no extra vowels at all. So... I want to know now! Haha. So first, does anyone know of any database or xls or text file that I can try this with? The less abridged the better. Second, how would I go about it? There can be any number of characters between the vowels, but none of those characters can be vowels - and they have to be in order, and there can't be any extra vowels.
  5. Whoops, nevermind, I found the error. It was looking for directories again, instead of files. (was looking for files without a "." in their name)
  6. Ah, indeed. Good call. That fixed that. But apparently it's also not listing the files in each category, as if the folder is empty. My new code: echo "<div class=\"box\"> <div class=\"box1\"><h2>Map Categories</h2></div> <div class=\"box2\">"; $dirpath = "games/{$gameid}/maps/"; $dir = opendir($dirpath); while (($filename = readdir($dir)) !== false){ if($filename != "" && $filename != "." && $filename != ".."){ if(strpos($filename, ".") === false){ echo "<a href=\"#{$filename}\">{$filename}</a> "; } } } echo "</div></div><br />"; $dirpath = "games/{$gameid}/maps/"; $dir = opendir($dirpath); while (($filename = readdir($dir)) !== false){ if($filename != "" && $filename != "." && $filename != ".."){ if(strpos($filename, ".") === false){ echo "<div class=\"box\"> <div class=\"box1\"><h2>{$filename}</h2><a name=\"{$filename}\"></a></div> <div class=\"box2\"> <ul>"; $dirpath1 = "games/{$gameid}/maps/{$filename}/"; $dir1 = opendir($dirpath1); while (($filename1 = readdir($dir1)) !== false){ if($filename1 != "" && $filename1 != "." && $filename1 != ".."){ if(strpos($filename1, ".") === false){ echo "<li><a href=\"{$filename1}\">{$filename1}</a></li>"; } } } echo "</ul> </div></div><br />"; } } }
  7. So what I'm trying to do is scan a directory "maps" for subdirectories (which will be used as categories). At the top of the page, I want to list the "categories", with anchor links/bookmark links (#these) to the part of the page (below) that lists that category's contents. I've got it all working EXCEPT that it only lists the contents of the FIRST category, then stops. echo "<div class=\"box\"> <div class=\"box1\"><h2>Map Categories</h2></div> <div class=\"box2\">"; $dirpath = "games/{$gameid}/maps/"; $dir = opendir($dirpath); while (($filename = readdir($dir)) !== false){ if($filename != "" && $filename != "." && $filename != ".."){ if(strpos($filename, ".") === false){ echo "<a href=\"#{$filename}\">{$filename}</a> "; } } } echo "</div></div><br />"; $dirpath = "games/{$gameid}/maps/"; $dir = opendir($dirpath); while (($filename = readdir($dir)) !== false){ if($filename != "" && $filename != "." && $filename != ".."){ if(strpos($filename, ".") === false){ echo "<div class=\"box\"> <div class=\"box1\"><h2>{$filename}</h2><a name=\"{$filename}\"></a></div> <div class=\"box2\"> <ul>"; $dirpath = "games/{$gameid}/maps/{$filename}/"; $dir = opendir($dirpath); while (($filename1 = readdir($dir)) !== false){ if($filename1 != "" && $filename1 != "." && $filename1 != ".."){ if(strpos($filename1, ".") === false){ echo "<li><a href=\"{$filename1}\">{$filename1}</a></li>"; } } } echo "</ul> </div></div>"; } } } Example output: <div class="box1"><h2>Map Categories</h2></div> <div class="box2"><a href="#World 8">World 8</a> <a href="#World 2">World 2</a> <a href="#Miscellaneous">Miscellaneous</a> <a href="#World 1">World 1</a> </div></div><br /><div class="box"> <div class="box1"><h2>World 8</h2><a name="World 8"></a></div> <div class="box2"> <ul></ul> </div></div>
  8. So basically on this website I'm building, I have a bunch of mp3 files that I want people to be able to listen to using a flash mp3 player on the site, and I want them to be able to (I suppose) save the files to their hard drives, but NOT be able to link directly to the mp3 from other websites. So here's my code: <?php $gid = $_GET['g']; //game ID number. Each game has its own music directory. $file = $_GET['f']; //filename minus the .mp3 $yoursite = "www.xxx.com"; $yoursite2 = "xxx.com"; $referer = $_SERVER['HTTP_REFERER']; if ($referer == "") { $domain = $yoursite; } else { $domain = parse_url($referer); } if($domain['host'] == $yoursite || $domain['host'] == $yoursite2) { $location = "/games/".$gid."/music/".$file.".mp3"; header("Location: $location"); } else { header("Location: http://www.xxx.com"); } ?> But the problem with this is that, assuming they ARE on the site, it just gives them the direct URL to the file. How can I set it so that rather than essentially redirecting to the mp3 file, the php file actually outputs the contents of the mp3 file? For example they could save the php file to their hard drive and rename it to mp3 and it would play. I think I've seen this done before.
  9. I'm getting this error: PHP Fatal error: Call to undefined function mime_content_type()
  10. Thanks for your help, fanfavorite. Correct me if I'm wrong, but this code does not read or use the actual filename extension at all, right? It actually uses the mimetype - and wouldn't that mean that it would echo, for example, "audio/mpeg3" instead of "mp3"?
  11. How can I list all of the, say, mp3 and wav files in a directory and display some of their stats? I'd like something like this as a result: /// 3 items found "A song about soccer" - 1.85MB mp3 "Basketball is cool" - 2.10MB wav "Cool song" - 1.11MB mp3 /// I understand that the filesize will probably be in bytes, but that's not a big deal and isn't really important right now. I'd also like to know if it's possible to read any metadata from the files, like creation date, modified date, etc.
  12. My final code (for others' reference): $totalrows = mysql_num_rows($result); if($totalrows >0){ for($i = 1;$row = mysql_fetch_row($result);$i++){ echo "<td><a href=\"game.php?id={$row[0]}\"><img src=\"images/games/thumbs/{$row[0]}_t.png\" alt=\"{$row[2]}\"><br />{$row[2]}</a></td>"; if($i%3 == 0 && $i != $totalrows){echo "</tr><tr>";} if($i == $totalrows && $i%3 != 0){ $i1 = $i+1; if($i1%3 == 0){echo "<td> </td>";} $i2 = $i+2; if($i2%3 == 0){echo "<td> </td><td> </td>";} } } }else{ echo "<p>No results found!</p>"; } As you can see I made it add enough blank cells after the last row to even out the table.
  13. How would I make it so that if it's the last result, it does NOT do this? I can close the tr and the table outside of the loop, but it's no good if it opens a new tr that I'll just have to immediately close at the end.
×
×
  • 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.