Using variable declared in URL?
March 11th, 2010 | Posted by admin under enart.qthx.com withex)
lyrics.php?fed=fedname would display a dir listing of everything in the "fedname" directory (preferably split into tables, but I didn't even look for that yet, so I'll try that later), and
lyrics.php?fed=fedname&name=wrestlername would display the file "wrestlername" in the "fedname" directory.
I don't know if this is possible at all, but I'd figure I'd ask, I looked through the php docs but didn't see anything
other than that, its working great
I always think it is hard to be taught to use a computer and especially to be taught to program somthing. Seems something you just have to learn yourself with the aid of books (or online manuals for the experts here :) )
http://www.phpbuilder.com/manual/ref.dir.php
here's basically what'd you'd want to do:
$dir = opendir("/path/to/dir/$name");
echo "
Directory listing for $name
n";echo "Files:
n";
while ($file = readdir($dir)) {
if ($file != "." && $file != ".." {
echo "$file
n";
}
}
closedir($dir);
or you could do this:
$dir = dir("/path/to/dir/$name");
echo "
Directory listing for $name
n";echo "Files:
n";
while ($file = $dir->read()) {
if ($file != "." && $file != ".." {
echo "$file
n";
}
}
$dir->close();
[Edited by JohnM on 10-21-2000 at 03:53 PM]
For example, if you type "test.php?name=John", PHP would create a variable called $name with the value of John.
.. but it helps to know C :)
change this:
if ($file != "." && $file != ".." {
to
if ($file != "." && $file != "..") {
#If you have any other info about this subject , Please add it free.# |